diff --git a/DeathSocket/GridPainter.fs b/DeathSocket/GridPainter.fs index b971df7..7b86272 100644 --- a/DeathSocket/GridPainter.fs +++ b/DeathSocket/GridPainter.fs @@ -45,7 +45,9 @@ namespace DeathSocket | false -> drawBrushSpecGrid b | RGBA r -> validateIO r.originalPath r.savePath |> ignore - drawRGBAGrid r // greyScale + match makeGreyScale with + | true -> drawRGBAGridGrey r + | false -> drawRGBAGrid r | Skia s -> validateIO s.originalPath s.savePath |> ignore drawSkiaGrid s // greyScale diff --git a/DeathSocket/ImageServices.fs b/DeathSocket/ImageServices.fs index 8ea280b..78c234b 100644 --- a/DeathSocket/ImageServices.fs +++ b/DeathSocket/ImageServices.fs @@ -239,6 +239,23 @@ clone.Save (spec.savePath) let drawRGBAGrid (spec: RGBASpec) = + 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 ((makeBrushFromRGBASpec spec), 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 drawRGBAGridGrey (spec: RGBASpec) = + // THIS NEEDS REFACTORING TO CONVERT IMAGE TO GREYSCALE. use original = Bitmap.FromFile spec.originalPath use temp = new Bitmap (original) use clone = diff --git a/DeathSocketCLI/Commands.fs b/DeathSocketCLI/Commands.fs index 17ebe66..ba02549 100644 --- a/DeathSocketCLI/Commands.fs +++ b/DeathSocketCLI/Commands.fs @@ -55,7 +55,7 @@ [] [] - let ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale= + let ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale = try printfn "[INFO.] Adding grid to image..." Brush (buildSpec imgPath numRows numColumns pWidth colour newPath) @@ -87,10 +87,10 @@ hosted alongside the repository on GitHub. URL: https://github.com/CraigOates/Death-Socket/wiki *) - let ad imgPath newPath = ``add-default`` imgPath newPath + let ad imgPath newPath greyScale = ``add-default`` imgPath newPath greyScale - let ag imgPath numRows numColumns pWidth colour newPath = - ``add-grid`` imgPath numRows numColumns pWidth colour newPath + let ag imgPath numRows numColumns pWidth colour newPath greyScale = + ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale let lc () = ``list-colours`` ()