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.
This is a discussion on Extracting COLORREF within the Windows Programming forums, part of the Platform Specific Boards category; How can I convert a COLORREF varible to three integers (int r, g, b ? I have been stumped about ...
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 enoughWhen specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:
0x00bbggrr
g = (cr >> 8) & 0xFF;
or as suggested in the MSDN
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.
If I have eight hours for cutting wood, I spend six sharpening my axe.