IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
DrawingOptions.cs
Go to the documentation of this file.
2
11public class DrawingOptions
12{
18 {
19 }
20
33 public DrawingOptions(Color color, Opacity opacity)
34 {
35 Color = color;
36 Opacity = opacity;
37 }
38
44 public Color Color { get; set; } = new(ColorConstant.Red);
45
51 public Opacity Opacity { get; set; } = new(100);
52
57 public static IEqualityComparer<DrawingOptions> Comparer { get; } = new DrawingOptionsEqualityComparer();
58
66 public override string ToString()
67 {
68 return $"Color: ({Color}), Opacity: {Opacity}";
69 }
70
79 internal Backend.Types.peak_icv_drawing_options ToCType()
80 {
81 return new Backend.Types.peak_icv_drawing_options
82 {
83 color = Color.ColorCode,
84 opacity = Opacity.Value
85 };
86 }
87
88 private sealed class DrawingOptionsEqualityComparer : IEqualityComparer<DrawingOptions>
89 {
90 public bool Equals(DrawingOptions x, DrawingOptions y)
91 {
92 if (ReferenceEquals(x, y))
93 {
94 return true;
95 }
96
97 if (ReferenceEquals(x, null))
98 {
99 return false;
100 }
101
102 if (ReferenceEquals(y, null))
103 {
104 return false;
105 }
106
107 return Color.Comparer.Equals(x.Color, y.Color) && Opacity.Comparer.Equals(x.Opacity, y.Opacity);
108 }
109
110 public int GetHashCode(DrawingOptions obj)
111 {
112 return (Color.Comparer.GetHashCode(obj.Color), Opacity.Comparer.GetHashCode(obj.Opacity)).GetHashCode();
113 }
114 }
115}
Class holding color codes.
Definition Color.cs:9
ulong ColorCode
The color code.
Definition Color.cs:105
static IEqualityComparer< Color > Comparer
A default equality comparer for comparing Color data values.
Definition Color.cs:138
Represents the drawing options used by the Painter for rendering.
DrawingOptions(Color color, Opacity opacity)
Constructs DrawingOptions with specified values for color and opacity .
DrawingOptions()
Constructs DrawingOptions with default values.
Color Color
Color used for drawing. Defaults to ColorConstant.Red.
static IEqualityComparer< DrawingOptions > Comparer
Default equality comparer for comparing DrawingOptions data values.
Opacity Opacity
The opacity level used for drawing. Defaults to 100 (fully opaque).
override string ToString()
Returns a string representation of this DrawingOptions instance.
Holds an opacity value representing the transparency level of an object or pixel.
Definition Opacity.cs:16
static IEqualityComparer< Opacity > Comparer
A default equality comparer for comparing Opacity data values.
Definition Opacity.cs:77
ColorConstant
Enum class for color constants.