// These paths need adjusting to match your computer. #r @"C:/Users/craig/.nuget/packages/skiasharp/1.60.3/lib/netstandard1.3/SkiaSharp.dll" // Currently not working... //#r @"C:/Users/craig/.nuget/packages/skiasharp/1.60.3/runtimes/win-x64/native/libSkiaSharp.dll" #load "Domain.fs" #load "ValidationServices.fs" #load "ColourServices.fs" #load "ImagePrep.fs" #load "ImageServices.fs" #load "GridPainter.fs" open System open System.Drawing open SkiaSharp open ValidationServices open ImagePrep open ImageServices open DeathSocket (* Death Socket Scripts =============================================================================== The code in here can be use to create a gridded image without running the CLI. You can, also, run checks to see what Death Socket is doing when creating a new image. *) let desktop = Environment.GetFolderPath (Environment.SpecialFolder.Desktop) (* You will need to provide the image at the location specified. Both throw an exception if the file cannot be found or is the wrong extension. Death Socket only works with JPG and PNG.*) let IOTest = validateFilePath (desktop + "/test.jpg") let extentionTest = validateSaveFileType (desktop + "/test.jpg") (* These are not needed by you to create an image. They here for you to check the start and end points of each pen stroke/path. *) let horizontalLines = createHorizontalLines 1000 500 10 let verticalLines = createVerticalLines 300 600 10 let skHorizontalLines = createSKHorizontalLines 550 520 10 let skVerticalLines = createSKVerticalLines 120 450 22 (* You will need to provide the image and specify its load/save location. Death Socket assumes either JPEG or PNG files.*) let dimensions = //SkiaSharp (desktop + "/test.jpg") SystemDrawing (desktop + "/test.jpg") |> GridPainter.determineImageDimensions // Change the line thickness (the last parameter) to whatever you want. let scaledPen = GridPainter.scaleLineThickness (100, 100) dimensions 8.0 // Brush Specification (uses System.Drawing) Brush ({ originalPath = desktop + "/test.jpg" savePath = desktop + "/grid.png" colour = Brushes.Chartreuse penWidth = (float32 1) rows = 10 columns = 10 }) |> GridPainter.applyGridToImageAsync |> Async.Start // RGBA Specification (uses System.Drawing) RGBA ({ originalPath = desktop + "/test.jpg" savePath = desktop + "/grid.png" alpha = float 1 red = float 122 green = float 222 blue = float 100 penWidth = (float32 1) rows = 10 columns = 10 }) |> GridPainter.applyGridToImageAsync |> Async.Start // Skia Specification (uses SkiaSharp -- use with Xamarin) Skia ({ originalPath = desktop + "/test.jpg" savePath = desktop + "/grid.png" skColour = SKColors.BlueViolet penWidth = (float32 1) rows = 10 columns = 10}) |> GridPainter.applyGridToImageAsync |> Async.Start // SkiaRGB Specification (uses SkiaSharp -- use with Xamarin) SkiaRGB ({ originalPath = desktop + "/test.jpg" savePath = desktop + "/grid.png" red = (float32 102) green = (float32 124) blue = (float32 224) penWidth = (float32 1) rows = 10 columns = 10}) |> GridPainter.applyGridToImageAsync |> Async.Start