1. Questions about colors and palettes

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".

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.

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.

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?

Thanks.

-- David Cuny

new topic     » topic index » view message » categorize

2. Re: Questions about colors and palettes

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 message » categorize

3. Re: Questions about colors and palettes

Hey, the To: field doesn't look right...... Hmmm. Anyway......

>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.

0-15 or 0-255, yeah.... (16 and 256 color modes, respectivly)

>2. These numbers are used as indexes into a palette.

Right.

>3. Bitmaps come with two chunks of information: the bitmap, and their
>own palette.

As far as Euphoria's loading routines are concerned....

>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".

I dunno. With the default palette, the first 16 (0-15) are usually the
same, and the rest are the same colors repeating, getting from bright to
dark. I think. In the source code for simple arcade games that I've seen,
the later colors are the ones used for palette rotation for blinking
lights and such. The earlier ones are used more often for the rest of the
colors.

>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.
>
>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.

Why not just try to keep both bitmaps using the same palette? Using the
completely default color map if possible? That would really keep things
simple.

>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.

Yeah.... As I understand it, it is possible to find a close or exact
match to a color. It's how Pete did the transparancy in the ModeX
demos....

>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?

Just try to keep the same palettes and you won't have to worry about
it.... :)

My two cents.


_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

new topic     » goto parent     » topic index » view message » categorize

4. Re: Questions about colors and palettes

Thanks for the feedback. I'll take a look at Irv's site.

I will probably need to put together some tools to convert the bitmaps to
the "standard" colors, because I can't guarantee that the input files will
be in any given palette. For example, I want to be able to use XMP (X Window
generic bitmaps), which specify their colors in RGB tuples.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

5. Re: Questions about colors and palettes

At 05:49 PM 5/14/98 -0700, you wrote:

>Thanks for the feedback. I'll take a look at Irv's site.
>
>I will probably need to put together some tools to convert the bitmaps to
>the "standard" colors, because I can't guarantee that the input files will
>be in any given palette. For example, I want to be able to use XMP (X Window
>generic bitmaps), which specify their colors in RGB tuples.
>
>-- David Cuny

How many colors does the rest of the program use?

Have you considered re-mapping the rest of your
program to the palette of the loaded image?

If you don't use many colors (say black, white and
grey) you'll probably find that most bitmap palettes
will have them, if not you could adjust the closest
match to fit - you still have a whole lot less re-
mapping to do and the image gets to keep most, if
not all of its origional palette.


----------------------------------------
Got to do one of those signiture thingys
----------------------------------------

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu