Color Struct
NuGet: GHIElectronics.TinyCLR.Drawing
Assembly: GHIElectronics.TinyCLR.Drawing
Namespace: System.Drawing
32-bit ARGB color value. Construct via FromArgb(int, int, int) / FromArgb(int, int, int, int), or use one of the named static constants.
public struct Color
Properties
Transparent
public static Color Transparent { get; }
Gets a fully transparent color.
Black
public static Color Black { get; }
Gets the color black.
White
public static Color White { get; }
Gets the color white.
Gray
public static Color Gray { get; }
Gets the color gray.
Red
public static Color Red { get; }
Gets the color red.
Green
public static Color Green { get; }
Gets the color green.
Blue
public static Color Blue { get; }
Gets the color blue.
Yellow
public static Color Yellow { get; }
Gets the color yellow.
Purple
public static Color Purple { get; }
Gets the color purple.
Teal
public static Color Teal { get; }
Gets the color teal.
R
public byte R { get; }
Gets the red component of this color.
G
public byte G { get; }
Gets the green component of this color.
B
public byte B { get; }
Gets the blue component of this color.
A
public byte A { get; }
Gets the alpha component of this color.
IsEmpty
public bool IsEmpty { get; }
Gets a value indicating whether this color is empty.
Name
public string Name { get; }
Gets the hexadecimal string representation of this color's value.
Methods
Color()
public static readonly Color Empty = new Color()
Represents a color that is null or uninitialized.
Returns Color Empty = new
FromArgb(int argb)
public static Color FromArgb(int argb)
Creates a color from a 32-bit ARGB value.
Returns Color
FromArgb(int red, int green, int blue)
public static Color FromArgb(int red, int green, int blue)
Creates an opaque color from the given red, green, and blue components.
Returns Color
FromArgb(int alpha, int red, int green, int blue)
public static Color FromArgb(int alpha, int red, int green, int blue)
Creates a color from the given alpha, red, green, and blue components.
Returns Color
FromArgb(int alpha, Color baseColor)
public static Color FromArgb(int alpha, Color baseColor)
Creates a color from an existing color with the given alpha value.
Returns Color
GetBrightness()
public float GetBrightness()
Gets the brightness (lightness) of this color as a value from 0 to 1.
Returns float
GetHue()
public float GetHue()
Gets the hue of this color in degrees (0 to 360).
Returns float
GetSaturation()
public float GetSaturation()
Gets the saturation of this color as a value from 0 to 1.
Returns float
ToArgb()
public int ToArgb()
Gets the 32-bit ARGB value of this color.
Returns int
ToString()
public override string ToString()
Returns a string describing this color's ARGB components.
Returns string
==(Color left, Color right)
public static bool operator ==(Color left, Color right)
Determines whether two colors have the same ARGB value.
Returns bool operator
!=(Color left, Color right)
public static bool operator !=(Color left, Color right)
Determines whether two colors have different ARGB values.
Returns bool operator
GetHashCode()
public override int GetHashCode()
Returns a hash code for this color.
Returns int
Equals(object obj)
public override bool Equals(object obj)
Determines whether the specified object is a color with the same ARGB value.
Returns bool
Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat)
public static void Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat)
Converts color data from one format to another.
Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat, RgbFormat rgbFormat)
public static void Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat, RgbFormat rgbFormat)
Converts color data using the specified color and channel formats.
Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat, RgbFormat rgbFormat, byte alpha)
public static void Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat, RgbFormat rgbFormat, byte alpha)
Converts color data using the specified formats and alpha value.
Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat, RgbFormat rgbFormat, byte alpha, byte[] colorTable)
public static void Convert(byte[] inArray, byte[] outArray, ColorFormat colorFormat, RgbFormat rgbFormat, byte alpha, byte[] colorTable)
Converts color data using the specified formats, alpha value, and color table.
ConvertTo1Bpp(byte[] inArray, byte[] outArray, uint width)
public static void ConvertTo1Bpp(byte[] inArray, byte[] outArray, uint width)
Converts color data to a 1-bit-per-pixel monochrome representation.
ConvertTo1Bpp(byte[] inArray, byte[] outArray, uint width, BitFormat bitFormat)
public static void ConvertTo1Bpp(byte[] inArray, byte[] outArray, uint width, BitFormat bitFormat)
Converts color data to a 1-bit-per-pixel monochrome representation using the given bit format.