From 3788242e4fdc57b1421b4721120477ebb2298e52 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Wed, 10 Aug 2016 23:16:39 +0300 Subject: Add BGR888 (BG24) and BGR565 (BG16) pixelformats. Note colorbar does not support 24 bit modes (RGB888 or BGR888) yet. --- kms++util/src/drawing.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'kms++util/src/drawing.cpp') diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp index 157c799..44634e1 100644 --- a/kms++util/src/drawing.cpp +++ b/kms++util/src/drawing.cpp @@ -31,12 +31,26 @@ void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color) p[2] = color.b; break; } + case PixelFormat::BGR888: + { + uint8_t *p = buf.map(0) + buf.stride(0) * y + x * 3; + p[0] = color.b; + p[1] = color.g; + p[2] = color.r; + break; + } case PixelFormat::RGB565: { uint16_t *p = (uint16_t*)(buf.map(0) + buf.stride(0) * y + x * 2); *p = color.rgb565(); break; } + case PixelFormat::BGR565: + { + uint16_t *p = (uint16_t*)(buf.map(0) + buf.stride(0) * y + x * 2); + *p = color.bgr565(); + break; + } default: throw std::invalid_argument("invalid pixelformat"); } @@ -159,7 +173,9 @@ static void draw_char(IMappedFramebuffer& buf, uint32_t xpos, uint32_t ypos, cha case PixelFormat::ARGB8888: case PixelFormat::ABGR8888: case PixelFormat::RGB888: + case PixelFormat::BGR888: case PixelFormat::RGB565: + case PixelFormat::BGR565: for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) { bool b = get_char_pixel(c, x, y); -- cgit v1.2.3