Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CanvasState.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using SkiaSharp;
5
7{
11 public class CanvasState
12 {
13 private SKColor fgColor;
14 private SKColor bgColor;
15 private SKPaint pen = null;
16 private SKPaint brush = null;
17 private float width = 1;
18
22 public SKColor FgColor
23 {
24 get => this.fgColor;
25 set
26 {
27 this.fgColor = value;
28
29 this.pen?.Dispose();
30 this.pen = null;
31
32 this.brush?.Dispose();
33 this.brush = null;
34 }
35 }
36
40 public float Width
41 {
42 get => this.width;
43 set
44 {
45 this.width = value;
46
47 this.pen?.Dispose();
48 this.pen = null;
49 }
50 }
51
55 public SKColor BgColor
56 {
57 get => this.bgColor;
58 set => this.bgColor = value;
59 }
60
64 public float X
65 {
66 get;
67 set;
68 }
69
73 public float Y
74 {
75 get;
76 set;
77 }
78
82 public SKPaint Pen
83 {
84 get
85 {
86 if (this.pen is null)
87 {
88 this.pen = new SKPaint()
89 {
90 FilterQuality = SKFilterQuality.High,
91 IsAntialias = true,
92 Style = SKPaintStyle.Stroke,
93 Color = this.fgColor,
94 StrokeWidth = this.width
95 };
96 }
97
98 return this.pen;
99 }
100 }
101
105 public SKPaint Brush
106 {
107 get
108 {
109 if (this.brush is null)
110 {
111 this.brush = new SKPaint()
112 {
113 FilterQuality = SKFilterQuality.High,
114 IsAntialias = true,
115 Style = SKPaintStyle.Fill,
116 Color = this.fgColor
117 };
118 }
119
120 return this.brush;
121 }
122 }
123 }
124}
Current drawing state in a canvas graph.
Definition: CanvasState.cs:12