[comp.windows.ms.programmer] GDI Bug with CreateDIBitamp !???

testurm@immd4.informatik.uni-erlangen.de (Torsten Sturm) (06/26/91)

Hi DIB.Freaks out there !

Is this a bug or an error of mine ???

I've got a DIB, loaded in over a file !

Then i create a 256color palette out of this DIB.

To create then a paintable Bitmap, you have to use

SelectPalette(hDC,hPalette);
HBITMAP hTemp = CreateDIBitmap(......);

This works with 16 color vga drivers,
but with 256-color drivers, i've found out you have to include
RealizePalette() after Selectpalette(), otherwise the window is black !

Additionally, if I want to get full systempalette-use (with
SetSystemPaletteUse(hdc,SYSPAL_NOSTATIC) or so)
I have to include an UnrealizeObject(hPalette) call before calling
RealizePalette(), because otherwise the colors of the painted Bitmap
are wrong (CreateDIBitmap seems to match colors then, but in a very 
wrong way). 
Following SDK-Reference, only SelectPalette()call is needed before
CreateDIBitamp(), the other stuff is only for realizing my vitual
palette to the system palette before painting the bitmap!

Please comment ?!!!

P.S. : Another thing : SDK says, that after SetSystemPaletteUse and
       before calling RealizePalette one have to save the current 
	system colors and setting them back, if the appl. looses
	the focus. I first forgot to include this, but it works well,
	after clicking at another appl., the old system colors are 
	restored by someone (WHO ?) 
	Your comment to this ???

Thanx in advance for comments !

Torsten .

tnsturm@faui09.informatik.uni-erlangen.de
tnsturm@faui40.informatik.uni-erlangen.de
testurm@faui41.informatik.uni-erlangen.de
testurm@faui43.informatik.uni-erlangen.de
storm@faui80.informatik.uni-erlangen.de
---
Torsten Sturm 
tnsturm@faui09.informatik.uni-erlangen.de
tnsturm@faui40.informatik.uni-erlangen.de
testurm@faui41.informatik.uni-erlangen.de
testurm@faui43.informatik.uni-erlangen.de
storm@faui80.informatik.uni-erlangen.de