typedef union
{
unsigned Color;
struct
{
unsigned char B, G, R, A;
};
} RGB, *PRGB;
inline RGB Rgb(int R, int G, int B) {RGB Result = {((COLORREF)((BYTE)(R)|((BYTE)(G) << 8)|((BYTE)(B) << 16)))}; return Result;}
inline RGB Rgb(COLORREF Color) {RGB Result = {Color}; return Result;}
The above is my code for an RBG Data structure. I populate it like so:
PRGB Pixels = new RGB[100];
CreateDIBitmap(DC, &Info.bmiHeader, CBM_INIT, Pixels, &Info, DIB_RGB_COLORS); //Populates Pixels with colours..
The problem is that if I do: cout<<Pixels[0].Color;
It prints the wrong Colours.. but if I docout<<Pixels[0].R;
then it prints the correct R, G, and B values. Can anyone tell me why it never prints Colour Correctly?
Is there a way I can automatically populate Color?