Browse Source
Include a 1000x1000 image (for testing) and cratch pad scripts for the horizontal and vertical points code, in library.master
Craig Oates
6 years ago
5 changed files with 48 additions and 6 deletions
After Width: | Height: | Size: 6.0 KiB |
@ -0,0 +1,27 @@
|
||||
module internal ImageServices |
||||
|
||||
open System.Drawing |
||||
open DeathSocket.Domain |
||||
|
||||
let createHorizontalLines width height columns = |
||||
let interval = width / columns |
||||
[| for point in 1 .. columns -> |
||||
[|Point (0, (interval * point)) |
||||
Point (height, (interval * point) )|]|] |
||||
|
||||
let createVerticalLines width height columns = |
||||
let interval = height / columns |
||||
[| for point in 1 .. columns -> |
||||
[| Point ((interval * point), 0) |
||||
Point ((interval * point), height)|]|] |
||||
|
||||
let drawGrid spec = |
||||
let img = Bitmap.FromFile spec.filePath |
||||
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.Width) (img.Size.Height) (spec.columns) |
||||
0 |
||||
|
Loading…
Reference in new issue