NectarineColors.mesa
Copyright Ó 1987, 1988 by Xerox Corporation. All rights reserved.
Giordano Bruno Beretta, June 24, 1987 9:16:35 am PDT
gbb January 29, 1988 7:39:42 pm PST
Inference engine for the colour registries and colour blending.
DIRECTORY
CD USING [Layer],
Imager USING [Color],
ImagerColor USING [RGB],
ImagerInterpress USING [Ref],
IO USING [STREAM],
Rope USING [ROPE];
NectarineColors: CEDAR DEFINITIONS ~ BEGIN
Color: TYPE ~ Imager.Color;
Bitset: TYPE ~ PACKED ARRAY CD.Layer OF BOOLEANALL [FALSE];
BlendKey: TYPE ~ REF Bitset;
Blend: TYPE ~ REF BlendRec;
BlendRec: TYPE ~ RECORD [count: CD.Layer ← 0,
flavours: Bitset,
blend: Color ← NIL,
index: INTEGERINTEGER.FIRST,
used: BOOLFALSE,
area: CARD ← 0];
colSubDef: BOOL; -- default for colour substitution
traceColourInferences: BOOL;
unColour: ImagerColor.RGB;
blackBlack, orableBackground: Color;
Colouring single layers
LayerColour: PROC [l: CD.Layer] RETURNS [Color];
Ensure that only one colour representation is used.
SetLayerColourTable: PROC RETURNS [ok: BOOLTRUE];
Infers a colour for every ChipnDale layer.
ResetLayerColourTable: PROC RETURNS [ok: BOOLTRUE];
Must be called whenever the user profile entry for the colour substitution changes.
Colouring intersecting layers
ColourTile: PROC [old: Blend, l: CD.Layer] RETURNS [new: Blend];
Adds a new layer to the set of layers intersecting in a tile.
BlendTileColours: PROC;
Blends colours for all tiles coloured with the above procedure.
NumberOfColours: PROC RETURNS [INT];
Number of different combinations of layers. This is the number of colours that the following procedure would declare in the Interpress master.
DeclareColours: PROC [master: ImagerInterpress.Ref];
Declares used colours in the preamble.
IthColour: PROC [i: INT] RETURNS [Color];
Returns the i-th color.
ListColourStatistics: PROC [numberOfTiles: CARD];
Lists the surface statistics on the blended colour table in a terminal viewer.
ResetColourStatistics: PROC;
We initialize only the area so as to cache colour blendings across sessions.
File Interface to MetaPalette
WriteMap: PROC [fileName: Rope.ROPE, msg: IO.STREAMNIL];
Dumps the table of blended colours into a color map file.
ReadMap: PROC [fileName: Rope.ROPE]
Loads the table of blended colours from a color map file. The file must have been written either by this module or by the MetaPalette; there is no consistency check.
END.