|
|
|
@ -18,16 +18,17 @@
|
|
|
|
|
Point ((interval * point), height)|]|] |
|
|
|
|
|
|
|
|
|
let drawGrid spec = |
|
|
|
|
let img = Bitmap.FromFile spec.originalPath |
|
|
|
|
let graphics = Graphics.FromImage(img) |
|
|
|
|
let pen = new Pen (spec.colour, width = spec.penWidth) |
|
|
|
|
// The temp. file is used as a way to convert images with index pixels. |
|
|
|
|
use original = Bitmap.FromFile spec.originalPath |
|
|
|
|
use temp = new Bitmap(original) |
|
|
|
|
use clone = temp.Clone(new Rectangle(0, 0, temp.Width, temp.Height), PixelFormat.Format32bppArgb) |
|
|
|
|
use graphics = Graphics.FromImage(clone) |
|
|
|
|
use pen = new Pen (spec.colour, width = spec.penWidth) |
|
|
|
|
graphics.DrawImage(original,new Rectangle(0, 0, clone.Width, clone.Height)) |
|
|
|
|
let horizontalLines = |
|
|
|
|
createHorizontalLines (img.Size.Width) (img.Size.Height) (spec.rows) |
|
|
|
|
createHorizontalLines (clone.Size.Width) (clone.Size.Height) (spec.rows) |
|
|
|
|
let verticalLines = |
|
|
|
|
createVerticalLines (img.Size.Width) (img.Size.Height) (spec.columns) |
|
|
|
|
createVerticalLines (clone.Size.Width) (clone.Size.Height) (spec.columns) |
|
|
|
|
for line in horizontalLines do graphics.DrawLines (pen, line) |
|
|
|
|
for line in verticalLines do graphics.DrawLines (pen, line) |
|
|
|
|
img.Save (spec.savePath) |
|
|
|
|
img.Dispose() |
|
|
|
|
graphics.Dispose() |
|
|
|
|
pen.Dispose() |
|
|
|
|
clone.Save (spec.savePath) |