Represents an RGBA colour.
More...
#include <Colour.hpp>
|
| Colour () |
| Constructor.
|
|
| Colour (Colour &&) |
| Move constructor.
|
|
| Colour (const Colour &) |
| Copy constructor.
|
|
Colour & | operator= (Colour &&) |
| Move assignment operator.
|
|
Colour & | operator= (const Colour &) |
| Copy assignment operator.
|
|
| ~Colour () |
| Destructor.
|
|
void | set_r (const std::uint8_t r) |
| Red.
|
|
void | set_g (const std::uint8_t g) |
| Green.
|
|
void | set_b (const std::uint8_t b) |
| Blue.
|
|
void | set_a (const std::uint8_t a) |
| Alpha.
|
|
template<typename R >
requires std::is_same_v<std::uint8_t, R> || std::is_same_v<float, R> |
R | r () const |
| Get red.
|
|
template<typename G >
requires std::is_same_v<std::uint8_t, G> || std::is_same_v<float, G> |
G | g () const |
| Get green.
|
|
template<typename B >
requires std::is_same_v<std::uint8_t, B> || std::is_same_v<float, B> |
B | b () const |
| Get blue.
|
|
template<typename A >
requires std::is_same_v<std::uint8_t, A> || std::is_same_v<float, A> |
A | a () const |
| Get alpha.
|
|
void | set_rgba (const glm::vec4 &rgba) |
| Set RGBA.
|
|
std::array< std::uint8_t, 4 > & | array () |
| Get integer array.
|
|
glm::vec4 & | vec4 () |
| Get vec4.
|
|
const std::array< std::uint8_t, 4 > & | array () const |
| Get const integer array.
|
|
const glm::vec4 & | vec4 () const |
| Get const vec4.
|
|
auto | operator<=> (const Colour &) const =default |
| Comparison operator.
|
|
template<> |
float | r () const |
|
template<> |
std::uint8_t | r () const |
|
template<> |
float | g () const |
|
template<> |
std::uint8_t | g () const |
|
template<> |
float | b () const |
|
template<> |
std::uint8_t | b () const |
|
template<> |
float | a () const |
|
template<> |
std::uint8_t | a () const |
|
|
static const constexpr std::uint8_t | OPAQUE = 255 |
| Opaque colour.
|
|
static const constexpr std::uint8_t | TRANSPARENT = 0 |
| Transparent colour.
|
|
|
std::array< std::uint8_t, 4 > | m_array |
| r,g,b,a = 0,1,2,3.
|
|
glm::vec4 | m_vec4 |
| r,g,b,a = x,y,z,w.
|
|
Represents an RGBA colour.
Definition at line 26 of file Colour.hpp.
◆ Colour() [1/3]
galaxy::graphics::Colour::Colour |
( |
| ) |
|
◆ Colour() [2/3]
galaxy::graphics::Colour::Colour |
( |
Colour && | c | ) |
|
◆ Colour() [3/3]
galaxy::graphics::Colour::Colour |
( |
const Colour & | c | ) |
|
◆ ~Colour()
galaxy::graphics::Colour::~Colour |
( |
| ) |
|
◆ operator=() [1/2]
Move assignment operator.
Definition at line 42 of file Colour.cpp.
◆ operator=() [2/2]
Colour & galaxy::graphics::Colour::operator= |
( |
const Colour & | c | ) |
|
Copy assignment operator.
Definition at line 53 of file Colour.cpp.
◆ set_r()
void galaxy::graphics::Colour::set_r |
( |
const std::uint8_t | r | ) |
|
◆ set_g()
void galaxy::graphics::Colour::set_g |
( |
const std::uint8_t | g | ) |
|
◆ set_b()
void galaxy::graphics::Colour::set_b |
( |
const std::uint8_t | b | ) |
|
◆ set_a()
void galaxy::graphics::Colour::set_a |
( |
const std::uint8_t | a | ) |
|
◆ r() [1/3]
template<typename R >
requires std::is_same_v<std::uint8_t, R> || std::is_same_v<float, R>
R galaxy::graphics::Colour::r |
( |
| ) |
const |
Get red.
- Template Parameters
-
R | Determines return value. |
- Returns
- Int for 0 - 255, Float for 0 - 1.
◆ g() [1/3]
template<typename G >
requires std::is_same_v<std::uint8_t, G> || std::is_same_v<float, G>
G galaxy::graphics::Colour::g |
( |
| ) |
const |
Get green.
- Template Parameters
-
G | Determines return value. |
- Returns
- Int for 0 - 255, Float for 0 - 1.
◆ b() [1/3]
template<typename B >
requires std::is_same_v<std::uint8_t, B> || std::is_same_v<float, B>
B galaxy::graphics::Colour::b |
( |
| ) |
const |
Get blue.
- Template Parameters
-
B | Determines return value. |
- Returns
- Int for 0 - 255, Float for 0 - 1.
◆ a() [1/3]
template<typename A >
requires std::is_same_v<std::uint8_t, A> || std::is_same_v<float, A>
A galaxy::graphics::Colour::a |
( |
| ) |
const |
Get alpha.
- Template Parameters
-
A | Determines return value. |
- Returns
- Int for 0 - 255, Float for 0 - 1.
◆ set_rgba()
void galaxy::graphics::Colour::set_rgba |
( |
const glm::vec4 & | rgba | ) |
|
◆ array() [1/2]
std::array< std::uint8_t, 4 > & galaxy::graphics::Colour::array |
( |
| ) |
|
|
nodiscard |
Get integer array.
- Returns
- Integers 0 - 255.
Definition at line 155 of file Colour.cpp.
◆ vec4() [1/2]
glm::vec4 & galaxy::graphics::Colour::vec4 |
( |
| ) |
|
|
nodiscard |
Get vec4.
- Returns
- Floats 0 - 1.
Definition at line 160 of file Colour.cpp.
◆ array() [2/2]
const std::array< std::uint8_t, 4 > & galaxy::graphics::Colour::array |
( |
| ) |
const |
|
nodiscard |
Get const integer array.
- Returns
- Integers 0 - 255.
Definition at line 165 of file Colour.cpp.
◆ vec4() [2/2]
const glm::vec4 & galaxy::graphics::Colour::vec4 |
( |
| ) |
const |
|
nodiscard |
Get const vec4.
- Returns
- Floats 0 - 1.
Definition at line 170 of file Colour.cpp.
◆ operator<=>()
auto galaxy::graphics::Colour::operator<=> |
( |
const Colour & | | ) |
const |
|
nodiscarddefault |
◆ r() [2/3]
template<>
float galaxy::graphics::Colour::r |
( |
| ) |
const |
|
inline |
◆ r() [3/3]
template<>
std::uint8_t galaxy::graphics::Colour::r |
( |
| ) |
const |
|
inline |
◆ g() [2/3]
template<>
float galaxy::graphics::Colour::g |
( |
| ) |
const |
|
inline |
◆ g() [3/3]
template<>
std::uint8_t galaxy::graphics::Colour::g |
( |
| ) |
const |
|
inline |
◆ b() [2/3]
template<>
float galaxy::graphics::Colour::b |
( |
| ) |
const |
|
inline |
◆ b() [3/3]
template<>
std::uint8_t galaxy::graphics::Colour::b |
( |
| ) |
const |
|
inline |
◆ a() [2/3]
template<>
float galaxy::graphics::Colour::a |
( |
| ) |
const |
|
inline |
◆ a() [3/3]
template<>
std::uint8_t galaxy::graphics::Colour::a |
( |
| ) |
const |
|
inline |
◆ OPAQUE
const constexpr std::uint8_t galaxy::graphics::Colour::OPAQUE = 255 |
|
inlinestaticconstexpr |
◆ TRANSPARENT
const constexpr std::uint8_t galaxy::graphics::Colour::TRANSPARENT = 0 |
|
inlinestaticconstexpr |
Transparent colour.
Definition at line 37 of file Colour.hpp.
◆ m_array
std::array<std::uint8_t, 4> galaxy::graphics::Colour::m_array |
|
private |
◆ m_vec4
glm::vec4 galaxy::graphics::Colour::m_vec4 |
|
private |
The documentation for this class was generated from the following files: