🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

HELP!! Why doesn't RealizePalette() work???

#1624
From: Mark Horstman
Date: Wed, 13 Mar 1991 14:10
48 lines
2687 bytes
I'm trying to display a 16 color image that I've converted to
DIBitmap format.  I've filled in the appropriate BITMAPINFO 
structure and associated BITMAPINFOHEADER structure.  I create
an uninitialized hBitmap, and copy the BITMAPINFO colormap into 
a LOGPALETTE  structure and associated PALETTEENTRYs and 
CreatePalette() an  hPalette.   After moving the BITMAPINFO 
colormap into the LOGPALETTE entry, I change the RGBQUAD color 
map in the BITMAPINFO into an array of WORDs that are indexes 
into the hPalette colormap. AfterI then select the hPalette into
the hdc of my target window and realizinge it. Now I SetDIBits()
the scanlines into the hBitmap using the *_PAL_COLORS option
instead of the *_RGB_COLORS option.

If I understand this right... all this should tell Windows 
to use my logical color palette when I've got focus (I even 
re-Realize() my logical palette everytime I get a WM_SETFOCUS 
message.  Now,  RealizePalette() is supposed to return how many 
colors where  'modified' in the system color palette when I 
Realize()d mine in. It always returns ZERO (0)!

So now I think... Ahhh! there must not be enough entries available
in the system palette to hold my logical palette.  OK, I'll use 
the SetSystemPaletteUse() call to release all the static colors that
Windows reserves.  Well SetSystemPaletteUse() is supposed to return
the previous state of the system palette (either 1 or 2, STATIC or 
NOSTATIC). Well it ALWAYS returns ZERO (0)!

What am I doing wrong?? What I'm expecting is that when my window
is active or has focus, the screen uses my color map and all
the other windows will look somewhat funky. But I can't get the
screen colormap to change. Can't I get all 16 colors from a 
640x480x4(16) display? I've been working on this for three days 
straight and I'm going CRAZY!  Xt is MUCH easier!  

Can anyone provide me some direction/help/answers?  I would 
appreciate any replies be over email  since I don't normally 
read this newagroup.

Thanks in advance,


Mark Horstman
mh2620@sarek.sbc.com
Southwestern Bell Telephone
One Bell Center, 16-K-01
St. Louis, MO  63101
(314) 235-3417
Technical Details
Message-ID: <1991Mar13.141016.6954@swbatl.sbc.com>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!rutgers!dimacs.rutgers.edu!seismo!ukma!wuarchive!swbatl!sarek.sbc.com!mh2620

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!rutgers!dimacs.rutgers.edu!seismo!ukma!wuarchive!swbatl!sarek.sbc.com!mh2620
From: mh2620@sarek.sbc.com (Mark Horstman)
Newsgroups: comp.windows.ms.programmer
Subject: HELP!! Why doesn't RealizePalette() work???
Keywords: realizepalette setsystempaletteuse
Message-ID: <1991Mar13.141016.6954@swbatl.sbc.com>
Date: 13 Mar 91 14:10:16 GMT
Sender: usenet@swbatl.sbc.com (0000-news(0000))
Reply-To: mh2620@sarek.sbc.com
Organization: Southwestern Bell
Lines: 48