mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Changed RgbImage to template based Image (with template for pixel type)
Former-commit-id: ef02f164eaf3c2f9dd552c1c17b525cf6eed499c
This commit is contained in:
52
include/utils/ColorArgb.h
Normal file
52
include/utils/ColorArgb.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
// STL includes
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
|
||||
struct ColorArgb;
|
||||
|
||||
struct ColorArgb
|
||||
{
|
||||
|
||||
/// The alpha mask channel
|
||||
uint8_t alpha;
|
||||
|
||||
/// The red color channel
|
||||
uint8_t red;
|
||||
/// The green color channel
|
||||
uint8_t green;
|
||||
/// The blue color channel
|
||||
uint8_t blue;
|
||||
|
||||
/// 'Black' RgbColor (255, 0, 0, 0)
|
||||
static ColorArgb BLACK;
|
||||
/// 'Red' RgbColor (255, 255, 0, 0)
|
||||
static ColorArgb RED;
|
||||
/// 'Green' RgbColor (255, 0, 255, 0)
|
||||
static ColorArgb GREEN;
|
||||
/// 'Blue' RgbColor (255, 0, 0, 255)
|
||||
static ColorArgb BLUE;
|
||||
/// 'Yellow' RgbColor (255, 255, 255, 0)
|
||||
static ColorArgb YELLOW;
|
||||
/// 'White' RgbColor (255, 255, 255, 255)
|
||||
static ColorArgb WHITE;
|
||||
};
|
||||
|
||||
|
||||
/// Assert to ensure that the size of the structure is 'only' 3 bytes
|
||||
static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB");
|
||||
|
||||
///
|
||||
/// Stream operator to write ColorRgb to an outputstream (format "'{'[alpha]', '[red]','[green]','[blue]'}'")
|
||||
///
|
||||
/// @param os The output stream
|
||||
/// @param color The color to write
|
||||
/// @return The output stream (with the color written to it)
|
||||
///
|
||||
inline std::ostream& operator<<(std::ostream& os, const ColorArgb& color)
|
||||
{
|
||||
os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
return os;
|
||||
}
|
||||
|
Reference in New Issue
Block a user