diff options
Diffstat (limited to 'src/colour.cc')
| -rw-r--r-- | src/colour.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/colour.cc b/src/colour.cc new file mode 100644 index 0000000..e9df340 --- /dev/null +++ b/src/colour.cc @@ -0,0 +1,15 @@ +#include "colour.hh" + +#include <cstdint> + +Colour::Colour() : argb(0) {} + +Colour::Colour(uint32_t argb) : argb(argb) {} + +Colour::Colour(uint8_t r, uint8_t g, uint8_t b) + : argb(0xff000000 | (static_cast<uint32_t>(r) << 16) | + (static_cast<uint32_t>(g) << 8) | b) {} + +Colour::Colour(uint8_t a, uint8_t r, uint8_t g, uint8_t b) + : argb((static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(r) << 16) | + (static_cast<uint32_t>(g) << 8) | b) {} |
