From 9ddf04964f9741e37e4858a1c839fb9a06cb818c Mon Sep 17 00:00:00 2001 From: "OPTIMUS-PRIME\\craig" Date: Sun, 2 Dec 2018 21:48:06 +0000 Subject: [PATCH] add function to create SKColor using int's. --- DeathSocket/ColourServices.fs | 7 +++++++ DeathSocket/ImageServices.fs | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DeathSocket/ColourServices.fs b/DeathSocket/ColourServices.fs index fb7d29b..1fec9e9 100644 --- a/DeathSocket/ColourServices.fs +++ b/DeathSocket/ColourServices.fs @@ -2,6 +2,8 @@ open System.Drawing open DeathSocket.Domain + open System + open SkiaSharp let makeBrushFromRGBASpec (spec: RGBASpec) = let a = int spec.alpha @@ -15,3 +17,8 @@ let colour = Color.FromArgb (a, r, g, b) new SolidBrush (colour) + let makeSkiaColour r g b = + let red = BitConverter.GetBytes (int r) + let green = BitConverter.GetBytes (int g) + let blue = BitConverter.GetBytes (int b) + new SKColor (red.[0], green.[0], blue.[0]) \ No newline at end of file diff --git a/DeathSocket/ImageServices.fs b/DeathSocket/ImageServices.fs index 8c0c490..190b796 100644 --- a/DeathSocket/ImageServices.fs +++ b/DeathSocket/ImageServices.fs @@ -67,7 +67,8 @@ use stroke = new SKPaint () stroke.Style <- SKPaintStyle.Stroke stroke.StrokeWidth <- float32 3 - stroke.Color <- SKColors.BlueViolet + //stroke.Color <- SKColors.BlueViolet + stroke.Color <- makeSkiaColour 123 123 123 // Note about generating colours in Skia Sharp. //stroke.Color <- new SKColor (byte 1000, byte 5111, byte 4225, byte 255) use imageFill = new SKPaint ()