Browse Source

start add code for skia sharp drawing.

master
Craig Oates 6 years ago
parent
commit
ee713b76c0
  1. 2
      DeathSocket/DeathSocket.fsproj
  2. 12
      DeathSocket/ImageServices.fs
  3. 9
      DeathSocket/ScratchPad.fsx

2
DeathSocket/DeathSocket.fsproj

@ -30,7 +30,7 @@ New functions have been added so you can now create a SolidBrush using individua
<ItemGroup> <ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.60.3" /> <PackageReference Include="SkiaSharp" Version="1.60.3" />
<PackageReference Include="System.Drawing.Common" Version="4.5.0" /> <PackageReference Include="System.Drawing.Common" Version="4.5.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

12
DeathSocket/ImageServices.fs

@ -4,6 +4,7 @@
open System.Drawing.Imaging open System.Drawing.Imaging
open DeathSocket open DeathSocket
open ColourServices open ColourServices
open SkiaSharp
let createHorizontalLines width height rows = let createHorizontalLines width height rows =
let interval = height / rows let interval = height / rows
@ -52,3 +53,14 @@
for line in horizontalLines do graphics.DrawLines (pen, line) for line in horizontalLines do graphics.DrawLines (pen, line)
for line in verticalLines do graphics.DrawLines (pen, line) for line in verticalLines do graphics.DrawLines (pen, line)
clone.Save (spec.savePath) clone.Save (spec.savePath)
// You are up to here. Need to draw lines and add image.
let drawSkiaGrid () =
let imageInfo = new SKImageInfo (500, 500)
use surface = SKSurface.Create(imageInfo)
let canvas = surface.Canvas
canvas.Clear (SKColors.White)
let horizontalLines = createHorizontalLines 500 1000 6
let verticalLines = createVerticalLines 500 1000 9
23

9
DeathSocket/ScratchPad.fsx

@ -41,3 +41,12 @@ let spec: BrushSpec =
// Run this when you have finished building the spec. // Run this when you have finished building the spec.
GridPainter.applyBrushSpecGridAsync spec |> Async.RunSynchronously GridPainter.applyBrushSpecGridAsync spec |> Async.RunSynchronously
//*****************************************************************************
(* Skia Sharp Draft
===============================================================================
The code below here will eventually be worked into the main codebase or thrown
away. It is here acting as a first draft for integrating the Skia Sharp NuGet
package into Death Socket. *)

Loading…
Cancel
Save