Browse Source

add XML comments and minor refactoring to GridPainter.

master
Craig Oates 5 years ago
parent
commit
6ef653714c
  1. 2
      DeathSocket/Domain.fs
  2. 29
      DeathSocket/GridPainter.fs

2
DeathSocket/Domain.fs

@ -106,7 +106,7 @@
| SkiaRGB of SkiaRGBSpec | SkiaRGB of SkiaRGBSpec
/// Discriminated Union representing the graphics libraries used by /// Discriminated Union representing the graphics libraries used by
/// Desth Socket. Useful for selecting which one you want to use. /// Death Socket. Useful for selecting which one you want to use.
/// System.Drawing for using Windows/Mono and SkiaSharp for Xamarin. /// System.Drawing for using Windows/Mono and SkiaSharp for Xamarin.
type ImageType = type ImageType =
| SkiaSharp of string | SkiaSharp of string

29
DeathSocket/GridPainter.fs

@ -15,7 +15,6 @@ namespace DeathSocket
open Validation open Validation
open ImageServices open ImageServices
open System
/// <summary> /// <summary>
/// Uses the information included in spec to create a gridded image. /// 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, /// ImageSpec is a discriminated union, consisting of a Brush, RGBA,
/// Skia or SkiaRGB spec. /// Skia or SkiaRGB spec.
/// </param> /// </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> /// <remarks>
/// Make sure the image, which is having the overlay added to it, /// Make sure the image, which is having the overlay added to it,
/// is not in use or needed by another program/process. /// is not in use or needed by another program/process.
@ -85,12 +80,22 @@ namespace DeathSocket
// NOT TESTED // NOT TESTED
/// <summary> /// <summary>
/// /// Reads an (jpg or png) image and return its width and height as a
/// tuple, (width * hight).
/// </summary> /// </summary>
/// <param name="imageType"></param> /// <param name="imageType">
let determineImageDimensions 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 try
match imageType with match iType with
| SkiaSharp s -> | SkiaSharp s ->
validateFilePath s |> ignore validateFilePath s |> ignore
determineSkiaDimensions s determineSkiaDimensions s
@ -100,7 +105,7 @@ namespace DeathSocket
with with
| :? FileNotFoundException as ex -> | :? FileNotFoundException as ex ->
printfn "%s" ex.Message printfn "%s" ex.Message
(0,0) reraise ()
// System.Drawing Functions // System.Drawing Functions
// ======================================================================== // ========================================================================
@ -151,8 +156,8 @@ namespace DeathSocket
/// Use this function when targeting .Net/Mono). /// Use this function when targeting .Net/Mono).
/// </summary> /// </summary>
/// <param name="spec"> /// <param name="spec">
///The specification which the brush is made from. /// The specification which the brush is made from.
///</param> /// </param>
/// <remarks> /// <remarks>
/// Death Socket uses System.Drawing and not System.Media for colours /// Death Socket uses System.Drawing and not System.Media for colours
/// and brushes. /// and brushes.

Loading…
Cancel
Save