Browse Source

update drawGrid to save images with indexed pixels.

master
Craig Oates 6 years ago
parent
commit
2e2fc0d4c8
  1. 6
      DeathSocket/ImageServices.fs

6
DeathSocket/ImageServices.fs

@ -17,8 +17,11 @@
Point ((interval * point), height)|]|]
let drawGrid spec =
let img = Bitmap.FromFile spec.originalPath
// The originalImg is for images with indexed pixels.
let orignialImg = Bitmap.FromFile spec.originalPath
let img = new Bitmap (orignialImg.Width, orignialImg.Height)
let graphics = Graphics.FromImage img
graphics.DrawImage (orignialImg, 0, 0)
let pen = new Pen (spec.colour, width = spec.penWidth)
let horizontalLines =
createHorizontalLines (img.Size.Width) (img.Size.Height) (spec.rows)
@ -27,6 +30,7 @@
for line in horizontalLines do graphics.DrawLines (pen, line)
for line in verticalLines do graphics.DrawLines (pen, line)
img.Save (spec.savePath, ImageFormat.Png)
orignialImg.Dispose ()
img.Dispose ()
graphics.Dispose ()
pen.Dispose ()
Loading…
Cancel
Save