Browse Source

update ScratchPad.

master
Craig Oates 5 years ago
parent
commit
c38c4b4d5d
  1. 4
      DeathSocket/ImagePrep.fs
  2. 24
      DeathSocket/ScratchPad.fsx

4
DeathSocket/ImagePrep.fs

@ -31,6 +31,8 @@
|> determineLineScale lineWidth |> determineLineScale lineWidth
thickness thickness
(* SkiaSharp Functions
======================================================================== *)
let createSKHorizontalLines width height rows = let createSKHorizontalLines width height rows =
let interval = float32 (height / rows) let interval = float32 (height / rows)
[|for point in 1 .. (rows - 1) -> [|for point in 1 .. (rows - 1) ->
@ -49,6 +51,8 @@
use bitmap = SKBitmap.Decode (skStream) use bitmap = SKBitmap.Decode (skStream)
(bitmap.Width, bitmap.Height) (bitmap.Width, bitmap.Height)
(* System.Drawing Functions
======================================================================== *)
let createHorizontalLines width height rows = let createHorizontalLines width height rows =
let interval = height / rows let interval = height / rows
[| for point in 1 .. (rows - 1) -> [| for point in 1 .. (rows - 1) ->

24
DeathSocket/ScratchPad.fsx

@ -6,6 +6,7 @@
#load "Domain.fs" #load "Domain.fs"
#load "ValidationServices.fs" #load "ValidationServices.fs"
#load "ColourServices.fs" #load "ColourServices.fs"
#load "ImagePrep.fs"
#load "ImageServices.fs" #load "ImageServices.fs"
#load "GridPainter.fs" #load "GridPainter.fs"
@ -13,6 +14,7 @@ open System
open System.Drawing open System.Drawing
open SkiaSharp open SkiaSharp
open ValidationServices open ValidationServices
open ImagePrep
open ImageServices open ImageServices
open DeathSocket open DeathSocket
@ -41,33 +43,13 @@ let skVerticalLines = createSKVerticalLines 120 450 22
(* You will need to provide the image and specify its load/save location. (* You will need to provide the image and specify its load/save location.
Death Socket assumes either JPEG or PNG files.*) Death Socket assumes either JPEG or PNG files.*)
// Internal function call. Not accessible outside this project.
let skiaSharpDimensions =
determineSkiaDimensions (desktop + "/test.jpg")
// Internal function call. Not accessible outside this project.
let systemDrawingDimensions =
determineSystemDrawingDimensions (desktop + "/test.jpg")
// Internal function calls. Not accessible outside this project.
let width = double (fst skiaSharpDimensions)
let width2 = double (fst systemDrawingDimensions)
// Internal function calls. Not accessible outside this project.
let height = double (snd skiaSharpDimensions)
let height2 = double (snd systemDrawingDimensions)
// Public function for the internal ones above.
let dimensions = let dimensions =
//SkiaSharp (desktop + "/test.jpg") //SkiaSharp (desktop + "/test.jpg")
SystemDrawing (desktop + "/test.jpg") SystemDrawing (desktop + "/test.jpg")
|> GridPainter.determineImageDimensions |> GridPainter.determineImageDimensions
let width3 = fst dimensions
let height3 = snd dimensions
// Change the line thickness (the last parameter) to whatever you want. // Change the line thickness (the last parameter) to whatever you want.
let scaledPen = GridPainter.scaleLineThickness width height 8.0 let scaledPen = GridPainter.scaleLineThickness (100, 100) dimensions 8.0
// Brush Specification (uses System.Drawing) // Brush Specification (uses System.Drawing)
Brush ({ originalPath = desktop + "/test.jpg" Brush ({ originalPath = desktop + "/test.jpg"

Loading…
Cancel
Save