BUG: GetDIBits Incorrectly Initializes the Color Table when Used On 1bpp and 4bpp DIB Sections

ID: Q230499


The information in this article applies to:
  • Microsoft Windows NT 4.0
  • Microsoft Windows 2000


SYMPTOMS

The colors in DIBs obtained through a conversion from 1 bit per pixel or 4 bits per pixel to 8 bits per pixel may not reflect the colors the original image was created with.


CAUSE

GetDIBits does not fill in the color table properly when converting either 1bpp or 4bpp DIB sections to 8bpp. Instead of initializing the color table of the 8bpp image using the colors from the color table of the source image, the color table is initialized with false values. The behavior of this function is incompatible with the behavior on Windows 95 and Windows 98.


RESOLUTION

Instead of using GetDIBits() to retrieve the bits directly from the DIB section, create an 8bpp DIB section and initialize its color table using the color table retrieved from the 1bpp/4bpp image. After this is done you can BitBlt() from the 1bpp/4bpp DIB section to the 8bpp DIB section in order to convert the format of the bits to 8bpp.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

Additional query words:

Keywords : kbBitmap kbDibSect kbGDI kbWinOS2000 kbSDKWin32 kbGDIFAQ
Version : WINDOWS:; winnt:4.0
Platform : WINDOWS winnt
Issue type : kbbug


Last Reviewed: December 15, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.