Created
August 8, 2017 09:27
-
-
Save PaulChana/65483a19d6125182ed7b965a35ea2e70 to your computer and use it in GitHub Desktop.
Pack and unpack ARGB
This file contains hidden or 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
int pack (int a, int r, int g, int b) | |
{ | |
return a << 24 + r << 16 + g<< 8 + b; | |
} | |
void unpack (int& a, int& r, int& g, int& b, const int argb) | |
{ | |
a = (argb >> 24) & 0xFF; | |
r = (argb >> 16) & 0xFF; | |
g = (argb >> 8) & 0xFF; | |
b = (argb) & 0xFF; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment