Last active
June 5, 2016 19:48
-
-
Save XProger/f840849a1070fdc9d930 to your computer and use it in GitHub Desktop.
Fast convert 24-bit color to 16-bit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 24 to 16 | |
unsigned short color = (r & 0xF8) << 8 | (g & 0xFC) << 3 | b >> 3; | |
// 16 to 24 | |
unsigned int color = (c & 0xF800) << 8 | (c & 0x07E0) << 5 | (c & 0x001F) << 3; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
16 to 24 is wrong.