kanzi::ColorRGBA Class Reference

Color with 4 floating point components: red, green, blue and alpha (r, g, b, a). More...

#include <kanzi/core/math/color_rgba.hpp>

Public Member Functions

 ColorRGBA ()
 Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0). More...
 
 ColorRGBA (float r, float g, float b)
 Constructor, initializes the color to (r, g, b, 1.0). More...
 
 ColorRGBA (float r, float g, float b, float a)
 Constructor, initializes the color to (r, g, b, a). More...
 
const float & operator[] (size_t index) const
 Access to individual elements of the color. More...
 
float & operator[] (size_t index)
 Access to individual elements of the color. More...
 
ColorRGBAoperator*= (float scalar)
 Multiplies each color element with a scalar. More...
 
ColorRGBAoperator/= (float scalar)
 Divides each color element with a scalar. More...
 
ColorRGBAoperator+= (const ColorRGBA &v)
 Modifies this color by adding another color. More...
 
ColorRGBAoperator-= (const ColorRGBA &v)
 Modifies this color by subtracting another color from this color. More...
 
float getRed () const
 Returns the red element of the color. More...
 
float getGreen () const
 Returns the green element of the color. More...
 
float getBlue () const
 Returns the blue element of the color. More...
 
float getAlpha () const
 Returns the alpha element of the color. More...
 
void setRed (float value)
 Sets the red element of the color. More...
 
void setGreen (float value)
 Sets the green element of the color. More...
 
void setBlue (float value)
 Sets the blue element of the color. More...
 
void setAlpha (float value)
 Sets the alpha element of the color. More...
 
bool isNaN () const
 Returns true if and only if at least one of the color values is NaN. More...
 

Static Public Member Functions

static ColorRGBA lowestValue ()
 Returns the color with each element having the most negative float value. More...
 
static ColorRGBA highestValue ()
 Returns the color with each element having the most positive float value. More...
 
static ColorRGBA nan ()
 Returns the color with each element being NaN. More...
 
static ColorRGBA positiveInfinity ()
 Returns the color with each element being the positive infinity. More...
 
static ColorRGBA negativeInfinity ()
 Returns the color with each element being the negative infinity. More...
 
static ColorRGBA opaqueBlack ()
 Returns opaque black color (0.0, 0.0, 0.0, 1.0). More...
 
static ColorRGBA transparentBlack ()
 Returns transparent black color (0.0, 0.0, 0.0, 0.0). More...
 

Detailed Description

Color with 4 floating point components: red, green, blue and alpha (r, g, b, a).

Constructor & Destructor Documentation

kanzi::ColorRGBA::ColorRGBA ( )
inlineexplicit

Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0).

kanzi::ColorRGBA::ColorRGBA ( float  r,
float  g,
float  b 
)
inlineexplicit

Constructor, initializes the color to (r, g, b, 1.0).

Parameters
rRed component of the color.
gGreen component of the color.
bBlue component of the color.
kanzi::ColorRGBA::ColorRGBA ( float  r,
float  g,
float  b,
float  a 
)
inlineexplicit

Constructor, initializes the color to (r, g, b, a).

Parameters
rRed component of the color.
gGreen component of the color.
bBlue component of the color.
aAlpha component of the color.

Member Function Documentation

const float& kanzi::ColorRGBA::operator[] ( size_t  index) const
inline

Access to individual elements of the color.

Parameters
indexIndex of the accessed element. Should be either 0, 1, 2, or 3.
Returns
If index is 0, r element. If index is 1, g element. If index is 2, b element. If index is 3, a element.
float& kanzi::ColorRGBA::operator[] ( size_t  index)
inline

Access to individual elements of the color.

Parameters
indexIndex of the accessed element. Should be either 0, 1, 2, or 3.
Returns
If index is 0, r element. If index is 1, g element. If index is 2, b element. If index is 3, a element.
ColorRGBA& kanzi::ColorRGBA::operator*= ( float  scalar)
inline

Multiplies each color element with a scalar.

Parameters
scalarMultiplier for each color element.
Returns
This color.
ColorRGBA& kanzi::ColorRGBA::operator/= ( float  scalar)
inline

Divides each color element with a scalar.

Parameters
scalarDivider for each color element.
Returns
This color.
ColorRGBA& kanzi::ColorRGBA::operator+= ( const ColorRGBA v)
inline

Modifies this color by adding another color.

Parameters
vAnother color.
Returns
This color.
ColorRGBA& kanzi::ColorRGBA::operator-= ( const ColorRGBA v)
inline

Modifies this color by subtracting another color from this color.

Parameters
vAnother color.
Returns
This color.
float kanzi::ColorRGBA::getRed ( ) const
inline

Returns the red element of the color.

Returns
The red element.
float kanzi::ColorRGBA::getGreen ( ) const
inline

Returns the green element of the color.

Returns
The green element.
float kanzi::ColorRGBA::getBlue ( ) const
inline

Returns the blue element of the color.

Returns
The blue element.
float kanzi::ColorRGBA::getAlpha ( ) const
inline

Returns the alpha element of the color.

Returns
The alpha element.
void kanzi::ColorRGBA::setRed ( float  value)
inline

Sets the red element of the color.

Parameters
valueThe new value of the red element.
void kanzi::ColorRGBA::setGreen ( float  value)
inline

Sets the green element of the color.

Parameters
valueThe new value of the green element.
void kanzi::ColorRGBA::setBlue ( float  value)
inline

Sets the blue element of the color.

Parameters
valueThe new value of the blue element.
void kanzi::ColorRGBA::setAlpha ( float  value)
inline

Sets the alpha element of the color.

Parameters
valueThe new value of the alpha element.
ColorRGBA kanzi::ColorRGBA::lowestValue ( )
inlinestatic

Returns the color with each element having the most negative float value.

Returns
Color with the lowest possible value.
ColorRGBA kanzi::ColorRGBA::highestValue ( )
inlinestatic

Returns the color with each element having the most positive float value.

Returns
Color with the highest possible value.
ColorRGBA kanzi::ColorRGBA::nan ( )
inlinestatic

Returns the color with each element being NaN.

Returns
Color with NaN elements.
bool kanzi::ColorRGBA::isNaN ( ) const
inline

Returns true if and only if at least one of the color values is NaN.

ColorRGBA kanzi::ColorRGBA::positiveInfinity ( )
inlinestatic

Returns the color with each element being the positive infinity.

Returns
Color with positive infinity elements.
ColorRGBA kanzi::ColorRGBA::negativeInfinity ( )
inlinestatic

Returns the color with each element being the negative infinity.

Returns
Color with negative infinity elements.
ColorRGBA kanzi::ColorRGBA::opaqueBlack ( )
inlinestatic

Returns opaque black color (0.0, 0.0, 0.0, 1.0).

Returns
Opaque black.
ColorRGBA kanzi::ColorRGBA::transparentBlack ( )
inlinestatic

Returns transparent black color (0.0, 0.0, 0.0, 0.0).

Returns
Transparent black color.

The documentation for this class was generated from the following file: