Re: Questions about colors and palettes

new topic     » goto parent     » topic index » view thread      » older message » newer message

At 04:11 PM 5/14/98 -0700, you wrote:
>I've got some questions about 256 color mode and palettes.
>
>I (think) I understand the following:
>
>1. Colors are referenced by numbers on the PC.
>2. These numbers are used as indexes into a palette.
>3. Bitmaps come with two chunks of information: the bitmap, and their own
palette.
>4. The bitmap palette colors are arranged (in theory) in order of
importance - so color #1 really should have an absolute match, while color
#150 can have a "close match".

{1,2,3} = yes
{4} = not really. (See below)

>I'm less clear on how to deal with colors from various competing sources.
For example, if I go to load a bitmap, it will replace the current palette
with it's own - and likely ruin any prior images that were displayed.

Correct.

>So it would seem the thing to do would be to set up the palatte with the
first 32 colors or so reserved for "default" colors, and build the rest of
the palette with an even spread through the spectrum. When loading a bitmap,
you would then replace the colors in the bitmap with a "close match" to
those colors. This would prevent the color scheme of the rest of the display
from being destroyed, and display colors more or less correctly.

I don't think this will work in practice.

>Using the same scheme, you would be able to display 256 color bitmaps in 16
color mode as well - albiet, with a much more limited palette.

>I'm a bit confused, because Irv loads bitmaps in his Windoz program with no
visible side effects. Is there something I'm missing? If the method I've
described is correct, has someone already written as set of tools to
"average" a bitmap? Is there a better way to do all this?

Yes. Something like Paint Shop Pro, shareware from JASC, allows one to:
1. Load a bitmap picture.
2. Load a standard palette (256 colors) * adjusting/matching colors as
necessary.
3. Save the file with this new palette.

If you do this with all the bitmaps used in your program, everything looks ok.
Caveat:  at least the first 16 colors must be close to the normal VGA colors,
or all your buttons, etc will be very strange looking.

*Note: How do you get a standard palette? You can't just copy the palette
from one of your bitmaps -- it may not have the "standard" colors 0--15!
Actually, it will have colors 0--15, but they may be, say, shades of mauve.
Blecch!

There's a short Euphoria program TESTPAL.EX on my web site which
will allow you to:
1. View the standard 256 colors (and the numeric index to them)
2. Save that standard palette to a file
3. Load a bitmap, and see the new palette values it brings with it
4. Save that palette to a file.
The output from this is what I used to "adjust" all the bitmaps.

Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu