Board index » cppbuilder » Do I really need this palette manipulation?

Do I really need this palette manipulation?


2005-09-29 03:41:37 PM
cppbuilder24
Hi all,
I have an app that I'm updating to run on Windows 2000 and later, that used
to run on Windows 3.x (stop laughing at the back), and it currently works
with its own 256-colour palette that it selects in and out of device
contexts as necessary.
Am I right in thinking that thi would have been implemented so that all
(old) clients would show the same colours when their graphics adapters only
supported 256 colours? I've trawled through MSDN entries on palette handling
but I think I'm missing the point (I tend to get 'how' from the MSDN instead
of 'why').
I'm hoping that, since I'm targeting 2K and later, dropping (or
simplifying?) the code won't be a big problem. Perhaps I could specify a
minimum hardware platform of graphics adapters supporting 0xFFFFFF (or more)
colours?
Many thanks for any advice or 'palette primer' URLs...
GT
 
 

Re:Do I really need this palette manipulation?

"Graham Thompson" < XXXX@XXXXX.COM >wrote
Quote
Am I right in thinking that thi would have been implemented so that
all (old) clients would show the same colours when their graphics
adapters only supported 256 colours? I've trawled through MSDN
entries on palette handling but I think I'm missing the point (I
tend to get 'how' from the MSDN instead of 'why').

I'm hoping that, since I'm targeting 2K and later, dropping (or
simplifying?) the code won't be a big problem. Perhaps I could
specify a minimum hardware platform of graphics adapters supporting
0xFFFFFF (or more) colours?
Yes, you can drop the palette functions if you require an adaptor set
to more than 256 colors. The limitations this imposes are fairly slim
these days, as "high color" adaptors have been the norm for at least 8
years. I have an app that still contains palette code (also written
for Win 3.X) and have just left it in. Windows ignores palettes when
running in high color modes. The operating system version is not
important, it all depends on the graphics adaptor. You could call
GetDeviceCaps() to find out the color depth and display a message
telling the user that your program requires something more if it is
set to 256 (or 16).
--
Bruce
 

Re:Do I really need this palette manipulation?

" Bruce Salzman" < XXXX@XXXXX.COM >wrote in message
Quote
Yes, you can drop the palette functions if you require an adaptor set to
more than 256 colors.
Top news; thanks for taking the time to respond.
Quote
I have an app that still contains palette code (also written for Win
3.X) and have just left it in.
That's what I've done until now, but I want to trim the code back as much as
possible (a) to reduce maintenance and (b) so that our younger engineers
have less of a learning curve when it comes to working on the app.
Quote
Windows ignores palettes when running in high color modes.
Now there's something I didn't find in MSDN. Do you mean that selecting a
palette into a device context then 'realizing' it has no effect, or that
GetDeviceCaps() would indicate the device is not a palette device (i.e.
GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE would be FALSE)?
Thanks again for your help,
GT
 

{smallsort}

Re:Do I really need this palette manipulation?

"Graham Thompson" < XXXX@XXXXX.COM >wrote in
message news: XXXX@XXXXX.COM ...
Quote
>Windows ignores palettes when running in high color modes.

Now there's something I didn't find in MSDN. Do you mean that
selecting a palette into a device context then 'realizing' it has no
effect, or that GetDeviceCaps() would indicate the device is not a
palette device (i.e. GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE
would be FALSE)?

Correct.
I found this in MSDN:
"Most palette functions do nothing on nonpalette devices.
Specifically, the functions RealizePalette, AnimatePalette, and
SetSystemPaletteUse do not affect a nonpalette device. Also, Windows
does not send any of the palette messages when running on a nonpalette
device. "
--
Bruce
 

Re:Do I really need this palette manipulation?

" Bruce Salzman" < XXXX@XXXXX.COM >wrote in message
Quote
Correct.
Excellent. Thanks again, Bruce.