Om
1.0.0
A universal framework for multimedia simulation
|
A template class representing a 3-component color. More...
#include <omColor3D.h>
Public Member Functions | |
Color3D () | |
Create a new 3D color with all elements equal to zero. More... | |
Color3D (T value) | |
Create a new 3D color with all elements equal to a single value. More... | |
Color3D (const T array[3]) | |
Create a new 3D color from a pointer to a 3 element array. More... | |
Color3D (T newR, T newG, T newB) | |
Create a new 3D color by specifying it's R, G, and B values. More... | |
Color3D (const Color3D &color) | |
Create a new 3D color from an existing color (copy it). More... | |
template<typename U > | |
Color3D (const Color3D< U > &color) | |
Create a new 3D color from an existing color (copy it). More... | |
Color3D (const math::VectorND< T, 3 > &vector) | |
Create a new 3D color from an existing 3D 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 X component of this color. More... | |
T | getGreen () const |
Get the Y component of this color. More... | |
T | getBlue () const |
Get the Z component of this 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 | set (T newR, T newG, T newB) |
Set the red, green, and blue 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 Color3D< U > () const | |
This operator casts this color to another with different template paramter. More... | |
template<typename U > | |
operator math::VectorND< U, 3 > () const | |
This operator casts this color to another with different template paramter. More... | |
bool | operator== (const Color3D< T > &v) const |
Compare two colors component-wise for equality. More... | |
bool | operator!= (const Color3D< T > &v) const |
Compare two colors component-wise for inequality. More... | |
Color3D< T > | operator+ (const Color3D< T > &color) const |
Add this color to another and return the result. More... | |
Color3D< T > | operator+ (const T &value) const |
Add a value to every component of this color. More... | |
Color3D< T > | operator- (const Color3D< T > &color) const |
Subtract a color from this color component-wise and return the result. More... | |
Color3D< T > | operator- (const T &value) const |
Subtract a value from every component of this color. More... | |
Color3D< T > | operator* (const Color3D< T > &color) const |
Multiply component-wise this color and another color. More... | |
Color3D< T > | operator* (const T &value) const |
Multiply every component of this color by a value and return the result. More... | |
Color3D< T > | operator/ (const T &value) const |
Divide every component of this color by a value and return the result. More... | |
Color3D< T > & | operator+= (const Color3D< T > &color) |
Add a color to this color, modifying this original color. More... | |
Color3D< T > & | operator-= (const Color3D< T > &color) |
Subtract a color from this color, modifying this original color. More... | |
Color3D< T > & | operator*= (const Color3D< T > &color) |
Multiply component-wise this color and another color and modify this color. More... | |
Color3D< T > & | operator+= (const T &value) |
Add a value to each component of this color, modifying it. More... | |
Color3D< T > & | operator-= (const T &value) |
Subtract a value from each component of this color, modifying it. More... | |
Color3D< T > & | operator*= (const T &value) |
Multiply a value with each component of this color, modifying it. More... | |
Color3D< 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... | |
Static Public Attributes | |
static const Color3D< T > | ZERO |
A constant color with all elements equal to zero. More... | |
static const Color3D< T > | BLACK |
A constant color with all elements equal to zero. More... | |
static const Color3D< T > | WHITE |
A constant color with all elements equal to one. More... | |
A template class representing a 3-component color.
|
inline |
Create a new 3D color with all elements equal to zero.
|
inlineexplicit |
Create a new 3D color with all elements equal to a single value.
This constructor creates a uniform 3D 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 3D color from a pointer to a 3 element array.
|
inline |
Create a new 3D color by specifying it's R, G, and B values.
This constructor sets each of the color's R, G, and B component values to be the 1st, 2nd, and 3rd parameters of the constructor, respectively.
|
inline |
Create a new 3D color from an existing color (copy it).
This constructor takes the x, y, and z values of the color parameter and sets the components of this color to be the same.
|
inline |
Create a new 3D color from an existing color (copy it).
This constructor takes the x, y, and z values of the color parameter and sets the components of this color to be the same.
|
inline |
Create a new 3D color from an existing 3D vector (copy it).
This constructor takes the x, y, and z 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 X component of this color.
|
inline |
Get the Y component of this color.
|
inline |
Get the Z component of this 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 red, green, and blue components of the color to the specified values.
This method takes 3 parameter representing the 3 components of this color and sets this color's components to have those values.
newR | - The new red component of the color. |
newG | - The new green component of the color. |
newB | - The new blue 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. 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::Color3D< T >::r |
The red component of a 3D color.
T om::images::base::Color3D< T >::g |
The green component of a 3D color.
T om::images::base::Color3D< T >::b |
The blue component of a 3D color.
|
static |
A constant color with all elements equal to zero.
|
static |
A constant color with all elements equal to zero.
|
static |
A constant color with all elements equal to one.