Browse Source

add function to scale (pen) line thickness.

master
Craig Oates 5 years ago
parent
commit
941577ec80
  1. 31
      DeathSocket/GridPainter.fs

31
DeathSocket/GridPainter.fs

@ -15,7 +15,6 @@ namespace DeathSocket
open Validation
open ImageServices
open System
/// <summary>
/// Uses the information included in spec to create a gridded image.
@ -30,7 +29,7 @@ namespace DeathSocket
/// 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,
/// is not in use or needed by another program/process.
/// This is because it is locked whilst in this function.
@ -54,7 +53,33 @@ namespace DeathSocket
with
| :? FileNotFoundException as ex ->
printfn "File could not be found at %s" ex.Message
}
}
// NOT TESTED
/// <summary>
/// Takes an image and determines the current scale it is viewed at
/// (E.G. scaled preview in image viewer). The (pen) line thickness is
/// then updated to match this preview scale and can be used when
/// drawing a grid line on the scaled preview of the image.
/// </summary>
/// <param name="previewWidth">
/// The width of the image when previewed (I.E. in a GUI).
/// </param>
/// <param name="actualWidth">
/// The width of the actual image.
/// </param>
/// <param name="lineThickness">
/// The thickness of the pen used to draw the grid line.
/// </param>
/// <remarks>
/// You should find you only need this function when dealing with
/// previewing an image in a GUI. Another thing to note is the
/// SkiaSharp based functions already scale the grid lines for you. So,
/// you should not need to use this function when using them.
/// </remarks>
let scaleLineThickness (previewWidth: double) (actualWidth: double) (lineThickness: double) =
lineThickness / (previewWidth / actualWidth)
// System.Drawing Functions
// ========================================================================

Loading…
Cancel
Save