summaryrefslogtreecommitdiff
path: root/libkmstest/color.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkmstest/color.cpp')
-rw-r--r--libkmstest/color.cpp19
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);
}