|
API Links
Developer Links
|
class ColorRGBA
Defined in: C4ColorRGBA.h
The ColoRGBA class encapsulates an RGBA color.
Definition
class ColorRGBA
Member Functions
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. When a ColorRGB object is converted to a ColorRGBA object, the alpha component is assumed to be 1.
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 [](long 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 [](long 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 f); |
Assigns the value f 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 t); |
Multiplies all four components by t.
|
ColorRGBA& operator /=(float t); |
Divides all four components by t.
|
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 t); |
Returns the product of the color c and the scalar t.
|
ColorRGBA operator *(float t, const ColorRGBA& c); |
Returns the product of the color c and the scalar t.
|
ColorRGBA operator /(const ColorRGBA& c, float t); |
Returns the product of the color c and the inverse of the scalar t.
|
bool operator ==(const ColorRGBA& c1, const ColorRGBA& c2); |
Returns a boolean value indicating the equality of the two colors c1 and c2.
|
bool operator ==(const ColorRGBA& c1, const ColorRGB& c2); |
Returns a boolean value indicating the equality of the two colors c1 and c2. The alpha component of c2 is assumed to be 1.
|
bool operator !=(const ColorRGBA& c1, const ColorRGBA& c2); |
Returns a boolean value indicating the inequality of the two colors c1 and c2.
|
bool operator !=(const ColorRGBA& c1, const ColorRGB& c2); |
Returns a boolean value indicating the inequality of the two colors c1 and c2. The alpha component of c2 is assumed to be 1.
|
See Also
ColorRGB
|