44 Color(
int p_r,
int p_g,
int p_b,
int p_a = 255);
52 Color(
float p_r,
float p_g,
float p_b,
float p_a = 1.0f);
83 uint32_t
toInt()
const;
140 struct hash<spk::Color>
149 size_t h1 = std::hash<float>{}(p_color.
r);
150 size_t h2 = std::hash<float>{}(p_color.
g);
151 size_t h3 = std::hash<float>{}(p_color.
b);
152 size_t h4 = std::hash<float>{}(p_color.
a);
154 seed ^= h2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
155 seed ^= h3 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
156 seed ^= h4 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
RGBA color utility storing normalized floating components.
Definition spk_color.hpp:18
float a
Alpha component in [0,1].
Definition spk_color.hpp:26
static const Color green
Predefined opaque green color.
Definition spk_color.hpp:105
static const Color blue
Predefined opaque blue color.
Definition spk_color.hpp:103
static const Color purple
Predefined opaque purple color.
Definition spk_color.hpp:109
Color operator+(const Color &p_other) const
Adds channel values component-wise.
Definition spk_color.cpp:51
static const Color white
Predefined opaque white color.
Definition spk_color.hpp:121
uint32_t toInt() const
Packs the color into 0xRRGGBBAA integer format.
Definition spk_color.cpp:85
float b
Blue component in [0,1].
Definition spk_color.hpp:24
static const Color orange
Predefined opaque orange color.
Definition spk_color.hpp:113
static const Color red
Predefined opaque red color.
Definition spk_color.hpp:101
static const Color black
Predefined opaque black color.
Definition spk_color.hpp:119
static const Color cyan
Predefined opaque cyan color.
Definition spk_color.hpp:111
friend std::ostream & operator<<(std::ostream &p_os, const spk::Color &p_other)
Streams a color to an ASCII output stream.
Definition spk_color.cpp:90
static const Color magenta
Predefined opaque magenta color.
Definition spk_color.hpp:115
float g
Green component in [0,1].
Definition spk_color.hpp:22
bool operator==(const Color &p_other) const
Equality comparison on every component.
Definition spk_color.cpp:73
static const Color grey
Predefined opaque grey color.
Definition spk_color.hpp:123
Color operator-(const Color &p_other) const
Subtracts channel values component-wise.
Definition spk_color.cpp:62
float r
Red component in [0,1].
Definition spk_color.hpp:20
bool operator!=(const Color &p_other) const
Inequality comparison on every component.
Definition spk_color.cpp:80
Color()
Builds an opaque black color.
Definition spk_color.cpp:22
static const Color yellow
Predefined opaque yellow color.
Definition spk_color.hpp:107
static const Color pink
Predefined opaque pink color.
Definition spk_color.hpp:117
size_t operator()(const spk::Color &p_color) const
Hashes a color using its four components.
Definition spk_color.hpp:147