diff options
author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-09-28 01:13:34 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-09-28 01:13:34 +0300 |
commit | 009828beac9bfe9c36d336a4de0d297f90aece52 (patch) | |
tree | 3ea6b22f2036dcc0c23c459ce53bfc2ad282e3e7 /libkms++/utils/color.h |
Initial version
Diffstat (limited to 'libkms++/utils/color.h')
-rw-r--r-- | libkms++/utils/color.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libkms++/utils/color.h b/libkms++/utils/color.h new file mode 100644 index 0000000..1db47e8 --- /dev/null +++ b/libkms++/utils/color.h @@ -0,0 +1,48 @@ +#pragma once + +#include <cstdint> + +namespace kms +{ +struct YUV; + +struct RGB +{ + RGB(); + RGB(uint8_t r, uint8_t g, uint8_t b); + + uint16_t rgb565() const; + YUV yuv() const; + + union { + struct + { + uint8_t b; + uint8_t g; + uint8_t r; + uint8_t a; + }; + + uint32_t raw; + }; +}; + +struct YUV +{ + YUV(); + YUV(uint8_t y, uint8_t u, uint8_t v); + YUV(const RGB& rgb); + + union { + struct + { + uint8_t v; + uint8_t u; + uint8_t y; + uint8_t a; + }; + + uint32_t raw; + }; +}; +} |