RGBA color utility storing normalized floating components.
More...
#include <spk_color.hpp>
|
|
| Color () |
| | Builds an opaque black color.
|
| | Color (int p_value) |
| | Builds a grayscale color from an 8-bit value.
|
| | Color (int p_r, int p_g, int p_b, int p_a=255) |
| | Builds a color from 8-bit per channel components.
|
| | Color (float p_r, float p_g, float p_b, float p_a=1.0f) |
| | Builds a color from normalized floating values.
|
| Color | operator+ (const Color &p_other) const |
| | Adds channel values component-wise.
|
| Color | operator- (const Color &p_other) const |
| | Subtracts channel values component-wise.
|
| bool | operator== (const Color &p_other) const |
| | Equality comparison on every component.
|
| bool | operator!= (const Color &p_other) const |
| | Inequality comparison on every component.
|
| uint32_t | toInt () const |
| | Packs the color into 0xRRGGBBAA integer format.
|
|
|
float | r |
| | Red component in [0,1].
|
|
float | g |
| | Green component in [0,1].
|
|
float | b |
| | Blue component in [0,1].
|
|
float | a |
| | Alpha component in [0,1].
|
|
|
static const Color | red = Color(0xFF0000FF) |
| | Predefined opaque red color.
|
|
static const Color | blue = Color(0x0000FFFF) |
| | Predefined opaque blue color.
|
|
static const Color | green = Color(0x00FF00FF) |
| | Predefined opaque green color.
|
|
static const Color | yellow = Color(0xFFFF00FF) |
| | Predefined opaque yellow color.
|
|
static const Color | purple = Color(0x7F00FFFF) |
| | Predefined opaque purple color.
|
|
static const Color | cyan = Color(0x00FFFFFF) |
| | Predefined opaque cyan color.
|
|
static const Color | orange = Color(0xFF8000FF) |
| | Predefined opaque orange color.
|
|
static const Color | magenta = Color(0xFF007FFF) |
| | Predefined opaque magenta color.
|
|
static const Color | pink = Color(0xFF00FFFF) |
| | Predefined opaque pink color.
|
|
static const Color | black = Color(0x000000FF) |
| | Predefined opaque black color.
|
|
static const Color | white = Color(0xFFFFFFFF) |
| | Predefined opaque white color.
|
|
static const Color | grey = Color(0x7F7F7FFF) |
| | Predefined opaque grey color.
|
|
| std::ostream & | operator<< (std::ostream &p_os, const spk::Color &p_other) |
| | Streams a color to an ASCII output stream.
|
| std::wostream & | operator<< (std::wostream &p_os, const spk::Color &p_other) |
| | Streams a color to a wide-character output stream.
|
RGBA color utility storing normalized floating components.
auto packed = tint.
toInt();
RGBA color utility storing normalized floating components.
Definition spk_color.hpp:18
uint32_t toInt() const
Packs the color into 0xRRGGBBAA integer format.
Definition spk_color.cpp:85
◆ Color() [1/3]
| spk::Color::Color |
( |
int | p_value | ) |
|
Builds a grayscale color from an 8-bit value.
- Parameters
-
| p_value | Channel intensity in [0,255]. |
◆ Color() [2/3]
| spk::Color::Color |
( |
int | p_r, |
|
|
int | p_g, |
|
|
int | p_b, |
|
|
int | p_a = 255 ) |
Builds a color from 8-bit per channel components.
- Parameters
-
| p_r | Red channel in [0,255]. |
| p_g | Green channel in [0,255]. |
| p_b | Blue channel in [0,255]. |
| p_a | Alpha channel in [0,255]. |
◆ Color() [3/3]
| spk::Color::Color |
( |
float | p_r, |
|
|
float | p_g, |
|
|
float | p_b, |
|
|
float | p_a = 1.0f ) |
Builds a color from normalized floating values.
- Parameters
-
| p_r | Red component in [0,1]. |
| p_g | Green component in [0,1]. |
| p_b | Blue component in [0,1]. |
| p_a | Alpha component in [0,1]. |
◆ operator!=()
| bool spk::Color::operator!= |
( |
const Color & | p_other | ) |
const |
Inequality comparison on every component.
- Parameters
-
- Returns
- true when any channel differs.
◆ operator+()
| Color spk::Color::operator+ |
( |
const Color & | p_other | ) |
const |
Adds channel values component-wise.
- Parameters
-
- Returns
- Sum of the two colors.
◆ operator-()
| Color spk::Color::operator- |
( |
const Color & | p_other | ) |
const |
Subtracts channel values component-wise.
- Parameters
-
| p_other | Color to subtract. |
- Returns
- Difference of the two colors.
◆ operator==()
| bool spk::Color::operator== |
( |
const Color & | p_other | ) |
const |
Equality comparison on every component.
- Parameters
-
- Returns
- true when all channels match.
◆ toInt()
| uint32_t spk::Color::toInt |
( |
| ) |
const |
Packs the color into 0xRRGGBBAA integer format.
- Returns
- Packed 32-bit representation.
◆ operator<< [1/2]
| std::ostream & operator<< |
( |
std::ostream & | p_os, |
|
|
const spk::Color & | p_other ) |
|
friend |
Streams a color to an ASCII output stream.
- Parameters
-
| p_os | Output stream receiving the formatted color. |
| p_other | Color to serialize. |
- Returns
- Reference to the updated stream.
◆ operator<< [2/2]
| std::wostream & operator<< |
( |
std::wostream & | p_os, |
|
|
const spk::Color & | p_other ) |
|
friend |
Streams a color to a wide-character output stream.
- Parameters
-
| p_os | Output stream receiving the formatted color. |
| p_other | Color to serialize. |
- Returns
- Reference to the updated stream.
The documentation for this struct was generated from the following files:
- includes/structure/graphics/spk_color.hpp
- srcs/structure/graphics/spk_color.cpp