DrawingColor Struct
Represents a color.
public struct DrawingColor : IEquatable<DrawingColor>
Public Structure DrawingColor
Implements IEquatable(Of DrawingColor)
Implements
Properties
A
Gets the color opacity (0 = fully transparent, 255 = fully opaque).
Property Value
- System.Byte
The color opacity.
Argb
Gets the Opacity, Red, Green and Blue components in a single System.Int32 value.
Property Value
- System.Int32
The Opacity, Red, Green and Blue components in a single System.Int32 value.
B
Gets the Blue component (from 0 to 255).
Property Value
- System.Byte
The Blue component.
G
Gets the Green component (from 0 to 255).
Property Value
- System.Byte
The Green component.
Name
Gets the color name.
public readonly DrawingColorName Name { get; }
Public ReadOnly Property Name As DrawingColorName
Property Value
The color name.
R
Gets the Red component (from 0 to 255).
Property Value
- System.Byte
The Red component.
Methods
Equals(DrawingColor)
Determines whether the other
DrawingColor is equal to this DrawingColor instance.
public bool Equals(DrawingColor other)
Public Function Equals(other As DrawingColor) As Boolean
Parameters
other
- DrawingColor
The other color to compare with this color instance.
Returns
- System.Boolean
true if the other
DrawingColor is equal to this DrawingColor instance; otherwise, false.
Equals(Object)
Determines whether the specified System.Object is equal to this DrawingColor instance.
public override bool Equals(object obj)
Public Overrides Function Equals(obj As Object) As Boolean
Parameters
obj
- System.Object
The System.Object to compare with this color instance.
Returns
- System.Boolean
true if the specified System.Object is a DrawingColor and is equal to this DrawingColor instance; otherwise, false.
Overrides
FromHsl(Int32, Int32, Int32)
Creates a new color instance from the specified Hue, Saturation and Lightness components.
public static DrawingColor FromHsl(int h, int s, int l)
Public Shared Function FromHsl(h As Integer, s As Integer, l As Integer) As DrawingColor
Parameters
h
- System.Int32
The Hue component (from 0 to 255).
s
- System.Int32
The Saturation component (from 0 to 255).
l
- System.Int32
The Lightness component (from 0 to 255).
Returns
A new color instance from the specified Hue, Saturation and Lightness components.
FromHsl(Int32, Int32, Int32, Double)
Creates a new color instance from the specified Hue, Saturation and Lightness components and transparency.
public static DrawingColor FromHsl(int h, int s, int l, double transparency)
Public Shared Function FromHsl(h As Integer, s As Integer, l As Integer, transparency As Double) As DrawingColor
Parameters
h
- System.Int32
The Hue component (from 0 to 255).
s
- System.Int32
The Saturation component (from 0 to 255).
l
- System.Int32
The Lightness component (from 0 to 255).
transparency
- System.Double
The transparency (0 = fully opaque, 1 = fully transparent).
Returns
A new color instance from the specified Hue, Saturation and Lightness components and transparency.
FromName(DrawingColorName)
Creates a new color instance from the specified color name.
public static DrawingColor FromName(DrawingColorName name)
Public Shared Function FromName(name As DrawingColorName) As DrawingColor
Parameters
name
- DrawingColorName
The color name.
Returns
A color instance with the specified name.
FromName(DrawingColorName, Double)
Creates a new color instance from the specified color name and luminance.
public static DrawingColor FromName(DrawingColorName name, double luminance)
Public Shared Function FromName(name As DrawingColorName, luminance As Double) As DrawingColor
Parameters
name
- DrawingColorName
The color name.
luminance
- System.Double
The luminance (-1 = darkest, 0 = none, 1 = lightest).
Returns
A color instance with the specified name and luminance.
FromName(DrawingColorName, Double, Double)
Creates a new color instance from the specified color name, luminance and transparency.
public static DrawingColor FromName(DrawingColorName name, double luminance, double transparency)
Public Shared Function FromName(name As DrawingColorName, luminance As Double, transparency As Double) As DrawingColor
Parameters
name
- DrawingColorName
The color name.
luminance
- System.Double
The luminance (-1 = darkest, 0 = none, 1 = lightest).
transparency
- System.Double
The transparency (0 = fully opaque, 1 = fully transparent).
Returns
A color instance with the specified name, luminance and transparency.
FromRgb(Int32, Int32, Int32)
Creates a new color instance from the specified Red, Green and Blue components.
public static DrawingColor FromRgb(int r, int g, int b)
Public Shared Function FromRgb(r As Integer, g As Integer, b As Integer) As DrawingColor
Parameters
r
- System.Int32
The Red component (from 0 to 255).
g
- System.Int32
The Green component (from 0 to 255).
b
- System.Int32
The Blue component (from 0 to 255).
Returns
A new color instance from the specified Red, Green and Blue components.
FromRgb(Int32, Int32, Int32, Double)
Creates a new color instance from the specified Red, Green and Blue components and transparency.
public static DrawingColor FromRgb(int r, int g, int b, double transparency)
Public Shared Function FromRgb(r As Integer, g As Integer, b As Integer, transparency As Double) As DrawingColor
Parameters
r
- System.Int32
The Red component (from 0 to 255).
g
- System.Int32
The Green component (from 0 to 255).
b
- System.Int32
The Blue component (from 0 to 255).
transparency
- System.Double
The transparency (0 = fully opaque, 1 = fully transparent).
Returns
A new color instance from the specified Red, Green and Blue components and transparency.
GetHashCode()
Returns a hash code for this DrawingColor instance.
Returns
- System.Int32
An integer value that specifies a hash value for this DrawingColor instance.
Overrides
ToString()
Returns a System.String that represents this DrawingColor instance.
Returns
- System.String
A System.String that represents this DrawingColor instance.
Overrides
Operators
Equality(DrawingColor, DrawingColor)
Determines whether first
and second
DrawingColors are equal.
public static bool operator ==(DrawingColor first, DrawingColor second)
Public Shared Operator =(first As DrawingColor, second As DrawingColor) As Boolean
Parameters
first
- DrawingColor
The first color.
second
- DrawingColor
The second color.
Returns
- System.Boolean
true if first
and second
colors are equal; otherwise, false.
Inequality(DrawingColor, DrawingColor)
Determines whether first
and second
DrawingColors are not equal.
public static bool operator !=(DrawingColor first, DrawingColor second)
Public Shared Operator <>(first As DrawingColor, second As DrawingColor) As Boolean
Parameters
first
- DrawingColor
The first color.
second
- DrawingColor
The second color.
Returns
- System.Boolean
true if first
and second
colors are not equal; otherwise, false.