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;
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 IsAntialias = true,
91 Style = SKPaintStyle.Stroke,
92 Color = this.fgColor,
93 StrokeWidth = this.width
94 };
95 }
96
97 return this.pen;
98 }
99 }
100
104 public SKPaint Brush
105 {
106 get
107 {
108 if (this.brush is null)
109 {
110 this.brush = new SKPaint()
111 {
112 IsAntialias = true,
113 Style = SKPaintStyle.Fill,
114 Color = this.fgColor
115 };
116 }
117
118 return this.brush;
119 }
120 }
121 }
122}
Current drawing state in a canvas graph.
Definition: CanvasState.cs:12