namespace DeathSocket
open System.IO
open ColourServices
/// Provides functions which help draw gridded overlays onto images.
/// Grid Painter, and all of Death Socket, uses the System.Drawing brushes/colours.
/// If you are using System.Media brushes and colour, you will need to convert them.
module GridPainter =
open Validation
open ImageServices
///
/// Uses the information included in spec and creates a gridded image.
/// It then asynchronously saves it.
/// Please stick to .bmp, .jpg or .png files.
/// The other (image) file types have not been tested.
///
///
/// The specification used to generate the new gridded image
///
///
/// If the file the grid is being applied to cannot be found,
/// a FileNotFoundException will be thrown.
///
///
let applyBrushSpecGridAsync (spec: BrushSpec) =
// The spec is to be changed to Brush Spec.
async {
try
validateFilePath spec.originalPath |> ignore
validatFileType spec.savePath |> ignore
drawBrushSpecGrid spec |> ignore
with
| :? FileNotFoundException as ex ->
printfn "File could not be found at %s" ex.Message
}
// Not tested.
let applyRGBAGridAsync (spec: RGBASpec) =
async {
try
validateFilePath spec.originalPath |> ignore
validatFileType spec.savePath |> ignore
drawRGBAGrid spec
with
| :? FileNotFoundException as ex ->
printfn "File could not be found at %s" ex.Message
}
// let applyCMYKGridAsync -- to be added at a later date.
// not tested.
let makeSolidBrushFromRGBA r g b a = makeBrushFromRGBA r g b a
// not tested or completed.
let makeSolidBrushFromCMYK c m y k =
""
///
/// Determines the (Pen) points needed to draw the appropriate number of horizontal lines (I.E. rows).
/// Each item in the array includes a start and end co-ordinate (point) for each line.
///
/// The width of the image.
/// The height of the image.
/// The number of rows the grid should have.
/// You will probably only need these when dealing with GUI's.
let determineHorizontalLines width height rows =
createHorizontalLines width height rows
///
/// Determines the (Pen) points needed to draw the appropriate number of vertical lines (I.E. columns).
/// Each item in the array includes a start and end co-ordinate (point) for each line.
///
/// The width of the image.
/// The height of the image.
/// The number of columns the grid should have.
/// You will probably only need these when dealing with GUI's.
let determineVerticalLines width height columns =
createVerticalLines width height columns