From 0e8224839c3bb1f2f2e0a74b5762cd7da424ba04 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Thu, 13 Sep 2018 21:06:36 +0100 Subject: [PATCH] change how the horizontal and vertical lines are calculated. --- DeathSocket/ImageServices.fs | 10 +++++----- DeathSocketCLI/Commands.fs | 2 +- DeathSocketCLI/Program.fs | 7 ++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/DeathSocket/ImageServices.fs b/DeathSocket/ImageServices.fs index 373b536..ca5830b 100644 --- a/DeathSocket/ImageServices.fs +++ b/DeathSocket/ImageServices.fs @@ -5,13 +5,13 @@ open DeathSocket let createHorizontalLines width height rows = - let interval = width / rows + let interval = height / rows [| for point in 1 .. (rows - 1) -> [|Point (0, (interval * point)) - Point (height, (interval * point) )|]|] + Point (width, (interval * point) )|]|] - let createVerticalLines height columns = - let interval = height / columns + let createVerticalLines width height columns = + let interval = width / columns [| for point in 1 .. (columns - 1) -> [| Point ((interval * point), 0) Point ((interval * point), height)|]|] @@ -22,7 +22,7 @@ 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) + let verticalLines = createVerticalLines (img.Size.Width) (img.Size.Height) (spec.columns) for line in horizontalLines do graphics.DrawLines (pen, line) for line in verticalLines do graphics.DrawLines (pen, line) img.Save (spec.savePath, ImageFormat.Png) diff --git a/DeathSocketCLI/Commands.fs b/DeathSocketCLI/Commands.fs index f1b6bfd..b37587c 100644 --- a/DeathSocketCLI/Commands.fs +++ b/DeathSocketCLI/Commands.fs @@ -6,7 +6,7 @@ let test () = "Death Socket is working." - let ``paint-grid`` imgPath numRows numColumns pWidth (colour: string) newPath = + let ``add-grid`` imgPath numRows numColumns pWidth (colour: string) newPath = let spec = { originalPath = imgPath savePath = newPath diff --git a/DeathSocketCLI/Program.fs b/DeathSocketCLI/Program.fs index a52984a..8e51171 100644 --- a/DeathSocketCLI/Program.fs +++ b/DeathSocketCLI/Program.fs @@ -1,10 +1,7 @@ -// Learn more about F# at http://fsharp.org -// See the 'F# Tutorial' project for more help. - -open Console.Waterworks +open Console.Waterworks [] let main argv = let liaison = CW_Liaison () liaison.Run ("Commands", true) - 0 // return an integer exit code + 0