Color with 4 floating point components: red, green, blue and alpha (r, g, b, a).
More...
#include <kanzi/core/math/color_rgba.hpp>
|
| ColorRGBA () |
| Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0). More...
|
|
| ColorRGBA (float v) |
| Constructor, initializes the color to (v, v, v, v). 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...
|
|
float | getAlpha () const |
| Returns the alpha element of the color. More...
|
|
float | getBlue () const |
| Returns the blue element of the color. More...
|
|
float | getGreen () const |
| Returns the green element of the color. More...
|
|
float | getRed () const |
| Returns the red element of the color. More...
|
|
bool | hasNan () const |
| Returns true if and only if at least one of the vector values is NaN. More...
|
|
ColorRGBA & | operator*= (float scalar) |
| Multiplies each color element with a scalar. More...
|
|
ColorRGBA & | operator+= (float scalar) |
| Adds a scalar to each color element. More...
|
|
ColorRGBA & | operator+= (const ColorRGBA &v) |
| Modifies this color by adding another color. More...
|
|
ColorRGBA & | operator-= (const ColorRGBA &v) |
| Modifies this color by subtracting another color from this color. More...
|
|
ColorRGBA & | operator/= (float scalar) |
| Divides each color element with a scalar. 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...
|
|
void | setAlpha (float value) |
| Sets the alpha element of the color. More...
|
|
void | setBlue (float value) |
| Sets the blue element of the color. More...
|
|
void | setGreen (float value) |
| Sets the green element of the color. More...
|
|
void | setRed (float value) |
| Sets the red element of the color. More...
|
|
|
static KZ_NO_DISCARD ColorRGBA | fromSRGB (float r, float g, float b, float a) |
| Returns a linear color with each element set from a sRGB value. More...
|
|
static KZ_NO_DISCARD ColorRGBA | fromSRGB (float r, float g, float b) |
| Returns a linear color with each element set from a sRGB value. More...
|
|
static ColorRGBA | highestValue () |
| Returns the color with each element having the most positive float value. More...
|
|
static ColorRGBA | lowestValue () |
| Returns the color with each element having the most negative float value. More...
|
|
static ColorRGBA | nan () |
| Returns the color with each element being NaN. More...
|
|
static ColorRGBA | negativeInfinity () |
| Returns the color with each element being the negative infinity. More...
|
|
static KZ_NO_DISCARD const ColorRGBA | one () |
| Returns the color with each element being one. More...
|
|
static ColorRGBA | opaqueBlack () |
| Returns opaque black color (0.0, 0.0, 0.0, 1.0). More...
|
|
static ColorRGBA | positiveInfinity () |
| Returns the color with each element being the positive infinity. More...
|
|
static ColorRGBA | transparentBlack () |
| Returns transparent black color (0.0, 0.0, 0.0, 0.0). More...
|
|
static KZ_NO_DISCARD const ColorRGBA | zero () |
| Returns the color with each element being zero. More...
|
|
Color with 4 floating point components: red, green, blue and alpha (r, g, b, a).
kanzi::ColorRGBA::ColorRGBA |
( |
| ) |
|
|
inlineexplicit |
Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0).
kanzi::ColorRGBA::ColorRGBA |
( |
float |
v | ) |
|
|
inlineexplicit |
Constructor, initializes the color to (v, v, v, v).
- Parameters
-
v | Red, Green, Blue, and Alpha component of the color. |
kanzi::ColorRGBA::ColorRGBA |
( |
float |
r, |
|
|
float |
g, |
|
|
float |
b |
|
) |
| |
|
inlineexplicit |
Constructor, initializes the color to (r, g, b, 1.0).
- Parameters
-
r | Red component of the color. |
g | Green component of the color. |
b | Blue 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
-
r | Red component of the color. |
g | Green component of the color. |
b | Blue component of the color. |
a | Alpha component of the color. |
const float& kanzi::ColorRGBA::operator[] |
( |
size_t |
index | ) |
const |
|
inline |
Access to individual elements of the color.
- Parameters
-
index | Index 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
-
index | Index 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
-
scalar | Multiplier for each color element. |
- Returns
- This color.
ColorRGBA& kanzi::ColorRGBA::operator/= |
( |
float |
scalar | ) |
|
|
inline |
Divides each color element with a scalar.
- Parameters
-
scalar | Divider for each color element. |
- Returns
- This color.
ColorRGBA& kanzi::ColorRGBA::operator+= |
( |
float |
scalar | ) |
|
|
inline |
Adds a scalar to each color element.
- Parameters
-
- Returns
- This color.
Modifies this color by adding another color.
- Parameters
-
- Returns
- This color.
Modifies this color by subtracting another color from this color.
- Parameters
-
- Returns
- This color.
Returns the color with each element being zero.
- Returns
- Color with zeroed elements.
Returns the color with each element being one.
- Returns
- Color with unit element values.
Returns a linear color with each element set from a sRGB value.
- Parameters
-
r | Red Channel (0-1.0) |
g | Green Channel (0-1.0) |
b | Blue Channel (0-1.0) |
a | Alpha Channel (0-1.0) |
- Returns
- Color in linear color space.
Returns a linear color with each element set from a sRGB value.
- Parameters
-
r | Red Channel (0-1.0) |
g | Green Channel (0-1.0) |
b | Blue Channel (0-1.0) |
- Returns
- Color in linear color space.
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
-
value | The new value of the red element. |
void kanzi::ColorRGBA::setGreen |
( |
float |
value | ) |
|
|
inline |
Sets the green element of the color.
- Parameters
-
value | The new value of the green element. |
void kanzi::ColorRGBA::setBlue |
( |
float |
value | ) |
|
|
inline |
Sets the blue element of the color.
- Parameters
-
value | The new value of the blue element. |
void kanzi::ColorRGBA::setAlpha |
( |
float |
value | ) |
|
|
inline |
Sets the alpha element of the color.
- Parameters
-
value | The new value of the alpha element. |
Returns the color with each element having the most negative float value.
- Returns
- Color with the lowest possible value.
Returns the color with each element having the most positive float value.
- Returns
- Color with the highest possible value.
Returns the color with each element being NaN.
- Returns
- Color with NaN elements.
bool kanzi::ColorRGBA::hasNan |
( |
| ) |
const |
|
inline |
Returns true if and only if at least one of the vector 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.
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: