class ColorRGBA
Defined in:
The TSColor.h
ColorRGBA
class encapsulates a floating-point RGBA color.
Definition
class ColorRGBA
Member Functions
ColorRGBA::Set |
Sets all four components of a color. |
ColorRGBA::GetColorRGB |
Returns a reference to a ColorRGB object.
|
Data Members
float red; |
The red component. |
float green; |
The green component. |
float blue; |
The blue component. |
float alpha; |
The alpha component. |
Constructor
ColorRGBA();
ColorRGBA(const ColorRGB& c, float a = 1.0F);
ColorRGBA(float r, float g, float b, float a = 1.0F);
Description
The ColorRGBA
class encapsulates a color having floating-point red, green, blue, and alpha components in the range [0.0, 1.0]. When a ColorRGB
object is converted to a ColorRGBA
object, the alpha component is assumed to be 1.0.The default constructor leaves the components of the color undefined. If the values
r
, g
, b
, and a
are supplied, then they are assigned to the red, green, blue, and alpha components of the color, respectively.
Overloaded Operators
float& operator [](machine k); |
Returns a reference to the k -th component of a color. The value of k must be 0, 1, 2, or 3.
|
const float& operator [](machine k) const; |
Returns a constant reference to the k -th component of a color. The value of k must be 0, 1, 2, or 3.
|
ColorRGBA& operator =(const ColorRGB& c); |
Copies the red, green, and blue components of c , and assigns the alpha component a value of 1.
|
ColorRGBA& operator =(float s); |
Assigns the value s to the red, green, and blue components, and assigns the alpha component a value of 1.
|
ColorRGBA& operator +=(const ColorRGBA& c); |
Adds the color c .
|
ColorRGBA& operator +=(const ColorRGB& c); |
Adds the color c . The alpha component is not modified.
|
ColorRGBA& operator -=(const ColorRGBA& c); |
Subtracts the color c .
|
ColorRGBA& operator -=(const ColorRGB& c); |
Subtracts the color c . The alpha component is not modified.
|
ColorRGBA& operator *=(const ColorRGBA& c); |
Multiplies by the color c .
|
ColorRGBA& operator *=(const ColorRGB& c); |
Multiplies by the color c . The alpha component is not modified.
|
ColorRGBA& operator *=(float s); |
Multiplies all four components by s .
|
ColorRGBA& operator /=(float s); |
Divides all four components by s .
|
Nonmember Operations
ColorRGBA operator -(const ColorRGBA& c); |
Returns the negation of the color c .
|
ColorRGBA operator +(const ColorRGBA& c1, const ColorRGBA& c2); |
Returns the sum of the colors c1 and c2 .
|
ColorRGBA operator +(const ColorRGBA& c1, const ColorRGB& c2); |
Returns the sum of the colors c1 and c2 . The alpha component of c2 is assumed to be 0.
|
ColorRGBA operator -(const ColorRGBA& c1, const ColorRGBA& c2); |
Returns the difference of the colors c1 and c2 .
|
ColorRGBA operator -(const ColorRGBA& c1, const ColorRGB& c2); |
Returns the difference of the colors c1 and c2 . The alpha component of c2 is assumed to be 0.
|
ColorRGBA operator *(const ColorRGBA& c1, const ColorRGBA& c2); |
Returns the product of the colors c1 and c2 .
|
ColorRGBA operator *(const ColorRGBA& c1, const ColorRGB& c2); |
Returns the product of the colors c1 and c2 . The alpha component of c2 is assumed to be 1.
|
ColorRGBA operator *(const ColorRGB& c1, const ColorRGBA& c2); |
Returns the product of the colors c1 and c2 . The alpha component of c1 is assumed to be 1.
|
ColorRGBA operator *(const ColorRGBA& c, float s); |
Returns the product of the color c and the scalar s .
|
ColorRGBA operator *(float s, const ColorRGBA& c); |
Returns the product of the color c and the scalar s .
|
ColorRGBA operator /(const ColorRGBA& c, float s); |
Returns the product of the color c and the inverse of the scalar s .
|
bool operator ==(const ColorRGBA& c1, const ColorRGBA& c2); |
Returns a boolean value indicating whether the two colors c1 and c2 are equal.
|
bool operator ==(const ColorRGBA& c1, const ColorRGB& c2); |
Returns a boolean value indicating whether the two colors c1 and c2 are equal. The alpha component of c2 is assumed to be 1.
|
bool operator !=(const ColorRGBA& c1, const ColorRGBA& c2); |
Returns a boolean value indicating whether the two colors c1 and c2 are not equal.
|
bool operator !=(const ColorRGBA& c1, const ColorRGB& c2); |
Returns a boolean value indicating whether the two colors c1 and c2 are not equal. The alpha component of c2 is assumed to be 1.
|
float Luminance(const ColorRGBA& c); |
Returns the luminance value of the color c .
|
See Also