Scaleform::Render::Color
class Color;
Color class represents a standard 32-bit ARGB color value with 8 bits per color channel. In addition to serving as a wrapper for a color value, Color provides a variety of inlined constructors, color conversion functions, and color combine effects.
The four internal ARGB channels of a Color are the red, green, blue, and alpha components, which can be accessed using GetRed, GetGreen, GetBlue, and GetAlpha, respectively. Each channel is represented as an 8 bit value with a range of 0 to 255, where 0 indicates an empty channel (no color) and 255 specifies a full channel (max color). For instance, White is equal to RGB(255,255,255), Black RGB(0,0,0), Gray RGB(128,128,128), Red RBG(255,0,0), Green RGB(0,255,0), and Blue RGB(0,0,255).
Color contains a small set of predefined colors, StandardColors, available for convenient color assignment, ranging from gray scale (White, LightGray, Gray, DarkGray, Black) to RGB (Red, DarkRed, Green, DarkGreen, Blue, DarkBlue) to CYM (Cyan, Yellow, Magenta).
A color can be initialized and converted to/from a range of different formats defined by the Model enumeration. Along with the common RGB, HSV, and CMY models, the color class also supports the XYZ, LAB, LUV, YIQ and YUV formats for special purpose color and image processing compatibility. Color object conversion is also provided for all of the color Model formats via the Get/Set methods. For example, to retrieve the hue, saturation, and value of a color simply call the GetHSV operation, passing either a pointer to three integers or three floating-point variables. Likewise, SetHSV will set an existing color object using the HSV model.
For convenience, the SetRGB method also provides initialization using an RGB hex string #RRGGBB ("#FFFFFF", "#FF00FF", "#808080"), or a color name ("White", "Magenta", "Gray"), taken from StandardColors.
Color includes all the useful hardware-oriented color blending functions defined by ColorCombine such as Blend, which blends two color values based on a specified factor, Add, which adds two colors with per-channel saturation, and Modulate, which performs a per-channel multiply. Several of the color-blending operations are available as overloaded operators as well, including plus ("+"), minus ("-"), and multiply ("*") which perform color add, subtract, and modulate, respectively.
Enumeration |
Description |
The predefined set of color formats that can be used to initialize a color. | |
Common set of alpha channel color values. | |
Common set of RGB color values. |
Method |
Description |
Performs an "add" color combine op: (c1 + c2) | |
Performs an "add" color combine op on the channel: (c1 + c2) | |
Performs an "add" color combine op on the RGB channels only: (c1.rgb + c2.rgb) | |
Performs a binary "And" color combine op: (c1 & c2). | |
Performs a binary "and" color combine op on the channel: (c1 & c2). | |
Performs a binary "and" color combine op on the RGB channels only: (c1.rgb & c2.rgb). | |
Performs a "blend" color combine op using passed alpha factor: (c2 * (1-f) + c1 * f) | |
Performs a blend color combine op on the channel: (c2 * (1-f) + c1 * f) | |
Performs a "blend" color combine op on the RGB channels only, using the passed alpha factor: (c1.rgb * (1-f) + c2.rgb * f). | |
Initializes a new instance of a color. | |
Precise HSI to RGB conversion using floating-point trig calculations. | |
Precise RGB to HSI conversion using floating-point trig calculations. | |
Calculates the distance squared between the local color and the passed color. | |
Calculate the intensity of the color as a floating-point value. | |
Creates a new color with only the alpha channel set. | |
Creates a new color with only the red channel set. | |
Creates a new color with only the blue channel set. | |
Creates a new color with only the green channel set. | |
Creates a new color based on the passed 32-bit RGB color. | |
Retrieves the alpha channel value. | |
Retrieves the red channel value. | |
Retrieves the blue channel value. | |
Retrieves the green channel value. | |
Retrieves the grayscale value of the color. | |
Returns a new color formed from the current colors alpha and zero RGB: (0,0,0,this.a). | |
Returns a new color containing the grayscale value of the current color: (0,0,0,this.a). | |
Returns a new color containing the current colors RGB and a zero alpha: (this.rgb, 0). | |
Retrieves the red, green, and blue channel value. | |
Retrieves the red, green, blue, and alpha channel value. | |
Retrieves the alpha channel as a floating-point value between 0.0 and 1.0. | |
Retrieves the red, green, blue, and alpha components as floating point values between 0.0 and 1.0. | |
Retrieves the red, green, and blue components as floating point values between 0.0 and 1.0. | |
Retrieves the hue, saturation, and intensity of the color. | |
Retrieves the hue, saturation, and value of the color. | |
Calculate the intensity of the color as an integer value. | |
Returns the inverted color: (1-c). | |
Returns the inverted value: (1-v). | |
Returns a new color, formed by inverting the RGB channels: (1-c.rgb). | |
Performs a "multiply" color combine op: (c1 * c2) | |
Performs a "multiply" color combine op: (c1 * f) | |
Performs a "multiply" color combine op on the RGB channels only: (c1.rgb * f) | |
Performs a "multiply" color combine op on the RGB channels only: (c1.rgb * c2.rgb) | |
Performs a "multiply" color combine op on the channel: (c1 * c2) | |
Performs a "multiply" color combine op on the channel: (c1 * f) | |
Performs a binary "or" color combine op: (c1 | c2). | |
Performs a binary "or" color combine op on the RGB channels only: (c1.rgb | c2.rgb). | |
Performs a binary "or" color combine op on the channel: (c1 | c2). | |
Initializes the current color. | |
Sets the alpha channel value. | |
Sets the red channel value. | |
Sets the blue channel value. | |
Assigns the red, green, and blue channels to a single grayscale value. | |
Sets the green channel value. | |
Assigns the alpha channel to another color's alpha component. | |
Assigns the red, green, and blue channels to another color's RGB components. | |
Sets the red, green, and blue channels. | |
Sets the red, green, blue, and alpha channels. | |
Sets the alpha channel using a floating-point value. | |
Assigns the red, green, and blue channels using floating point values. | |
Assigns the red, green, blue, and alpha channels using floating point values. | |
Assigns the current color to the passed Hsi values. | |
Assigns the current color to the passed Hsv values. | |
Performs a "subtract" color combine op: (c1 - c2) | |
Performs a "subtract" color combine op on the channel: (c1 - c2) | |
Performs a "subtract" color combine op on the RGB channels only: (c1.rgb - c2.rgb) | |
Returns the current color converted into a Color32 object. | |
Performs a binary "xor" color combine op: (c1 & c2). | |
Performs a binary "xor" color combine op on the channel: (c1 ^ c2). | |
Performs a binary "xor" color combine op on the RGB channels only: (c1.rgb ^ c2.rgb). |
Operator |
Description |
Subtracts the second color from the first. | |
Subtracts another color from the current color. | |
Modulates the first color with the second. | |
Modulates another color with the current color. | |
And's the two colors together. | |
And's another color with the current color. | |
Adds the two colors together. | |
Adds another color to the current color. | |
Determines the inequality of two colors. | |
XOr's the two colors together. | |
XOr's another color with the current color. | |
Or's the two colors together. | |
Or's another color with the current color. | |
Returns a new color formed from the bitwise NOT of the current color. | |
Assigns the current color to the value of the passed color. | |
Determines the equality of two colors. |
Structure |
Description |
32-bit color structure. |
Render_Color.h