summaryrefslogtreecommitdiff
path: root/kms++util/src/color.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-06 03:32:42 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-06 05:09:16 +0300
commit41ffb17e22fba40b43575dbf1a516067878ed9e5 (patch)
tree4943b47173f9999a5c90a0f4b12edd21cef9ee62 /kms++util/src/color.cpp
parentd29a12e5d9473d9b37b817db57d29ee2b886aac8 (diff)
kms++: Add support for missing 8 -and 16-bit RGB formats
Add support for the RGB332, XRGB1555 and XRGB4444 formats to the PixelFormat class, the Python API, and the drawing utilities. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'kms++util/src/color.cpp')
-rw-r--r--kms++util/src/color.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/kms++util/src/color.cpp b/kms++util/src/color.cpp
index 80e4866..2d45eff 100644
--- a/kms++util/src/color.cpp
+++ b/kms++util/src/color.cpp
@@ -79,6 +79,11 @@ uint32_t RGB::bgra1010102() const
return (b << 24) | (g << 14) | (r << 4) | (a >> 6);
}
+uint8_t RGB::rgb332() const
+{
+ return ((r >> 5) << 5) | ((g >> 5) << 2) | ((b >> 6) << 0);
+}
+
uint16_t RGB::rgb565() const
{
return ((r >> 3) << 11) | ((g >> 2) << 5) | ((b >> 3) << 0);