Death Socket consists of three projects. They are a .Net Standard 2.0 library, a console program and a Test Centre. The purpose of this repository is to provide a way for people to add grids to images.
https://www.craigoates.net/Software/project/13
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
5.4 KiB
118 lines
5.4 KiB
namespace DeathSocket |
|
|
|
/// The domain types used by Death Socket. |
|
[<AutoOpen>] |
|
module Domain = |
|
|
|
open System.Drawing |
|
open SkiaSharp |
|
open System.Threading |
|
|
|
/// The specification used to note the orignial file's location and the |
|
/// changes the user would like to make to it. (including the save |
|
/// location of the modified version). Use this spec if you are using |
|
/// System.Drawing. |
|
type BrushSpec = |
|
{ /// The original path of the image which the grid is being added to. |
|
originalPath: string |
|
/// The location of the new gridded image. |
|
savePath: string |
|
/// The (System.Drawing) brush used to draw the grid. |
|
/// This determines the colour of the grid. |
|
colour: Brush |
|
/// The thickness of the line on the grid. |
|
penWidth: float32 |
|
/// The number of rows the grid will have. |
|
rows: int |
|
///The number of columns the grid will have. |
|
columns: int } |
|
|
|
/// The specification used to note the orignial file's location and the |
|
/// changes the user would like to make to it (including the save |
|
/// location of the modified version). This specification includes |
|
/// individual RGBA values to describe the grid's colour. Use this spec. |
|
/// if you are using System.Drawing. |
|
type RGBASpec = |
|
{ /// The original path of the image which the grid is being added to. |
|
originalPath: string |
|
/// The location of the new gridded image. |
|
savePath: string |
|
/// The opacity level of the grid. |
|
/// 0 makes it completely see through and 1 makes it solid. |
|
alpha: float |
|
/// The amount of red the grid's line will have. |
|
red: float |
|
/// The amount of green the grid's line will have. |
|
green: float |
|
/// The amount of blue the grid's line will have. |
|
blue: float |
|
/// The thickness of the line on the grid. |
|
penWidth: float32 |
|
/// The number of rows the grid will have. |
|
rows: int |
|
///The number of columns the grid will have. |
|
columns: int } |
|
|
|
/// The specification used to note the orignial file's location and the |
|
/// changes the user would like to make to it (including the save |
|
/// location of the modified version). Use this spec. if you are using |
|
/// the Skia-Sharp library. |
|
type SkiaSpec = |
|
{ /// The original path of the image which the grid is being added to. |
|
originalPath: string |
|
/// The location of the new gridded image. |
|
savePath: string |
|
/// The (SkiaSharp) colour used to draw the grid. |
|
skColour: SKColor |
|
/// The thickness of the line on the grid. |
|
penWidth: float32 |
|
/// The number of rows the grid will have. |
|
rows: int |
|
///The number of columns the grid will have. |
|
columns: int } |
|
|
|
/// The specification used to note the orignial file's location and the |
|
/// changes the user would like to make to it (including the save |
|
/// location of the modified version). This specification includes |
|
/// individual RGB values to describe the grid's colour. Use this spec. |
|
/// if you are using the Skia-Sharp library. |
|
type SkiaRGBSpec = |
|
{ /// The original path of the image which the grid is being added to. |
|
originalPath: string |
|
/// The location of the new gridded image. |
|
savePath: string |
|
/// The amount of red (RGB) the grid's line will have. |
|
/// (0 = no red, 255 = red turned up to eleven). |
|
red: float32 |
|
/// The amount of green (RGB) the grid's line will have. |
|
/// (0 = no green, 255 = green turned up to eleven). |
|
green: float32 |
|
/// The amount of blue (RGB) the grid's line will have. |
|
/// (0 = no blue, 255 = blue turned up to eleven). |
|
blue: float32 |
|
/// The thickness of the line on the grid. |
|
penWidth: float32 |
|
/// The number of rows the grid will have. |
|
rows: int |
|
///The number of columns the grid will have. |
|
columns: int } |
|
|
|
/// A Discriminated Union representing the various specification types |
|
/// Death Socket can use to apply a grid to an image. |
|
type ImageSpec = |
|
| Brush of BrushSpec |
|
| RGBA of RGBASpec |
|
| Skia of SkiaSpec |
|
| SkiaRGB of SkiaRGBSpec |
|
|
|
/// A Discriminated Union representing a type of image. The type refers |
|
/// to the graphics library used to read the image file. |
|
/// The graphics library determines how the image is read and |
|
/// manipulated in memory and the functions you can perform on it. |
|
/// When creating an ImageType, pass in the file path of the image |
|
/// as a string. If you are on Windows or using Mono, SystemDrawing is |
|
/// the recommended choice. If you using Xamarin, SkiaSharp is the |
|
/// recommended choice. |
|
type ImageType = |
|
| SkiaSharp of string |
|
| SystemDrawing of string |