KN> how about explaing how games or demos are done, having displayed
KN> 2 or 3 different pictures at the same time
The answer to your question is that programs and operating systems which do this
are typically doing some kind of palette management. To keep the example I'm
about to use manageable in size, let's simplify and arbitrarily say that we have
just eight colors available to us in the hardware palette instead of 768. Keep
in mind, however, that although we have only a limited number of colors
available at one time (8 in this example) each of these colors may be one of
millions possible, depending on the hardwar e's color capability.
Now let's say that we have three pictures with palette mappings as follows:
Picture A Picture B Picture C
0 light gray 0 green 0 black
1 dark gray 1 blue 1 red
2 red 2 red 2 green
3 blue 3 orange 3 blue
4 black 4 black 4 yellow
5 not used 5 purple 5 not used
6 not used 6 not used 6 not used
7 not used 7 not used 7 not used
Displaying the first picture is simple -- we can simply use the mappings as they
are presented and we have three slots left for additional colors. If we now try
to display B, we have a conflict. We can't map color 0 to both light gray AND
green, so we adjust one of the pictures to use an alternate mapping. Let's say
we leave picture A as it is and alter the mappings for picture B. Our new
mappings look like this:
Machine Palette reg Picture B
original new
0 light gray 0 not used
1 dark gray 1 not used
2 red 2 2 red
3 blue 1 3 blue
4 black 4 4 black
5 green 0 5 green
6 orange 3 6 orange
7 purple 5 7 purple
Now instead of asking for color 0 when it needs the color green, Picture B calls
for color 5 to get the same results. This sort of remapping is the simplest
form of color management. The next kind has a bit more capability and a bit
more intelligence built into it as we see when we now add Picture C. Since there
is a new color (yellow) which is required but not mapped to any palette
register, we have to make a choice. We could:
0. tell the user that he or she can't view the picture at all.
1. ignore the request and simply use the existing mappings
2. remap to correct this picture, sacrificing the other two
3. try to combine colors to comprimise on the quality of all three pictures.
Option zero is probably the least desireable of the options. Approach #1 would
leave anything originally colored yellow painted black in Picture C. This might
not be desireable. Approach #2 would make anything colored black in A and B
suddenly yellow. This is also probably not desireable. The last approach is
not simple, but may provide the best percieved overall quality, especially when
attempting to show pictures for which the actual colors used are relevant. An
example of the type of picture for which the actual colors might not be relevant
is a color graph of financial data -- different colors are required, but WHICH
colors are used is relatively flexible.
This color combination approach might be accomplished by noting that the current
color map has two very similar colors -- light gray and dark gray, which could
be combined at some loss to the reproductive fidelity of our pictures. The new
mapping would yield:
Machine Palette reg Picture A
original new
0 not used 0 not used
1 medium gray 0 or 1 1 medium gray
2 red 2 2 red
3 blue 3 3 blue
4 black 4 4 black
5 green 5 not used
6 orange 6 not used
7 purple 7 not used
Picture B happens to be unaffected by this change, and Picture A is only
slightly changed. Instead of mapping to two shades of gray, Picture A now only
uses one. Now the machine palette register has one free entry, in which we can
put our one new color (yellow) from Picture C giving this as the final result:
Machine Palette reg Picture A Picture B Picture C
orig new orig new orig new
0 yellow 0 0 4 0 yellow
1 medium gray 0,1 1 1 1 not used
2 red 2 2 2 2 1 2 red
3 blue 3 3 1 3 3 3 blue
4 black 4 4 4 4 0 4 black
5 green 5 0 5 2 5 green
6 orange 6 3 6 6 not used
7 purple 7 5 7 7 not used
There are, of course, other techniques, but I'll leave them for others to
explain. If you ask nicely, they might just do so.