How do I convert the hex color code to rgb color using c++?
Anonymous:
___k off
Answers
Answered by
1
.
int rgb;
StrToIntEx(L"0x0000FF", STIF_SUPPORT_HEX, &rgb);
COLORREF clr = (((rgb & 0x000000FF) << 16) | (rgb & 0x0000FF00) | ((rgb & 0x00FF0000) >> 16));
// Test R, G, B
BYTE nRed = GetRValue(clr);
BYTE nGreen = GetGValue(clr);
BYTE nBlue = GetBValue(clr);
Answered by
0
Answer:
I actually don't know the answer but I think that it would be like this:
COLORREF clr = (((rgb & 0x000000FF) << 16) | (rgb & 0x0000FF00) | ((rgb & 0x00FF0000) >> 16))
Explanation:
Don't know whether its correct or not but did try it out! Hope that it would be the correct answer to your query!
Similar questions