ImagerSource.mesa
This provides utilities for dealing with colors and sampled images
Last Edited by:
Crow, May 11, 1983 1:39 pm
DIRECTORY
ImagerSource: CEDAR DEFINITIONS
= BEGIN
Constant Sources
A uniform color.
Color: TYPE[2];
Functional colors.
red, green, blue, magenta, cyan, yellow, black, white: Color;
Making new colors. These procedures will SIGNAL Runtime.BoundsFault for any argument not in [0..1]; resuming the signal will perform arg ← MAX[0,MIN[1,arg]].
IntensityToColor: PROC [intensity: REAL] RETURNS [Color];
HSVToColor: PROC [h, s, v: REAL] RETURNS [Color];
RGBToColor: PROC [r, g, b: REAL] RETURNS [Color];
Deciphering colors.
ColorToIntensity: PROC [color: Color] RETURNS [intensity: REAL];
ColorToHSV: PROC [color: Color] RETURNS [h, s, v: REAL];
ColorToRGB: PROC [color: Color] RETURNS [r, g, b: REAL];
Sampled Sources
A client of the Imager may keep a sampled source in a form appropriate for its own use; it only needs to provide a way to extract a set of evenly-spaced samples along an arbitrary line segment.
The sample values are interpreted according to a color model, which simply tells how to map the sample values into constant colors. There are some predefined color models; the client is free to create others.
SampledSource: TYPE = ImagerBasic.SampledSource;
SampleSequence: TYPE = ImagerBasic.SampleSequence;
ColorModel: TYPE = ImagerBasic.ColorModel;
ColorModelRec: TYPE = RECORD [colorModelProc: ColorModelProc, colorModelData: REFNIL];
ColorModelProc: TYPE = PROC [sample: LONG CARDINAL, colorModelData: REF] RETURNS [Color];
RegisterColorModel: PROC [colorModel: ColorModel, colorModelRec: ColorModelRec];
FindColorModel: PROC [colorModel: ColorModel] RETURNS [ColorModelRec];
Predefined color models:
$OneBitPerPixelGray
$EightBitPerPixelGray
$StandardColorMap
$Identity -- no translation needed
END.