ColorPlotGamuts.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Maureen Stone July 23, 1986 10:37:22 am PDT
Maureen Stone, June 29, 1988 1:43:49 am PDT
DIRECTORY
Imager USING [Context, VEC],
ImagerColor USING [RGB, Color],
ImagerTransformation USING [Transformation],
Rope USING [ROPE],
CalibratedColor USING [XYZ, SampledCalibration, RGBCalibration],
ImagerSample USING [SampleMap];
ColorPlotGamuts: CEDAR DEFINITIONS
~ BEGIN
For plotting color gamuts.
Projection: TYPE = {x,y, lStar, aStar, bStar, uStar, vStar, reflectance, hueAngle};
reflectance is Y/white.Y. Hue angle is the LAB hue angle
SampleMap: TYPE = ImagerSample.SampleMap;
SampledCalibration: TYPE = CalibratedColor.SampledCalibration;
RGBCalibration: TYPE = CalibratedColor.RGBCalibration;
VEC: TYPE = Imager.VEC;
XYZ: TYPE = CalibratedColor.XYZ;
RGB: TYPE = ImagerColor.RGB;
ROPE: TYPE = Rope.ROPE;
State: TYPE = REF StateRec;
StateRec: TYPE = RECORD [
redMap,greenMap,blueMap: SampleMap,
xAxis, yAxis: Projection,
res: NAT,  -- number of samples along longest dimension.
white: XYZ,
getColor: GetColorProc,
getColorData: REFNIL,
backgroundColor: RGB,
transformation: ImagerTransformation.Transformation --based on projections
];
CreateMapState: PROC [xAxis, yAxis: Projection, res: NAT, white: XYZ, getColor: GetColorProc, getColorData: REF, backgroundColor: RGB ← [0.5, 0.5, 0.5]] RETURNS [State];
The parameter res tells how many pixels should be along the longer dimension
MapColor: PROC [state: State, color: XYZ] RETURNS [x,y: REAL, rgb: RGB];
convert color to axis specification and transform. Useful for creating synthetic overlays.
MapValues: PROC [state: State, color: XYZ] RETURNS [x,y: REAL];
convert color to axis specification and transform. Doesn't cal state.getColor.
MarkColor: PROC[state: State, color: XYZ];
Mark a box in the SampleMap corresponding the to color
MarkColorVals: PROC[state: State, x, y: REAL, rgb: RGB];
x,y put into SampleMap, transforming them by the state.transformation.
The values x,y are therefore projected color values.
MarkPoint: PROC[state: State, ix, iy: INTEGER, rgb: RGB];
Put a mark in the SampleMap
GetColor Procs
GetColorProc: TYPE = PROC[xyz: XYZ, data: REFNIL] RETURNS[RGB];
Black: GetColorProc;  --constant black
Gray: GetColorProc;  --constant gray
White: GetColorProc;  --constant gray
SampledRainbow: GetColorProc; --assumes data is SampledCalibration
SampledGrayscale: GetColorProc; --assumes data is SampledCalibration
RGBRainbow: GetColorProc; --assumes data is RGBCalibration
RGBGrayscale: GetColorProc; --assumes data is RGBCalibration
Imaging
RopeFromProjection: PROC[proj: Projection] RETURNS[r: ROPE];
ImageSampleMap: PROC[dc: Imager.Context, state: State];
Images SampleMaps as RGB sampled color
ImageAndLabel: PROC [dc: Imager.Context, state: State, note: ROPE ← NIL, labelColor: ImagerColor.Color ← NIL];
Images the SampleMap in the current color, adds labels and the note in the labelColor. If labelColor=NIL uses the current color. Layout is to center the note under the sample map and axis. Different projections put the axis and labels in diazazzaazfferent places. If the note is NIL, no space is left for it.
StatesToInterpress: PROC[states: LIST OF State, ipName: ROPE, label: BOOLEANTRUE, note: ROPENIL, labelColor: ImagerColor.Color ← NIL, bleedBackground: BOOLEANFALSE];
Makes an InterpressMaster on ipName by combining all the SampleMaps and calling ImageAndLabel. The states had better all be the same type. bleedBackground makes gray background for slides
Device Gamuts
Computes white and calls CreateMapState
StateFromCalibration: PROC [cal: SampledCalibration, xAxis, yAxis: Projection, res: NAT, getColor: GetColorProc, getColorData: REF ← NIL] RETURNS [State];
StateFromRGBCalibration: PROC [cal: RGBCalibration, xAxis, yAxis: Projection, res: NAT, getColor: GetColorProc, getColorData: REF ← NIL] RETURNS [State];
Samples gamuts and plots the results
SampleAndPlot: PROC [state: State, cal: SampledCalibration, sample: NAT ← 8, sampleProc: SampleProc, substituteRainbow: BOOLEANTRUE];
Sampled XYZ to RGB and back is expensive. Since we are sampling the gamut as a function of RGB, we can do the rainbow colorproc without the conversion.
substituteRainbow =TRUE means use the cheap rainbow if the state.getColor=SampledRainbow.
RGBSampleAndPlot: PROC [state: State, cal: RGBCalibration, sample: NAT ← 8, sampleProc: SampleProc];
Interpolates in sample steps around the gamuts.
RGBProc: TYPE = PROC[rgb: RGB];
SampleProc: TYPE = PROC[sample: NAT ← 8, returnRGB: RGBProc];
GrayAxis: SampleProc;
Interpolates along the gray axis.
HueCircle: SampleProc;
Interpolates around the surface of the gamut (R,Y,G,C,B,M) in sample steps between vertices. ie, 8 steps between red and yellow, yellow and green, etc.
ColorsToWhite: SampleProc;
Interpolates from each of the hue circle colors to white
ColorsToBlack: SampleProc;
Interpolates from each of the hue circle colors to black
GamutSurface: SampleProc;
HueCircle, ColorsToWhite, ColorsToBlack
WholeGamut: SampleProc;
Interpolates uniformly along RGB in sample steps. Includes interior of the gamut.
END.