0
typedef struct tagBITMAPINFO {
  BITMAPINFOHEADER bmiHeader;
  RGBQUAD          bmiColors[1];
} BITMAPINFO, *PBITMAPINFO;

I never really understood what the values in the bmiColors array do. I usually 0-fill it, but putting in any arbitrary value doesn't affect my application at all.

The MSDN documentation is also ambiguous on what that member does, when I simply manipulate the pixels in the COLORREF array allocated by CreateDIBSection, and then bitblt.

What is bmiColors?

  • It lets you define the palette for an indexed bitmap (i.e. 256 colors or fewer). – Jonathan Potter Jun 18 '15 at 03:45
  • @JonathanPotter So it's not of use when I do not use an indexed bitmap? –  Jun 18 '15 at 03:46
  • If you're not using 256 colours or less you can leave it out completely and just use a BITMAPINFOHEADER. – Ross Ridge Jun 18 '15 at 05:54
  • `bmiColors` is not used just for indexed bitmaps. 16bit and 32bit bitmaps use it if they are using bitfield compression: "*If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, **the bmiColors member contains three DWORD color masks that specify the red, green, and blue components, respectively, of each pixel**. Each (D)WORD in the bitmap array represents a single pixel*." – Remy Lebeau Jun 18 '15 at 06:58

0 Answers0