|
|
|
@ -15,7 +15,6 @@ namespace DeathSocket
|
|
|
|
|
|
|
|
|
|
open Validation |
|
|
|
|
open ImageServices |
|
|
|
|
open System |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Uses the information included in spec to create a gridded image. |
|
|
|
@ -26,10 +25,6 @@ namespace DeathSocket
|
|
|
|
|
/// 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. |
|
|
|
@ -85,12 +80,22 @@ namespace DeathSocket
|
|
|
|
|
// NOT TESTED |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// Reads an (jpg or png) image and return its width and height as a |
|
|
|
|
/// tuple, (width * hight). |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="imageType"></param> |
|
|
|
|
let determineImageDimensions imageType = |
|
|
|
|
/// <param name="imageType"> |
|
|
|
|
/// The name of the graphics library used to read and determine the |
|
|
|
|
/// images dimensions. |
|
|
|
|
/// </param> |
|
|
|
|
/// <remarks> |
|
|
|
|
/// The image type is determined by the graphics library used. It is |
|
|
|
|
/// called "ImageType" and not "GraphicsLibUsed" because the image/file |
|
|
|
|
/// information is the thing this function cares about most of all. How |
|
|
|
|
/// it is read and what library it uses it secondary. |
|
|
|
|
///</remarks> |
|
|
|
|
let determineImageDimensions (iType: ImageType) = |
|
|
|
|
try |
|
|
|
|
match imageType with |
|
|
|
|
match iType with |
|
|
|
|
| SkiaSharp s -> |
|
|
|
|
validateFilePath s |> ignore |
|
|
|
|
determineSkiaDimensions s |
|
|
|
@ -100,7 +105,7 @@ namespace DeathSocket
|
|
|
|
|
with |
|
|
|
|
| :? FileNotFoundException as ex -> |
|
|
|
|
printfn "%s" ex.Message |
|
|
|
|
(0,0) |
|
|
|
|
reraise () |
|
|
|
|
|
|
|
|
|
// System.Drawing Functions |
|
|
|
|
// ======================================================================== |
|
|
|
@ -151,8 +156,8 @@ namespace DeathSocket
|
|
|
|
|
/// Use this function when targeting .Net/Mono). |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="spec"> |
|
|
|
|
///The specification which the brush is made from. |
|
|
|
|
///</param> |
|
|
|
|
/// The specification which the brush is made from. |
|
|
|
|
/// </param> |
|
|
|
|
/// <remarks> |
|
|
|
|
/// Death Socket uses System.Drawing and not System.Media for colours |
|
|
|
|
/// and brushes. |
|
|
|
|