Browse Source

change how the horizontal and vertical lines are calculated.

master
Craig Oates 6 years ago
parent
commit
0e8224839c
  1. 10
      DeathSocket/ImageServices.fs
  2. 2
      DeathSocketCLI/Commands.fs
  3. 7
      DeathSocketCLI/Program.fs

10
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)

2
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

7
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
[<EntryPoint>]
let main argv =
let liaison = CW_Liaison ()
liaison.Run ("Commands", true)
0 // return an integer exit code
0

Loading…
Cancel
Save