Struct Color
Describes a color in terms of alpha, red, green, and blue channels.
Inherited Members
Namespace: Telerik.WinControls.UI.Diagrams
Assembly: Telerik.WinControls.RadDiagram.dll
Syntax
public struct Color : IFormattable
Properties
A
Gets or sets the sRGB alpha channel value of the color.
Declaration
public byte A { get; set; }
Property Value
|
System.Byte
The sRGB alpha channel value of the color. |
B
Gets or sets the sRGB blue channel value of the color.
Declaration
public byte B { get; set; }
Property Value
|
System.Byte
The sRGB blue channel value of the current System.Windows.Media.Color structure. |
G
Gets or sets the sRGB green channel value of the color.
Declaration
public byte G { get; set; }
Property Value
|
System.Byte
The sRGB green channel value of the current System.Windows.Media.Color structure. |
R
Gets or sets the sRGB red channel value of the color.
Declaration
public byte R { get; set; }
Property Value
|
System.Byte
The sRGB red channel value of the current System.Windows.Media.Color structure. |
ScA
Gets or sets the ScRGB alpha channel value of the color.
Declaration
public float ScA { get; set; }
Property Value
|
System.Single
The ScRGB alpha channel value of the current System.Windows.Media.Color structure. |
ScB
Gets or sets the ScRGB blue channel value of the color.
Declaration
public float ScB { get; set; }
Property Value
|
System.Single
The ScRGB red channel value of the current System.Windows.Media.Color structure. |
ScG
Gets or sets the ScRGB green channel value of the color.
Declaration
public float ScG { get; set; }
Property Value
|
System.Single
The ScRGB green channel value of the current System.Windows.Media.Color structure. |
ScR
Gets or sets the ScRGB red channel value of the color.
Declaration
public float ScR { get; set; }
Property Value
|
System.Single
The ScRGB red channel value of the current System.Windows.Media.Color structure. |
Methods
AreClose(Color, Color)
Compares two System.Windows.Media.Color structures for fuzzy equality.
Declaration
public static bool AreClose(Color color1, Color color2)
Parameters
|
Color
color1
The first color to compare. |
|
Color
color2
The second color to compare. |
Returns
|
System.Boolean
true if |
Clamp()
Sets the ScRGB channels of the color to within the gamut of 0 to 1, if they are outside that range.
Declaration
public void Clamp()
Equals(Object)
Tests whether the specified object is a System.Windows.Media.Color structure and is equivalent to the current color.
Declaration
public override bool Equals(object o)
Parameters
|
System.Object
o
The object to compare to the current System.Windows.Media.Color structure. |
Returns
|
System.Boolean
true if the specified object is a System.Windows.Media.Color structure and is identical to the current System.Windows.Media.Color structure; otherwise, false. |
Overrides
Equals(Color)
Tests whether the specified System.Windows.Media.Color structure is identical to the current color.
Declaration
public bool Equals(Color color)
Parameters
|
Color
color
The System.Windows.Media.Color structure to compare to the current System.Windows.Media.Color structure. |
Returns
|
System.Boolean
true if the specified System.Windows.Media.Color structure is identical to the current System.Windows.Media.Color structure; otherwise, false. |
Equals(Color, Color)
Tests whether two System.Windows.Media.Color structures are identical.
Declaration
public static bool Equals(Color color1, Color color2)
Parameters
|
Color
color1
The first System.Windows.Media.Color structure to compare. |
|
Color
color2
The second System.Windows.Media.Color structure to compare. |
Returns
|
System.Boolean
true if |
FromArgb(Byte, Byte, Byte, Byte)
Creates a new System.Windows.Media.Color structure by using the specified sRGB alpha channel and color channel values.
Declaration
public static Color FromArgb(byte a, byte r, byte g, byte b)
Parameters
|
System.Byte
a
The alpha channel, System.Windows.Media.Color.A, of the new color. |
|
System.Byte
r
The red channel, System.Windows.Media.Color.R, of the new color. |
|
System.Byte
g
The green channel, System.Windows.Media.Color.G, of the new color. |
|
System.Byte
b
The blue channel, System.Windows.Media.Color.B, of the new color. |
Returns
|
Color
A System.Windows.Media.Color structure with the specified values. |
FromAValues(Single, Single[], Uri)
Creates a new System.Windows.Media.Color structure by using the specified alpha channel, color channel values, and color profile.
Declaration
public static Color FromAValues(float a, float[] values, Uri profileUri)
Parameters
|
System.Single
a
The alpha channel for the new color. |
|
System.Single[]
values
A collection of values that specify the color channels for the new color. These values map to the |
|
System.Uri
profileUri
The International Color Consortium (ICC) or Image Color Management (ICM) color profile for the new color. |
Returns
|
Color
A System.Windows.Media.Color structure with the specified values. |
FromRgb(Byte, Byte, Byte)
Creates a new System.Windows.Media.Color structure by using the specified sRGB color channel values.
Declaration
public static Color FromRgb(byte r, byte g, byte b)
Parameters
|
System.Byte
r
The sRGB red channel, System.Windows.Media.Color.R, of the new color. |
|
System.Byte
g
The sRGB green channel, System.Windows.Media.Color.G, of the new color. |
|
System.Byte
b
The sRGB blue channel, System.Windows.Media.Color.B, of the new color. |
Returns
|
Color
A System.Windows.Media.Color structure with the specified values and an alpha channel value of 1. |
FromScRgb(Single, Single, Single, Single)
Creates a new System.Windows.Media.Color structure by using the specified ScRGB alpha channel and color channel values.
Declaration
public static Color FromScRgb(float a, float r, float g, float b)
Parameters
|
System.Single
a
The ScRGB alpha channel, System.Windows.Media.Color.ScA, of the new color. |
|
System.Single
r
The ScRGB red channel, System.Windows.Media.Color.ScR, of the new color. |
|
System.Single
g
The ScRGB green channel, System.Windows.Media.Color.ScG, of the new color. |
|
System.Single
b
The ScRGB blue channel, System.Windows.Media.Color.ScB, of the new color. |
Returns
|
Color
A System.Windows.Media.Color structure with the specified values. |
FromValues(Single[], Uri)
Creates a new System.Windows.Media.Color structure by using the specified color channel values and color profile.
Declaration
public static Color FromValues(float[] values, Uri profileUri)
Parameters
|
System.Single[]
values
A collection of values that specify the color channels for the new color. These values map to the |
|
System.Uri
profileUri
The International Color Consortium (ICC) or Image Color Management (ICM) color profile for the new color. |
Returns
|
Color
A System.Windows.Media.Color structure with the specified values and an alpha channel value of 1. |
GetHashCode()
Gets a hash code for the current System.Windows.Media.Color structure.
Declaration
public override int GetHashCode()
Returns
|
System.Int32
A hash code for the current System.Windows.Media.Color structure. |
Overrides
GetNativeColorValues()
Gets the color channel values of the color.
Declaration
public float[] GetNativeColorValues()
Returns
|
System.Single[]
An array of color channel values. |
Multiply(Color, Single)
Multiplies the alpha, red, blue, and green channels of the specified System.Windows.Media.Color structure by the specified value.
Declaration
public static Color Multiply(Color color, float coefficient)
Parameters
|
Color
color
The System.Windows.Media.Color to be multiplied. |
|
System.Single
coefficient
The value to multiply by. |
Returns
|
Color
A new System.Windows.Media.Color structure whose color values are the results of the multiplication operation. |
ToString()
Creates a string representation of the color using the ScRGB channels.
Declaration
public override string ToString()
Returns
|
System.String
The string representation of the color. |
Overrides
ToString(IFormatProvider)
Creates a string representation of the color by using the ScRGB channels and the specified format provider.
Declaration
public string ToString(IFormatProvider provider)
Parameters
|
System.IFormatProvider
provider
Culture-specific formatting information. |
Returns
|
System.String
The string representation of the color. |
Operators
Equality(Color, Color)
Declaration
public static bool operator ==(Color dColor, Color color)
Parameters
|
System.Drawing.Color
dColor
|
|
Color
color
|
Returns
|
System.Boolean
|
Equality(Color, Color)
Declaration
public static bool operator ==(Color color1, Color color2)
Parameters
|
Color
color1
|
|
Color
color2
|
Returns
|
System.Boolean
|
Implicit(Color to Color)
Declaration
public static implicit operator Color(Color color)
Parameters
|
System.Drawing.Color
color
|
Returns
|
Color
|
Implicit(Color to Color)
Declaration
public static implicit operator Color(Color color)
Parameters
|
Color
color
|
Returns
|
System.Drawing.Color
|
Inequality(Color, Color)
Declaration
public static bool operator !=(Color dColor, Color color)
Parameters
|
System.Drawing.Color
dColor
|
|
Color
color
|
Returns
|
System.Boolean
|
Inequality(Color, Color)
Declaration
public static bool operator !=(Color color1, Color color2)
Parameters
|
Color
color1
|
|
Color
color2
|
Returns
|
System.Boolean
|
Multiply(Color, Single)
Multiplies the alpha, red, blue, and green channels of the specified System.Windows.Media.Color structure by the specified value.
Declaration
public static Color operator *(Color color, float coefficient)
Parameters
|
Color
color
The System.Windows.Media.Color to be multiplied. |
|
System.Single
coefficient
The value to multiply by. |
Returns
|
Color
A new System.Windows.Media.Color structure whose color values are the results of the multiplication operation. |
Explicit Interface Implementations
IFormattable.ToString(String, IFormatProvider)
Declaration
string IFormattable.ToString(string format, IFormatProvider provider)
Parameters
|
System.String
format
|
|
System.IFormatProvider
provider
|
Returns
|
System.String
|