|
|
@ -15,6 +15,46 @@ namespace DeathSocket |
|
|
|
|
|
|
|
|
|
|
|
open Validation |
|
|
|
open Validation |
|
|
|
open ImageServices |
|
|
|
open ImageServices |
|
|
|
|
|
|
|
open System |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Uses the information included in spec to create a gridded image. |
|
|
|
|
|
|
|
/// It then asynchronously saves it. Uses .jpg or .png formats only. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="spec"> |
|
|
|
|
|
|
|
/// The specification used to generate the new gridded image. The |
|
|
|
|
|
|
|
/// ImageSpec is a discriminated union, consisting of a Brush, RGBA, |
|
|
|
|
|
|
|
/// Skia or SkiaRGB spec. |
|
|
|
|
|
|
|
/// </param> |
|
|
|
|
|
|
|
/// <exeption cref="System.IO.FileNotFoundException"> |
|
|
|
|
|
|
|
/// If the file the grid is being applied to cannot be found, |
|
|
|
|
|
|
|
/// a FileNotFoundException will be thrown. |
|
|
|
|
|
|
|
/// </exception> |
|
|
|
|
|
|
|
/// <remarks |
|
|
|
|
|
|
|
/// Make sure the image, which is having the overlay added to it, |
|
|
|
|
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
|
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
|
|
|
|
/// </remarks> |
|
|
|
|
|
|
|
let applyGridToImageAsync (spec: ImageSpec) = |
|
|
|
|
|
|
|
async { |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
match spec with |
|
|
|
|
|
|
|
| Brush b -> |
|
|
|
|
|
|
|
validateIO b.originalPath b.savePath |> ignore |
|
|
|
|
|
|
|
drawBrushSpecGrid b |
|
|
|
|
|
|
|
| RGBA r -> |
|
|
|
|
|
|
|
validateIO r.originalPath r.savePath |> ignore |
|
|
|
|
|
|
|
drawRGBAGrid r |
|
|
|
|
|
|
|
| Skia s -> |
|
|
|
|
|
|
|
validateIO s.originalPath s.savePath |> ignore |
|
|
|
|
|
|
|
drawSkiaGrid s |
|
|
|
|
|
|
|
| SkiaRGB sR -> |
|
|
|
|
|
|
|
validateIO sR.originalPath sR.savePath |> ignore |
|
|
|
|
|
|
|
drawSkiaRGBGrid sR |
|
|
|
|
|
|
|
with |
|
|
|
|
|
|
|
| :? FileNotFoundException as ex -> |
|
|
|
|
|
|
|
printfn "File could not be found at %s" ex.Message |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// System.Drawing Functions |
|
|
|
// System.Drawing Functions |
|
|
|
// ======================================================================== |
|
|
|
// ======================================================================== |
|
|
@ -62,6 +102,7 @@ namespace DeathSocket |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// </remarks> |
|
|
|
/// </remarks> |
|
|
|
|
|
|
|
[<Obsolete("Method is deprecated, use applyGridToImage instead.")>] |
|
|
|
let applyBrushSpecGridAsync (spec: BrushSpec) = |
|
|
|
let applyBrushSpecGridAsync (spec: BrushSpec) = |
|
|
|
async { |
|
|
|
async { |
|
|
|
try |
|
|
|
try |
|
|
@ -90,6 +131,7 @@ namespace DeathSocket |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// </remarks> |
|
|
|
/// </remarks> |
|
|
|
|
|
|
|
[<Obsolete("Method is deprecated, use applyGridToImage instead.")>] |
|
|
|
let applyRGBAGridAsync (spec: RGBASpec) = |
|
|
|
let applyRGBAGridAsync (spec: RGBASpec) = |
|
|
|
async { |
|
|
|
async { |
|
|
|
try |
|
|
|
try |
|
|
@ -162,7 +204,6 @@ namespace DeathSocket |
|
|
|
let determineSKVerticalLines (width: int) (height: int) (columns: int) = |
|
|
|
let determineSKVerticalLines (width: int) (height: int) (columns: int) = |
|
|
|
createSKVerticalLines width height columns |
|
|
|
createSKVerticalLines width height columns |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Uses the information included in spec to create a gridded image. |
|
|
|
/// Uses the information included in spec to create a gridded image. |
|
|
|
/// It then asynchronously saves it. Uses .jpg or .png formats only. |
|
|
|
/// It then asynchronously saves it. Uses .jpg or .png formats only. |
|
|
@ -178,6 +219,7 @@ namespace DeathSocket |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// </remarks> |
|
|
|
/// </remarks> |
|
|
|
|
|
|
|
[<Obsolete("Method is deprecated, use applyGridToImage instead.")>] |
|
|
|
let applySkiaGridAsync (spec: SkiaSpec) = |
|
|
|
let applySkiaGridAsync (spec: SkiaSpec) = |
|
|
|
async { |
|
|
|
async { |
|
|
|
try |
|
|
|
try |
|
|
@ -204,6 +246,7 @@ namespace DeathSocket |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// is not in use or needed by another program/process. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// This is because it is locked whilst in this function. |
|
|
|
/// </remarks> |
|
|
|
/// </remarks> |
|
|
|
|
|
|
|
[<Obsolete("Method is deprecated, use applyGridToImage instead.")>] |
|
|
|
let applySkiaRGBGridAsync (spec: SkiaRGBSpec) = |
|
|
|
let applySkiaRGBGridAsync (spec: SkiaRGBSpec) = |
|
|
|
async { |
|
|
|
async { |
|
|
|
try |
|
|
|
try |
|
|
|