Browse Source

stub-out drawRGBAGridGrey functionality.

So far, the drawRGBAGridGrey is a copy of is full colour counterpart. This function will need updating to reflect the intended functionality.
unstable
Craig Oates 4 years ago
parent
commit
3abf3d3cd7
  1. 4
      DeathSocket/GridPainter.fs
  2. 17
      DeathSocket/ImageServices.fs
  3. 8
      DeathSocketCLI/Commands.fs

4
DeathSocket/GridPainter.fs

@ -45,7 +45,9 @@ namespace DeathSocket
| false -> drawBrushSpecGrid b | false -> drawBrushSpecGrid b
| RGBA r -> | RGBA r ->
validateIO r.originalPath r.savePath |> ignore validateIO r.originalPath r.savePath |> ignore
drawRGBAGrid r // greyScale match makeGreyScale with
| true -> drawRGBAGridGrey r
| false -> drawRGBAGrid r
| Skia s -> | Skia s ->
validateIO s.originalPath s.savePath |> ignore validateIO s.originalPath s.savePath |> ignore
drawSkiaGrid s // greyScale drawSkiaGrid s // greyScale

17
DeathSocket/ImageServices.fs

@ -253,3 +253,20 @@
for line in horizontalLines do graphics.DrawLines (pen, line) for line in horizontalLines do graphics.DrawLines (pen, line)
for line in verticalLines do graphics.DrawLines (pen, line) for line in verticalLines do graphics.DrawLines (pen, line)
clone.Save (spec.savePath) 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 =
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)

8
DeathSocketCLI/Commands.fs

@ -55,7 +55,7 @@
[<Description "Adds a grid to an image, using the specified parameters, and saves it.">] [<Description "Adds a grid to an image, using the specified parameters, and saves it.">]
[<Usage [<Usage
"add-grid C:/orignal-image.png 10 5 2 red C:/new-image.png">] "add-grid C:/orignal-image.png 10 5 2 red C:/new-image.png">]
let ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale= let ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale =
try try
printfn "[INFO.] Adding grid to image..." printfn "[INFO.] Adding grid to image..."
Brush (buildSpec imgPath numRows numColumns pWidth colour newPath) Brush (buildSpec imgPath numRows numColumns pWidth colour newPath)
@ -87,10 +87,10 @@
hosted alongside the repository on GitHub. hosted alongside the repository on GitHub.
URL: https://github.com/CraigOates/Death-Socket/wiki *) 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 = let ag imgPath numRows numColumns pWidth colour newPath greyScale =
``add-grid`` imgPath numRows numColumns pWidth colour newPath ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale
let lc () = ``list-colours`` () let lc () = ``list-colours`` ()

Loading…
Cancel
Save