[comp.windows.ms.programmer] HELP!! Why doesn't RealizePalette

mh2620@sarek.sbc.com (Mark Horstman) (03/13/91)

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

jlr1801@aim1.tamu.edu (Jeff Rife) (03/14/91)

In article <1991Mar13.141016.6954@swbatl.sbc.com> mh2620@sarek.sbc.com writes:
>
>I'm trying to display a 16 color image that I've converted to
>DIBitmap format.  I've filled in the appropriate BITMAPINFO 

[stuff deleted]

>640x480x4(16) display? I've been working on this for three days 
         ^^^^^

The sixteen colors are your problem.  If it is the stock VGA driver, it does
not support palette operations *at all*.  Microsoft really hates us.

Take a look at Petzold's articles the past ~3-4 issues of PC Magazine,
Environments column.  Real good palette stuff.

--
Jeff Rife   P.O. Box 3836   |   "Because he was human; because he had goodness;
College Station, TX 77844   |    because he was moral they called him insane.
(409) 823-2710              |    Delusions of grandeur; visons of splendor;
jlr1801@aim1.tamu.edu       |    A manic-depressive, he walks in the rain."

mh2620@sarek.sbc.com (Mark Horstman) (03/15/91)

In article <13332@helios.TAMU.EDU>, jlr1801@aim1.tamu.edu (Jeff Rife) writes:
> In article <1991Mar13.141016.6954@swbatl.sbc.com> mh2620@sarek.sbc.com writes:
> >
> >I'm trying to display a 16 color image that I've converted to
> >DIBitmap format.  I've filled in the appropriate BITMAPINFO 
> 
> [stuff deleted]
> 
> >640x480x4(16) display? I've been working on this for three days 
>          ^^^^^
> 
> The sixteen colors are your problem.  If it is the stock VGA driver, it does
> not support palette operations *at all*.  Microsoft really hates us.

So where do I find a VGA driver that allows me to do palette operations?

-- 
Mark Horstman
mh2620@sarek.sbc.com
Southwestern Bell Telephone
St. Louis, MO