Represents an RGBA colour.
More...
#include <Colour.hpp>
|
| Colour () noexcept |
| Constructor.
|
|
| Colour (const std::uint8_t r, const std::uint8_t g, const std::uint8_t b, const std::uint8_t a=OPAQUE) noexcept |
| Colour constructor.
|
|
| Colour (Colour &&) noexcept |
| Move constructor.
|
|
| Colour (const Colour &) noexcept |
| Copy constructor.
|
|
Colour & | operator= (Colour &&) noexcept |
| Move assignment operator.
|
|
Colour & | operator= (const Colour &w) noexcept |
| Copy assignment operator.
|
|
| ~Colour () noexcept |
| Destructor.
|
|
void | r (const std::uint8_t r) noexcept |
| Red.
|
|
void | g (const std::uint8_t g) noexcept |
| Green.
|
|
void | b (const std::uint8_t b) noexcept |
| Blue.
|
|
void | a (const std::uint8_t a) noexcept |
| Alpha.
|
|
std::uint8_t | r () const noexcept |
| Get red.
|
|
std::uint8_t | g () const noexcept |
| Get green.
|
|
std::uint8_t | b () const noexcept |
| Get blue.
|
|
std::uint8_t | a () const noexcept |
| Get alpha.
|
|
void | set_from_norm (const glm::vec4 &rgba) noexcept |
| Set RGBA from normalizaed values.
|
|
glm::vec4 | normalize () noexcept |
| Get normalized rgba vec4.
|
|
std::array< std::uint8_t, 4 > | array () noexcept |
| Get as array.
|
|
auto | operator<=> (const Colour &) const =default |
| Three-way comparison.
|
|
bool | operator== (const Colour &) const =default |
| Equality comparison.
|
|
bool | operator!= (const Colour &) const =default |
| Inequality comparison.
|
|
bool | operator< (const Colour &) const =default |
| Less than comparison.
|
|
bool | operator> (const Colour &) const =default |
| Greater than comparison.
|
|
bool | operator<= (const Colour &) const =default |
| Less than or equal comparison.
|
|
bool | operator>= (const Colour &) const =default |
| Greater than or equal comparison.
|
|
|
static const constexpr std::uint8_t | OPAQUE = 255 |
| Opaque colour.
|
|
static const constexpr std::uint8_t | TRANSPARENT = 0 |
| Transparent colour.
|
|
static const constexpr std::uint8_t | OFFSET = 0xFF |
| Colour offsets for normalization.
|
|
static const constexpr std::uint8_t | LOWER = 0 |
| Colour lower bounds.
|
|
static const constexpr std::uint8_t | UPPER = 255 |
| Colour upper bounds.
|
|
|
std::uint8_t | m_red |
| Red channel.
|
|
std::uint8_t | m_green |
| Green channel.
|
|
std::uint8_t | m_blue |
| Blue channel.
|
|
std::uint8_t | m_alpha |
| Alpha channel.
|
|
Represents an RGBA colour.
Definition at line 23 of file Colour.hpp.
◆ Colour() [1/4]
galaxy::Colour::Colour |
( |
| ) |
|
|
noexcept |
◆ Colour() [2/4]
galaxy::Colour::Colour |
( |
const std::uint8_t | r, |
|
|
const std::uint8_t | g, |
|
|
const std::uint8_t | b, |
|
|
const std::uint8_t | a = OPAQUE ) |
|
noexcept |
Colour constructor.
- Parameters
-
r | Red. 0 - 255. |
g | Green. 0 - 255. |
b | Blue. 0 - 255. |
a | Alpha. 0 - 255. |
Definition at line 24 of file Colour.cpp.
◆ Colour() [3/4]
galaxy::Colour::Colour |
( |
Colour && | c | ) |
|
|
noexcept |
◆ Colour() [4/4]
galaxy::Colour::Colour |
( |
const Colour & | c | ) |
|
|
noexcept |
◆ ~Colour()
galaxy::Colour::~Colour |
( |
| ) |
|
|
noexcept |
◆ operator=() [1/2]
Move assignment operator.
Definition at line 48 of file Colour.cpp.
◆ operator=() [2/2]
Copy assignment operator.
Definition at line 61 of file Colour.cpp.
◆ r() [1/2]
void galaxy::Colour::r |
( |
const std::uint8_t | r | ) |
|
|
noexcept |
◆ g() [1/2]
void galaxy::Colour::g |
( |
const std::uint8_t | g | ) |
|
|
noexcept |
◆ b() [1/2]
void galaxy::Colour::b |
( |
const std::uint8_t | b | ) |
|
|
noexcept |
◆ a() [1/2]
void galaxy::Colour::a |
( |
const std::uint8_t | a | ) |
|
|
noexcept |
◆ r() [2/2]
std::uint8_t galaxy::Colour::r |
( |
| ) |
const |
|
noexcept |
Get red.
- Returns
- Int in 0 - 255 range.
Definition at line 98 of file Colour.cpp.
◆ g() [2/2]
std::uint8_t galaxy::Colour::g |
( |
| ) |
const |
|
noexcept |
Get green.
- Returns
- Int in 0 - 255 range.
Definition at line 103 of file Colour.cpp.
◆ b() [2/2]
std::uint8_t galaxy::Colour::b |
( |
| ) |
const |
|
noexcept |
Get blue.
- Returns
- Int in 0 - 255 range.
Definition at line 108 of file Colour.cpp.
◆ a() [2/2]
std::uint8_t galaxy::Colour::a |
( |
| ) |
const |
|
noexcept |
Get alpha.
- Returns
- Int in 0 - 255 range.
Definition at line 113 of file Colour.cpp.
◆ set_from_norm()
void galaxy::Colour::set_from_norm |
( |
const glm::vec4 & | rgba | ) |
|
|
noexcept |
Set RGBA from normalizaed values.
- Parameters
-
rgba | Clamps from 0.0f to 1.0f. |
Definition at line 118 of file Colour.cpp.
◆ normalize()
glm::vec4 galaxy::Colour::normalize |
( |
| ) |
|
|
nodiscardnoexcept |
Get normalized rgba vec4.
- Returns
- Vec4 normalized to 0.0f - 1.0f.
Definition at line 126 of file Colour.cpp.
◆ array()
std::array< std::uint8_t, 4 > galaxy::Colour::array |
( |
| ) |
|
|
nodiscardnoexcept |
Get as array.
- Returns
- 0=red, 1=green, 2=blue, 3=alpha
Definition at line 138 of file Colour.cpp.
◆ operator<=>()
auto galaxy::Colour::operator<=> |
( |
const Colour & | | ) |
const |
|
default |
◆ operator==()
bool galaxy::Colour::operator== |
( |
const Colour & | | ) |
const |
|
default |
◆ operator!=()
bool galaxy::Colour::operator!= |
( |
const Colour & | | ) |
const |
|
default |
◆ operator<()
bool galaxy::Colour::operator< |
( |
const Colour & | | ) |
const |
|
default |
◆ operator>()
bool galaxy::Colour::operator> |
( |
const Colour & | | ) |
const |
|
default |
◆ operator<=()
bool galaxy::Colour::operator<= |
( |
const Colour & | | ) |
const |
|
default |
Less than or equal comparison.
◆ operator>=()
bool galaxy::Colour::operator>= |
( |
const Colour & | | ) |
const |
|
default |
Greater than or equal comparison.
◆ OPAQUE
const constexpr std::uint8_t galaxy::Colour::OPAQUE = 255 |
|
inlinestaticconstexpr |
◆ TRANSPARENT
const constexpr std::uint8_t galaxy::Colour::TRANSPARENT = 0 |
|
inlinestaticconstexpr |
Transparent colour.
Definition at line 34 of file Colour.hpp.
◆ OFFSET
const constexpr std::uint8_t galaxy::Colour::OFFSET = 0xFF |
|
inlinestaticconstexpr |
◆ LOWER
const constexpr std::uint8_t galaxy::Colour::LOWER = 0 |
|
inlinestaticconstexpr |
◆ UPPER
const constexpr std::uint8_t galaxy::Colour::UPPER = 255 |
|
inlinestaticconstexpr |
◆ m_red
std::uint8_t galaxy::Colour::m_red |
|
private |
◆ m_green
std::uint8_t galaxy::Colour::m_green |
|
private |
◆ m_blue
std::uint8_t galaxy::Colour::m_blue |
|
private |
◆ m_alpha
std::uint8_t galaxy::Colour::m_alpha |
|
private |
The documentation for this class was generated from the following files: