Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
RenderSettings.cs
1using System;
2using SkiaSharp;
3
5{
9 public enum RenderedImageSize
10 {
14 ScaleToFit,
15
19 ResizeImage
20 }
21
25 public class RenderSettings
26 {
27 private RenderedImageSize imageSize = RenderedImageSize.ResizeImage;
28 private int width = 800;
29 private int height = 600;
30 private float zoom = 1;
31 private float offsetX = 0;
32 private float offsetY = 0;
33 private SKColor backgroundColor = SKColors.White;
34 private SKColor penColor = SKColors.Black;
35 private SKColor textColor = SKColors.Black;
36 private string fontName = "Segoe UI";
37 private float fontSize = 12;
38 private float pixelsPerInch = 96;
39
44 {
45 }
46
51 {
52 get => this.imageSize;
53 set => this.imageSize = value;
54 }
55
59 public int Width
60 {
61 get => this.width;
62 set
63 {
64 if (value <= 0)
65 throw new ArgumentException("Invalid width.", nameof(this.Width));
66
67 this.width = value;
68 }
69 }
70
74 public int Height
75 {
76 get => this.height;
77 set
78 {
79 if (value <= 0)
80 throw new ArgumentException("Invalid height.", nameof(this.Height));
81
82 this.height = value;
83 }
84 }
85
89 public float Zoom
90 {
91 get => this.zoom;
92 set
93 {
94 if (value <= 0)
95 throw new ArgumentException("Invalid zoom factor.", nameof(this.Zoom));
96
97 this.zoom = value;
98 }
99 }
100
104 public float OffsetX
105 {
106 get => this.offsetX;
107 set => this.offsetX = value;
108 }
109
113 public float OffsetY
114 {
115 get => this.offsetY;
116 set => this.offsetY = value;
117 }
118
122 public SKColor BackgroundColor
123 {
124 get => this.backgroundColor;
125 set => this.backgroundColor = value;
126 }
127
131 public SKColor PenColor
132 {
133 get => this.penColor;
134 set => this.penColor = value;
135 }
136
140 public SKColor TextColor
141 {
142 get => this.textColor;
143 set => this.textColor = value;
144 }
145
149 public string FontName
150 {
151 get => this.fontName;
152 set
153 {
154 if (string.IsNullOrEmpty(value))
155 throw new ArgumentException("Invalid font name.", nameof(this.FontName));
156
157 this.fontName = value;
158 }
159 }
160
164 public float FontSize
165 {
166 get => this.fontSize;
167 set
168 {
169 if (value <= 0)
170 throw new ArgumentException("Invalid font size.", nameof(this.FontSize));
171
172 this.fontSize = value;
173 }
174 }
175
179 public float PixelsPerInch
180 {
181 get => this.pixelsPerInch;
182 set
183 {
184 if (value <= 0)
185 throw new ArgumentException("Invalid number of pixels per inch.", nameof(this.PixelsPerInch));
186
187 this.pixelsPerInch = value;
188 }
189 }
190
191 }
192}
RenderSettings()
Determines the size of the rendered image.
float PixelsPerInch
Pixels per inch (default=96 pixels/inch)
float FontSize
Font size, in points
SKColor BackgroundColor
Background color
float OffsetY
Offset along Y-axis.
RenderedImageSize ImageSize
Offset along X-axis.
float OffsetX
Offset along X-axis.
RenderedImageSize
Affects the size of the rendered image.