Browse Source

remove save to stream code in library.

Fix grammar error in validation.
master
Craig Oates 6 years ago
parent
commit
ed77e0c118
  1. 17
      DeathSocket/ImageServices.fs
  2. 2
      DeathSocket/ScratchPad.fsx
  3. 2
      DeathSocket/Validation.fs

17
DeathSocket/ImageServices.fs

@ -3,7 +3,6 @@
open System.Drawing
open System.Drawing.Imaging
open DeathSocket
open System.IO
let createHorizontalLines width height rows =
let interval = width / rows
@ -29,18 +28,4 @@
img.Save (spec.savePath, ImageFormat.Png)
img.Dispose ()
graphics.Dispose ()
pen.Dispose ()
let drawGridToStream (imgStream: Stream) spec =
let img = Bitmap.FromFile (spec.imagePath)
let graphics = Graphics.FromImage img
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)
for line in horizontalLines do graphics.DrawLines (pen, line)
for line in verticalLines do graphics.DrawLines (pen, line)
graphics.Dispose ()
pen.Dispose ()
img.Save (imgStream, spec.format)
img.Dispose ()
pen.Dispose ()

2
DeathSocket/ScratchPad.fsx

@ -8,6 +8,8 @@ open System
open DeathSocket
open Validation
open ImageServices
open System.Drawing.Imaging
open System.IO
// INITIAL IDEA ===============================================================

2
DeathSocket/Validation.fs

@ -5,5 +5,5 @@ open System.IO
let validateFilePath path =
match File.Exists path with
| true -> ()
| false -> raise (new FileNotFoundException (path + "could not be found."))
| false -> raise (new FileNotFoundException (path + " could not be found."))

Loading…
Cancel
Save