CraftSynth.ImageEditor – Diff between revs 1 and 2
?pathlinks?
Rev 1 | Rev 2 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | using System; |
1 | using System; |
|
2 | using System.Drawing; |
2 | using System.Drawing; |
|
3 | using System.Drawing.Drawing2D; |
3 | using System.Drawing.Drawing2D; |
|
4 | using System.Drawing.Imaging; |
4 | using System.Drawing.Imaging; |
|
- | 5 | using System.IO; |
||
5 | using System.Runtime.Serialization; |
6 | using System.Runtime.Serialization; |
|
6 | using System.Security; |
7 | using System.Security; |
|
7 | using System.Threading; |
8 | using System.Threading; |
|
8 | using System.Windows.Forms; |
9 | using System.Windows.Forms; |
|
Line 1287... | Line 1288... | |||
1287 | drawArea.TheLayers.Draw(g); |
1288 | drawArea.TheLayers.Draw(g); |
|
1288 | b.Save(filePath, imageFormat); |
1289 | b.Save(filePath, imageFormat); |
|
1289 | } |
1290 | } |
|
1290 | } |
1291 | } |
|
1291 | } |
1292 | } |
|
1292 | |
1293 | |
|
- | 1294 | public byte[] ExportBytes(ImageFormat imageFormat) |
||
- | 1295 | { |
||
- | 1296 | using (MemoryStream m = new MemoryStream()) |
||
- | 1297 | { |
||
- | 1298 | using (Bitmap b = new Bitmap(drawArea.Width, drawArea.Height)) |
||
- | 1299 | { |
||
- | 1300 | using (Graphics g = Graphics.FromImage(b)) |
||
- | 1301 | { |
||
- | 1302 | g.Clear(Color.White); |
||
- | 1303 | drawArea.DeselectAll(); |
||
- | 1304 | drawArea.TheLayers.Draw(g); |
||
- | 1305 | b.Save(m, imageFormat); |
||
- | 1306 | } |
||
- | 1307 | } |
||
- | 1308 | |
||
- | 1309 | return m.ToArray(); |
||
- | 1310 | } |
||
- | 1311 | } |
||
- | 1312 | |
||
1293 | public Image ExportToImage() |
1313 | public Image ExportToImage() |
|
1294 | { |
1314 | { |
|
1295 | Bitmap b = new Bitmap(drawArea.Width, drawArea.Height); |
1315 | Bitmap b = new Bitmap(drawArea.Width, drawArea.Height); |
|
1296 | Graphics g = Graphics.FromImage(b); |
1316 | Graphics g = Graphics.FromImage(b); |
|
1297 | g.Clear(Color.White); |
1317 | g.Clear(Color.White); |