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.
|
|
|
namespace SmoulderingBeachBall
|
|
|
|
|
|
|
|
/// Provides the public facing functions of Smouldering Beach Ball.
|
|
|
|
module Services =
|
|
|
|
|
|
|
|
open System
|
|
|
|
open SmoulderingBeachBall.Domain.DomainTypes
|
|
|
|
open InternalServices.Validation
|
|
|
|
open InternalServices.Drawing
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates an image using the specification provided by the ImageSpec.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="spec">
|
|
|
|
/// The image specification which describes how the image should look.
|
|
|
|
/// </param>
|
|
|
|
let makeImage (spec: ImageSpec) =
|
|
|
|
async {
|
|
|
|
try
|
|
|
|
printfn "[INFO.] Attempting to make image..."
|
|
|
|
validateDimension spec.width
|
|
|
|
validateDimension spec.height
|
|
|
|
validateDirectory spec.filePath
|
|
|
|
drawImage spec
|
|
|
|
printfn "[SUCCESS] Image creation attempt complete."
|
|
|
|
return ()
|
|
|
|
with
|
|
|
|
| :? ArgumentException as ex -> printfn "%s" ex.Message
|
|
|
|
| _ as ex -> printfn "%s" ex.Message
|
|
|
|
}
|