|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
open System.Drawing |
|
|
|
|
open System.Drawing.Imaging |
|
|
|
|
open DeathSocket |
|
|
|
|
open System.IO |
|
|
|
|
|
|
|
|
|
let createHorizontalLines width height rows = |
|
|
|
|
let interval = width / rows |
|
|
|
@ -29,4 +30,17 @@
|
|
|
|
|
img.Dispose () |
|
|
|
|
graphics.Dispose () |
|
|
|
|
pen.Dispose () |
|
|
|
|
() |
|
|
|
|
|
|
|
|
|
let drawGridToStream (imgStream: Stream) spec = |
|
|
|
|
let img = Bitmap.FromFile (spec.imagePath) |
|
|
|
|
let graphics = Graphics.FromImage img |
|
|
|
|
let pen = new Pen (spec.colour, width = spec.penWidth) |
|
|
|
|
let horizontalLines = |
|
|
|
|
createHorizontalLines (img.Size.Width) (img.Size.Height) (spec.columns) |
|
|
|
|
let verticalLines = createVerticalLines (img.Size.Height) (spec.columns) |
|
|
|
|
for line in horizontalLines do graphics.DrawLines (pen, line) |
|
|
|
|
for line in verticalLines do graphics.DrawLines (pen, line) |
|
|
|
|
graphics.Dispose () |
|
|
|
|
pen.Dispose () |
|
|
|
|
img.Save (imgStream, spec.format) |
|
|
|
|
img.Dispose () |