From 6f6fe27ac6a49d7570a11ceccaa122dd01c27828 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 17 Mar 2016 18:47:31 +0200 Subject: Add RGB::rgb888() --- libkmstest/color.cpp | 5 +++++ libkmstest/color.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libkmstest/color.cpp b/libkmstest/color.cpp index 3ad8203..490ff64 100644 --- a/libkmstest/color.cpp +++ b/libkmstest/color.cpp @@ -29,6 +29,11 @@ RGB::RGB(uint32_t argb) this->a = (argb >> 24) & 0xff; } +uint32_t RGB::rgb888() const +{ + return (r << 16) | (g << 8) | (b << 0); +} + uint32_t RGB::argb8888() const { return (a << 24) | (r << 16) | (g << 8) | (b << 0); diff --git a/libkmstest/color.h b/libkmstest/color.h index f99a951..ef85a67 100644 --- a/libkmstest/color.h +++ b/libkmstest/color.h @@ -13,6 +13,7 @@ struct RGB RGB(uint8_t a, uint8_t r, uint8_t g, uint8_t b); RGB(uint32_t argb); + uint32_t rgb888() const; uint32_t argb8888() const; uint32_t abgr8888() const; uint16_t rgb565() const; -- cgit v1.2.3