Patch for CreateDIBitmap: Don't create monochrome bitmaps (help
hallo at michael-kaufmann.ch
Wed Aug 25 18:43:26 CDT 2004
I finally managed to create a patch that fixes the bug in CreateDIBitmap
and also changes all the WINE code that was relying on the wrong
behavior. I'll send the patch to wine-patches in a couple of minutes. So
if you intended to help, it's too late ;-)
> Test Program (DIB-Testcase.zip):
> I've created a test program that shows the problem. It also shows a
> bug in Windows! It displays two bitmaps, both should be black and
> white. WINE displays them red on green (I've set these colors with
> The images differ only in a single byte. I've used the program bmpdump
> ( http://david.tribble.com/programs.html ) to analyze them. In the
> color table of the bitmaps, the rgbReserved member of a RGBQUAD
> structure is 0x00 for the left bitmap and 0xFF for the right bitmap.
> This shouldn't make a difference. But Windows creates a monochrome
> bitmap for the left one, and a color bitmap for the right one! Does
> anyone understand this behavior?
Now I do. CreateDIBitmap() doesn't provoke this, it's LoadImage(). This
function creates a device-dependent bitmap. If it's possible, it creates
a monochrome bitmap. Windows looks at the color tables to check if the
two colors are really black and white. For the right bitmap, this is not
the case, and so Windows creates a color bitmap.
WINE will do the same with my patch applied.
More information about the wine-devel