Om
1.0.0
A universal framework for multimedia simulation
|
A template class representing a 4-component color. More...
#include <omColor4D.h>
Public Member Functions | |
Color4D () | |
Create a new 4D color with all elements equal to zero. More... | |
Color4D (T value) | |
Create a new 4D color with all elements equal to a single value. More... | |
Color4D (const T array[4]) | |
Create a new 4D color from a pointer to a 4-element array. More... | |
Color4D (T newR, T newG, T newB, T newA) | |
Create a new 4D color by specifying it's R, G, B, and A values. More... | |
Color4D (const Color4D &color) | |
Create a new 4D color from an existing color (copy it). More... | |
template<typename U > | |
Color4D (const Color4D< U > &color) | |
Create a new 4D color from an existing color (copy it), templatized version. More... | |
Color4D (const Color3D< T > &color, T newA) | |
Create a new 4D color from a 3D color and a value for the alpha component. More... | |
Color4D (const math::VectorND< T, 4 > &vector) | |
Create a new 4D color from an existing vector (copy it). More... | |
T * | toArray () |
Get a shallow array representation of this color. More... | |
const T * | toArray () const |
Get a shallow array representation of this color. More... | |
T | getRed () const |
Get the red component of this color. More... | |
T | getGreen () const |
Get the green component of this color. More... | |
T | getBlue () const |
Get the blue component of this color. More... | |
T | getAlpha () const |
Get the W component of this color. More... | |
Color3D< T > | getRGB () const |
Get a 3D color containing the red, green and blue elements of this 4D color. More... | |
void | setRed (T newRed) |
Set the red component of the color to the specified value. More... | |
void | setGreen (T newGreen) |
Set the green component of the color to the specified value. More... | |
void | setBlue (T newBlue) |
Set the blue component of the color to the specified value. More... | |
void | setAlpha (T newAlpha) |
Set the W component of the color to the specified value. More... | |
void | set (T newRed, T newGreen, T newBlue, T newAlpha) |
Set the R, G, blue, and W components of the color to the specified values. More... | |
T & | operator[] (Index index) |
Return a reference to the color component at the specified index. More... | |
const T & | operator[] (Index index) const |
Return a const reference to the color component at the specified index. More... | |
template<typename U > | |
operator Color4D< U > () | |
This operator casts this color to another with different template paramter. More... | |
template<typename U > | |
operator Color4D< U > () const | |
This operator casts this color to another with different template paramter. More... | |
template<typename U > | |
operator math::VectorND< U, 4 > () const | |
This operator casts this color to another with different template paramter. More... | |
bool | operator== (const Color4D< T > &v) const |
Compare two colors component-wise for equality. More... | |
bool | operator!= (const Color4D< T > &v) const |
Compare two colors component-wise for inequality. More... | |
Color4D< T > | operator+ (const Color4D< T > &color) const |
Add this color to another and return the result. More... | |
Color4D< T > | operator+ (const T &value) const |
Add a value to every component of this color. More... | |
Color4D< T > | operator- (const Color4D< T > &color) const |
Subtract a color from this color component-wise and return the result. More... | |
Color4D< T > | operator- (const T &value) const |
Subtract a value from every component of this color. More... | |
Color4D< T > | operator* (const Color4D< T > &color) const |
Multiply component-wise this color and another color. More... | |
Color4D< T > | operator* (const T &value) const |
Multiply every component of this color by a value and return the result. More... | |
Color4D< T > | operator/ (const T &value) const |
Divide every component of this color by a value and return the result. More... | |
Color4D< T > & | operator+= (const Color4D< T > &color) |
Add a color to this color, modifying this original color. More... | |
Color4D< T > & | operator-= (const Color4D< T > &color) |
Subtract a color from this color, modifying this original color. More... | |
Color4D< T > & | operator*= (const Color4D< T > &color) |
Multiply component-wise this color and another color and modify this color. More... | |
Color4D< T > & | operator+= (const T &value) |
Add a value to each component of this color, modifying it. More... | |
Color4D< T > & | operator-= (const T &value) |
Subtract a value from each component of this color, modifying it. More... | |
Color4D< T > & | operator*= (const T &value) |
Multiply a value with each component of this color, modifying it. More... | |
Color4D< T > & | operator/= (const T &value) |
Divide each component of this color by a value, modifying it. More... | |
data::String | toString () const |
Convert this color into a human-readable string representation. More... | |
operator data::String () const | |
Convert this color into a human-readable string representation. More... | |
Public Attributes | |
T | r |
The red component of a 3D color. More... | |
T | g |
The green component of a 3D color. More... | |
T | b |
The blue component of a 3D color. More... | |
T | a |
The W component of a 3D color. More... | |
Static Public Attributes | |
static const Color4D< T > | ZERO |
A constant color with all elements equal to zero. More... | |
static const Color4D< T > | BLACK |
A constant color with R, G, and B equal to zero, and A equal to 1. More... | |
static const Color4D< T > | WHITE |
A constant color with all elements equal to one. More... | |
A template class representing a 4-component color.
|
inline |
Create a new 4D color with all elements equal to zero.
|
inlineexplicit |
Create a new 4D color with all elements equal to a single value.
This constructor creates a uniform 4D color with all elements equal to each other and equal to the single constructor parameter value.
value | - The value to set all elements of the color to. |
|
inlineexplicit |
Create a new 4D color from a pointer to a 4-element array.
|
inline |
Create a new 4D color by specifying it's R, G, B, and A values.
|
inline |
Create a new 4D color from an existing color (copy it).
|
inline |
Create a new 4D color from an existing color (copy it), templatized version.
This constructor takes the x, y, z, and w values of the color parameter and sets the components of this color to be the same.
|
inline |
Create a new 4D color from a 3D color and a value for the alpha component.
This constructor takes the red, green, and blue components of the first parameter, a 2D color, and sets the red, green, and blue components of this color to be the same. It then takes the 4nd parameter and sets the W component of this color to be that value.
color | - A 3D color for the red, green, and blue components of this color. |
newA | - The value for the alpha component of this color. |
|
inline |
Create a new 4D color from an existing vector (copy it).
This constructor takes the x, y, z, and w values of the vector parameter and sets the components of this color to be the same.
|
inline |
Get a shallow array representation of this color.
This method returns a pointer to the address of the red component of the color and does not do any copying of the elements. Therefore, this method should only be used where one needs an array representation of a color without having to allocate more memory and copy the color.
|
inline |
Get a shallow array representation of this color.
This method returns a pointer to the address of the red component of the color and does not do any copying of the elements. Therefore, this method should only be used where one needs an array representation of a color without having to allocate more memory and copy the color.
|
inline |
Get the red component of this color.
|
inline |
Get the green component of this color.
|
inline |
Get the blue component of this color.
|
inline |
Get the W component of this color.
|
inline |
Get a 3D color containing the red, green and blue elements of this 4D color.
|
inline |
Set the red component of the color to the specified value.
|
inline |
Set the green component of the color to the specified value.
|
inline |
Set the blue component of the color to the specified value.
|
inline |
Set the W component of the color to the specified value.
|
inline |
Set the R, G, blue, and W components of the color to the specified values.
This method takes 4 parameter representing the 4 components of this color and sets this color's components to have those values.
newRed | - The new red component of the color. |
newGreen | - The new green component of the color. |
newBlue | - The new blue component of the color. |
newAlpha | - The new alpha component of the color. |
|
inline |
Return a reference to the color component at the specified index.
|
inline |
Return a const reference to the color component at the specified index.
|
inline |
This operator casts this color to another with different template paramter.
This method provides an operator for the casting of this color to another color with a potentially different template paramter.
|
inline |
This operator casts this color to another with different template paramter.
This method provides an operator for the casting of this color to another color with a potentially different template paramter. This is the const version of this operator.
|
inline |
This operator casts this color to another with different template paramter.
This method provides an operator for the casting of this color to another color with a potentially different template paramter. This is the const version of this operator.
|
inline |
Compare two colors component-wise for equality.
|
inline |
Compare two colors component-wise for inequality.
|
inline |
Add this color to another and return the result.
This method adds another color to this one, component-wise, and returns this addition. It does not modify either of the original colors.
color | - The color to add to this one. |
|
inline |
Add a value to every component of this color.
This method adds the value parameter to every component of the color, and returns a color representing this result. It does not modifiy the original color.
value | - The value to add to all components of this color. |
|
inline |
Subtract a color from this color component-wise and return the result.
This method subtracts another color from this one, component-wise, and returns this subtraction. It does not modify either of the original colors.
color | - The color to subtract from this one. |
|
inline |
Subtract a value from every component of this color.
This method subtracts the value parameter from every component of the color, and returns a color representing this result. It does not modifiy the original color.
value | - The value to subtract from all components of this color. |
|
inline |
Multiply component-wise this color and another color.
This operator multiplies each component of this color by the corresponding component of the other color and returns a color representing this result. It does not modify either original color.
color | - The color to multiply this color by. |
|
inline |
Multiply every component of this color by a value and return the result.
This method multiplies the value parameter with every component of the color, and returns a color representing this result. It does not modifiy the original color.
value | - The value to multiplly with all components of this color. |
|
inline |
Divide every component of this color by a value and return the result.
This method Divides every component of the color by the value parameter, and returns a color representing this result. It does not modifiy the original color.
value | - The value to divide all components of this color by. |
|
inline |
Add a color to this color, modifying this original color.
This method adds another color to this color, component-wise, and sets this color to have the result of this addition.
color | - The color to add to this color. |
|
inline |
Subtract a color from this color, modifying this original color.
This method subtracts another color from this color, component-wise, and sets this color to have the result of this subtraction.
color | - The color to subtract from this color. |
|
inline |
Multiply component-wise this color and another color and modify this color.
This operator multiplies each component of this color by the corresponding component of the other color and modifies this color to contain the result.
color | - The color to multiply this color by. |
|
inline |
Add a value to each component of this color, modifying it.
This operator adds a value to each component of this color and modifies this color to store the result.
value | - The value to add to every component of this color. |
|
inline |
Subtract a value from each component of this color, modifying it.
This operator subtracts a value from each component of this color and modifies this color to store the result.
value | - The value to subtract from every component of this color. |
|
inline |
Multiply a value with each component of this color, modifying it.
This operator multiplies a value with each component of this color and modifies this color to store the result.
value | - The value to multiply with every component of this color. |
|
inline |
Divide each component of this color by a value, modifying it.
This operator Divides each component of this color by value and modifies this color to store the result.
value | - The value to multiply with every component of this color. |
|
inline |
Convert this color into a human-readable string representation.
|
inline |
Convert this color into a human-readable string representation.
T om::images::base::Color4D< T >::r |
The red component of a 3D color.
T om::images::base::Color4D< T >::g |
The green component of a 3D color.
T om::images::base::Color4D< T >::b |
The blue component of a 3D color.
T om::images::base::Color4D< T >::a |
The W component of a 3D color.
|
static |
A constant color with all elements equal to zero.
|
static |
A constant color with R, G, and B equal to zero, and A equal to 1.
|
static |
A constant color with all elements equal to one.