How can I convert a COLORREF varible to three integers (int r, g, b;)? I have been stumped about this for a very long time, thanks for any help, Queatrix.
Printable View
How can I convert a COLORREF varible to three integers (int r, g, b;)? I have been stumped about this for a very long time, thanks for any help, Queatrix.
So just bitshifting and masking would be enoughQuote:
When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:
0x00bbggrr
g = (cr >> 8) & 0xFF;
or as suggested in the MSDN
Quote:
To create a COLORREF color value, use the RGB macro. To extract the individual values for the red, green, and blue components of a color value, use the GetRValue, GetGValue, and GetBValue macros, respectively.
Thanks, thats what I needed.