Microsoft KB Archive/230499

{|
 * width="100%"|

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

 * }

Q230499

-

The information in this article applies to:


 * Microsoft Windows NT Server version 4.0
 * Microsoft Windows NT Workstation version 4.0
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Professional

-

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 kbOSWin2000 kbSDKWin32 kbGDIFAQ

Issue type : kbbug

Technology : kbWinNTsearch kbWinNTWsearch kbWinNTW400 kbWinNTW400search kbWinNT400xsearch kbwin2000AdvServ kbwin2000AdvServSearch kbwin2000Serv kbWinNTSsearch kbWinNTS400xsearch kbWinNTS400 kbwin2000ServSearch kbwin2000Search kbwin2000ProSearch kbwin2000Pro kbWinAdvServSearch