mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor color utils (#955)
Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
struct ColorRgba
|
||||
{
|
||||
|
||||
/// The red color channel
|
||||
uint8_t red;
|
||||
/// The green color channel
|
||||
@@ -18,20 +17,19 @@ struct ColorRgba
|
||||
uint8_t alpha;
|
||||
|
||||
/// 'Black' RgbColor (0, 0, 0, 255)
|
||||
static ColorRgba BLACK;
|
||||
static const ColorRgba BLACK;
|
||||
/// 'Red' RgbColor (255, 0, 0, 255)
|
||||
static ColorRgba RED;
|
||||
static const ColorRgba RED;
|
||||
/// 'Green' RgbColor (0, 255, 0, 255)
|
||||
static ColorRgba GREEN;
|
||||
static const ColorRgba GREEN;
|
||||
/// 'Blue' RgbColor (0, 0, 255, 255)
|
||||
static ColorRgba BLUE;
|
||||
static const ColorRgba BLUE;
|
||||
/// 'Yellow' RgbColor (255, 255, 0, 255)
|
||||
static ColorRgba YELLOW;
|
||||
static const ColorRgba YELLOW;
|
||||
/// 'White' RgbColor (255, 255, 255, 255
|
||||
static ColorRgba WHITE;
|
||||
static const ColorRgba WHITE;
|
||||
};
|
||||
|
||||
|
||||
/// Assert to ensure that the size of the structure is 'only' 3 bytes
|
||||
static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB");
|
||||
|
||||
@@ -44,6 +42,12 @@ static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB");
|
||||
///
|
||||
inline std::ostream& operator<<(std::ostream& os, const ColorRgba& color)
|
||||
{
|
||||
os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
os << "{"
|
||||
<< color.alpha << ","
|
||||
<< color.red << ","
|
||||
<< color.green << ","
|
||||
<< color.blue
|
||||
<< "}";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
Reference in New Issue
Block a user