diff --git a/DeathSocket/Domain.fs b/DeathSocket/Domain.fs
index c9d1b72..f6f7a4a 100644
--- a/DeathSocket/Domain.fs
+++ b/DeathSocket/Domain.fs
@@ -5,10 +5,12 @@
module Domain =
open System.Drawing
+ open System
///
/// The specification used by Death Socket when adding a grid to an image.
///
+ []
type ImageSpec =
{ /// The original path of the image which the grid is being added to.
originalPath: string
diff --git a/DeathSocket/GridPainter.fs b/DeathSocket/GridPainter.fs
index cc0342d..f540b30 100644
--- a/DeathSocket/GridPainter.fs
+++ b/DeathSocket/GridPainter.fs
@@ -14,7 +14,7 @@ namespace DeathSocket
/// Uses the information included in spec and creates a gridded image.
/// It then asynchronously saves it.
/// Please stick to .bmp, .jpg or .png files.
- /// The others (image) file types have not been tested.
+ /// The other (image) file types have not been tested.
///
///
/// The specification used to generate the new gridded image
@@ -28,13 +28,13 @@ namespace DeathSocket
/// is not in use or needed by another program/process.
/// This is because it is locked whilst in this function.
///
- let applyGridAsync (spec: ImageSpec) =
+ let applyBrushSpecGridAsync (spec: BrushSpec) =
// The spec is to be changed to Brush Spec.
async {
try
validateFilePath spec.originalPath |> ignore
validatFileType spec.savePath |> ignore
- drawGrid spec |> ignore
+ drawBrushSpecGrid spec |> ignore
with
| :? FileNotFoundException as ex ->
printfn "File could not be found at %s" ex.Message
@@ -63,7 +63,6 @@ namespace DeathSocket
/// The number of rows the grid should have.
/// You will probably only need these when dealing with GUI's.
let determineHorizontalLines width height rows =
- // To Be moved to its own service and made public. No wrapper needed.
createHorizontalLines width height rows
///
@@ -75,5 +74,4 @@ namespace DeathSocket
/// The number of columns the grid should have.
/// You will probably only need these when dealing with GUI's.
let determineVerticalLines width height columns =
- // To Be moved to its own service and made public. No wrapper needed.
createVerticalLines width height columns
\ No newline at end of file
diff --git a/DeathSocket/ImageServices.fs b/DeathSocket/ImageServices.fs
index 1152496..521e5ce 100644
--- a/DeathSocket/ImageServices.fs
+++ b/DeathSocket/ImageServices.fs
@@ -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) =
diff --git a/DeathSocketCLI/Commands.fs b/DeathSocketCLI/Commands.fs
index 53fbc9c..f70ddad 100644
--- a/DeathSocketCLI/Commands.fs
+++ b/DeathSocketCLI/Commands.fs
@@ -38,7 +38,7 @@
try
printfn "[INFO.] Adding default grid to image..."
buildDefaultSpec imgPath newPath
- |> applyGridAsync
+ |> applyBrushSpecGridAsync
|> Async.Start
showEndOfCommandMessage
with
@@ -57,7 +57,7 @@
try
printfn "[INFO.] Adding grid to image..."
buildSpec imgPath numRows numColumns pWidth colour newPath
- |> applyGridAsync
+ |> applyBrushSpecGridAsync
|> Async.Start
showEndOfCommandMessage
with
diff --git a/TestCentre/LibraryTests.fs b/TestCentre/LibraryTests.fs
index 2810f14..5075547 100644
--- a/TestCentre/LibraryTests.fs
+++ b/TestCentre/LibraryTests.fs
@@ -86,14 +86,14 @@
resetSavingTestArea ()
let oPath = generateLoadPath ()
let sPath = generateSavePath oPath
- let (spec: ImageSpec) =
+ let (spec: BrushSpec) =
{ originalPath = oPath
savePath = sPath
colour = randomBrush () :?> Brush
penWidth = float32 1
rows = 10
columns = 10 }
- applyGridAsync spec
+ applyBrushSpecGridAsync spec
|> Async.RunSynchronously
(File.Exists sPath) = true