
Description of color code

SAOimage can handle any of a variety of color map modes.  At this time,
monochrome, pseudocolor, and pseudocolor with an overlay plane are supported.
Fixed color is planned for the future.  Reserving a new colormap is not
yet supported, either, but planned for the future.  The imaging software
does not need to know anything about the type of color map, excepting
monochrome.  

For all of the color modes, the image is mapped from 0 to maxcolor, and then
remapped to the actual display value using the cellmap.  The cellmap is
established by the code which Allocates color map cells.  In the case of
monochrome, maxcolor is 255 and a dither map or error diffusion code is
applied to the final value.  The cell map may be used if an additional
stage of user control is desired.

SAOimage uses a heirarchy of color maps to determine what the user gets,
based on what the user wants.  The order is colors with an overlay for
the cursor, simple cell based color, and halftone bitmap.  The selection
starts with what was requested.  If that cannot be arranged, it drops to
the next.

The pseudocolor mapping is based on a table of inflection points with a
color intensity at each point of inflection.  The color is interpolated
between these points.  Each color has its own table.  There is not need
for the inflection points of one color to have the same inflection level
or intensity as any other.

The intensities range from 0 to 1.0 and the inflection levels range from
0 to 1.0.  The intensity and levels are scaled appropriately for the
hardware and the colormap internally.  This makes the pseudocolor tables
hardware independent.  However, it cannot guarantee two colors to be in
adjeacent levels (i.e. levels 1 and 2).  The table can be stretched, such
that the range of levels extends beyond 0 and 1 in either direction.
Then only the map section between 0 and 1 is converted to the actual
integer pseudocolor map range.  The number of inflection points is
limited, usually to the number of entries in the expected display
hardware (i.e. 256).  To make a step function takes two entries (same
level, different intensity) so a complete arbitrary colormap cannot be
represented using psseudocolor tables.  For that, a fixed color mode must
be used.
