Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RA8875 by
Diff: GraphicsDisplay.cpp
- Revision:
- 93:6fbc516de05e
- Parent:
- 79:544eb4964795
- Child:
- 95:ef538bd687c0
--- a/GraphicsDisplay.cpp Sun Feb 01 17:07:13 2015 +0000
+++ b/GraphicsDisplay.cpp Sun Feb 01 18:50:57 2015 +0000
@@ -343,15 +343,22 @@
return c;
}
-/// RRRR RGGG GGGB BBBB
+// RGB16 little endian
+// GGGB BBBB RRRR RGGG
+// swap
+// RRRR RGGG GGGB BBBB
+// RRRR R
+// extend to BMP Color Palette is BGRx
+// BBBB BBBB GGGG GGGG RRRR RRRR 0000 0000
RGBQUAD GraphicsDisplay::RGB16ToRGBQuad(color_t c)
{
RGBQUAD q;
memset(&q, 0, sizeof(q));
+ c = (c << 8) | (c >> 8); // swap
q.rgbBlue = ((c & 0x001F) << 3) | (c & 0x07); /* Blue value */
- q.rgbGreen = ((c & 0x07E0) >> 3) | ((c >> 7) & 0x03); /* Green value */
- q.rgbRed = ((c & 0xF800) >> 8) | ((c >> 11) & 0x07); /* Red value */
+ q.rgbGreen = ((c & 0x07E0) >> 3) | ((c >> 9) & 0x03); /* Green value */
+ q.rgbRed = ((c & 0xF800) >> 8) | ((c >> 13) & 0x07); /* Red value */
q.rgbReserved = 0;
return q;
}
