-- ColorMap.mesa
-- last edited by Maureen Stone, July 5, 1982 5:50 pm
-- last edited by Doug Wyatt, August 31, 1982 2:21 pm
-- Color definitions and colormap routines
ColorMap: CEDAR DEFINITIONS = {
StandardMap: PROC;
--sets up the standard color map (definition changing daily!)
GrayMap: PROC;
--sets up a gamma corrected gray wedge as the color map. Good for
--showing AIS files
SetGamma: PROC[gamma: REAL];
GetGamma: PROC RETURNS[gamma: REAL]; --gamma should be in the range [1..3]
--change a colormap entry. index range depends on displaymode
--all other values should be in [0..1]
--ColorError will be raised if the display does not have a colormap, or if the values are out of range
ColorError: SIGNAL[why: LONG STRING];
SetRGBColor: PROCEDURE[index: CARDINAL ← 0, r,g,b: REAL];
SetHSVColor: PROCEDURE[index: CARDINAL ← 0, h,s,v: REAL];
--following convert color for ColorDeviceImpl
Byte: TYPE = [0..256);
GrayTable: TYPE = REF GrayRec;
GrayRec: TYPE = RECORD[gray: SEQUENCE length: CARDINAL OF Byte];
--returns a table that maps intensities [0..nentries) into pixel values for the current mode
GetGrayTable: PROC RETURNS[GrayTable];
--Searches the colormap for all the gray values and sets up a GrayTable
--Do this after you are finished setting your colormap if you want the color device
--to do its best for gray images.
SetUpGrayTable: PROC;
--finds color in the colormap or returns a compromise (currently a gray value).
--This is expensive, so the device should keep a cache.
GetIndex: PROC[r,g,b: Byte] RETURNS[Byte];
--returns the color corresponding to the colormap index
GetColor: PROC[index: Byte] RETURNS[r,g,b: Byte];
}.