Bryan,
BS> You are right, I'm working in 256 coulors. What I don't undertand is
BS> why ona 256-colour system, the "current system palette" seems to
BS> contain only 16
BS> colours !
Several reasons, actually. First, Windows only defines the first 16 and the
last 4 of the first 32 colors in the 256 color palette. (For a total of 20
defined colors. The rest are initialyzed to black.) This allows Windows to
automatically run on 16-color VGA systems. Second, MS naturally can't get it
right! Even on the 95th try!!!
One thing though, if you study the Windows API help for the GDI commands,
you'll see that you can specify that the 'system' palette should ONLY use
Black and White as default assigned colors which allow you to use all 254
other colors for your palette. (Since you'll probably want the black and
white palette entries anyway, this gives you an effective 256 color palette.)
However, you pay for this as it causes all your other applications running
to use the 'new' order of colors and will cause the form title bars, etc. to
flash to new colors. What I do is take the standard 256-color palette values
and assign any that are not either in or close to the 16-color values to the
system palette when I start a graphics app. This gives a good chance that
most of my graphical images will view properly, or, at least, somewhat
properly.
Also, have you noticed a certain finickiness under Windows 95 to re-assigning
colors to the system palette using the Windows 3.1 'Create Palette', 'Select
Palette', 'SetPaletteEntries' and 'Realize Palette' functions? I've really
noticed a problem with this. Sometimes the code works, sometimes it doesn't.
For test purposes, I create a logical palette and HPALETTE handle, select
that palette into the current form, create a random series of color entries
for each of the 256 palette entries, and then realize that palette, and
finally I display the color realized on 256 tiny panel objects. When it
works, no problem. When it doesn't, ALL I get is the 16-color Windows
palette colors with the rest of the colors set to black. What's crazy is
that I DON'T change a line of code!!!
Derek
--- FreeMail 1.07b
(1:203/21)
---------------
* Origin: The Visual Programmer's Workshop - N.H., Ca (916)338-3230 *
|