Browse Source

add function to create SKColor using int's.

master
Craig Oates 5 years ago
parent
commit
9ddf04964f
  1. 7
      DeathSocket/ColourServices.fs
  2. 3
      DeathSocket/ImageServices.fs

7
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])

3
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 ()

Loading…
Cancel
Save