🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #3417

GDI Bug with CreateDIBitamp !???

#3417
From: Torsten Sturm
Date: Wed, 26 Jun 1991 12:29
53 lines
2351 bytes
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
Technical Details
Message-ID: <1991Jun26.122952.4294@informatik.uni-erlangen.de>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!sol.ctr.columbia.edu!ira.uka.de!fauern!faui43.informatik.uni-erlangen.de!testurm

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!sol.ctr.columbia.edu!ira.uka.de!fauern!faui43.informatik.uni-erlangen.de!testurm
From: testurm@immd4.informatik.uni-erlangen.de (Torsten Sturm)
Newsgroups: comp.windows.ms.programmer
Subject: GDI Bug with CreateDIBitamp !???
Message-ID: <1991Jun26.122952.4294@informatik.uni-erlangen.de>
Date: 26 Jun 91 12:29:52 GMT
Organization: CSD., University of Erlangen, Germany
Lines: 53