diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-03-08 15:27:27 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-03-08 15:42:47 +0200 |
commit | a41cbe24c45975aab44389e7e894582ee2622806 (patch) | |
tree | 2a12638e08a0f64b1714e7792f2cacb07f0b4c81 /libkmstest/color.cpp | |
parent | 3f0a0230676d9d38ec677f88143222ffd70a9f7d (diff) |
libkmstest: color & draw_rect
Diffstat (limited to 'libkmstest/color.cpp')
-rw-r--r-- | libkmstest/color.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libkmstest/color.cpp b/libkmstest/color.cpp index 78012ac..3ad8203 100644 --- a/libkmstest/color.cpp +++ b/libkmstest/color.cpp @@ -9,19 +9,32 @@ RGB::RGB() } RGB::RGB(uint8_t r, uint8_t g, uint8_t b) + :RGB(255, r, g, b) +{ +} + +RGB::RGB(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { this->r = r; this->g = g; this->b = b; - this->a = 255; + this->a = a; +} + +RGB::RGB(uint32_t argb) +{ + this->b = (argb >> 0) & 0xff; + this->g = (argb >> 8) & 0xff; + this->r = (argb >> 16) & 0xff; + this->a = (argb >> 24) & 0xff; } -uint32_t RGB::rgb888() const +uint32_t RGB::argb8888() const { return (a << 24) | (r << 16) | (g << 8) | (b << 0); } -uint32_t RGB::bgr888() const +uint32_t RGB::abgr8888() const { return (a << 24) | (b << 16) | (g << 8) | (r << 0); } |