|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
open System.Drawing |
|
|
|
|
open System.Drawing.Imaging |
|
|
|
|
open DeathSocket |
|
|
|
|
open System.Drawing.Drawing2D |
|
|
|
|
|
|
|
|
|
let createHorizontalLines width height rows = |
|
|
|
|
let interval = height / rows |
|
|
|
@ -17,16 +18,16 @@
|
|
|
|
|
Point ((interval * point), height)|]|] |
|
|
|
|
|
|
|
|
|
let drawGrid spec = |
|
|
|
|
// The originalImg is for images with indexed pixels. |
|
|
|
|
use orignialImg = Bitmap.FromFile spec.originalPath |
|
|
|
|
use img = new Bitmap (orignialImg.Width, orignialImg.Height) |
|
|
|
|
use graphics = Graphics.FromImage img |
|
|
|
|
graphics.DrawImage (orignialImg, 0, 0) |
|
|
|
|
use pen = new Pen (spec.colour, width = spec.penWidth) |
|
|
|
|
let img = Bitmap.FromFile spec.originalPath |
|
|
|
|
let graphics = Graphics.FromImage(img) |
|
|
|
|
let pen = new Pen (spec.colour, width = spec.penWidth) |
|
|
|
|
let horizontalLines = |
|
|
|
|
createHorizontalLines (img.Size.Width) (img.Size.Height) (spec.rows) |
|
|
|
|
let verticalLines = |
|
|
|
|
createVerticalLines (img.Size.Width) (img.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, ImageFormat.Png) |
|
|
|
|
img.Save (spec.savePath) |
|
|
|
|
img.Dispose() |
|
|
|
|
graphics.Dispose() |
|
|
|
|
pen.Dispose() |