|
|
|
@ -6,14 +6,12 @@
|
|
|
|
|
open Validation |
|
|
|
|
open ColourServices |
|
|
|
|
|
|
|
|
|
// To Be moved to its own service and made public. No wrapper needed. |
|
|
|
|
let createHorizontalLines width height rows = |
|
|
|
|
let interval = height / rows |
|
|
|
|
[| for point in 1 .. (rows - 1) -> |
|
|
|
|
[|Point (0, (interval * point)) |
|
|
|
|
Point (width, (interval * point) )|]|] |
|
|
|
|
|
|
|
|
|
// To Be moved to its own service and made public. No wrapper needed. |
|
|
|
|
let createVerticalLines width height columns = |
|
|
|
|
let interval = width / columns |
|
|
|
|
[| for point in 1 .. (columns - 1) -> |
|
|
|
@ -21,21 +19,21 @@
|
|
|
|
|
Point ((interval * point), height)|]|] |
|
|
|
|
|
|
|
|
|
// To be deleted -- replaced with brush spec. |
|
|
|
|
let drawGrid (spec: ImageSpec) = |
|
|
|
|
// The temp. file is used as a way to convert images with indexed 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 (clone.Size.Width) (clone.Size.Height) (spec.rows) |
|
|
|
|
let verticalLines = |
|
|
|
|
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) |
|
|
|
|
clone.Save (spec.savePath) |
|
|
|
|
//let drawGrid (spec: BrushSpec) = |
|
|
|
|
// // The temp. file is used as a way to convert images with indexed 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 (clone.Size.Width) (clone.Size.Height) (spec.rows) |
|
|
|
|
// let verticalLines = |
|
|
|
|
// 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) |
|
|
|
|
// clone.Save (spec.savePath) |
|
|
|
|
|
|
|
|
|
// not tested but same as Draw Grid -- this is its replacement |
|
|
|
|
let drawBrushSpecGrid (spec: BrushSpec) = |
|
|
|
|