SelectRegions:
CEDAR
DEFINITIONS =
BEGIN
CVEC: TYPE ~ SampleMapOps.CVEC;
SampleArray: TYPE ~ SampleArrays.SampleArray;
SampleMap: TYPE ~ SampleMapOps.SampleMap;
TRC: TYPE ~ AdjustColor.TRC;
Operation: TYPE ~ {on, off, flip};
Rectangle: TYPE ~ RECORD [sMin, fMin, sMax, fMax: CARDINAL];
OutOfRectangle: ERROR; --Point not within bounds specified
TRCSequence: TYPE ~ REF TRCSequenceRep;
TRCSequenceRep:
TYPE ~
RECORD [
SEQUENCE n: NAT OF REF TRC
];
RGB: TYPE ~ RECORD [r, g, b: CARDINAL];
nullRectangle: Rectangle ~ [0, 0, LAST[CARDINAL], LAST[CARDINAL]];
FillRectangle:
PROC [sm: SampleMap, rect: Rectangle, op: Operation];
Turns a portion of the map on or off, filling out an area
PaintPixel:
PROC [sm: SampleMap, loc:
CVEC, op: Operation];
Paints a single pixel with the chosen operation.
PaintBrush:
PROC [sm: SampleMap, loc:
CVEC, op: Operation, brush: SampleMap];
Paints using a brush.
Fill:
PROC [sm: SampleMap, loc:
CVEC, bounds: Rectangle ← nullRectangle]
RETURNS [extent: Rectangle];
Turns a portion of the map on or off, filling out an area
defaultColorDistance: CARDINAL;
MatchColor:
PROC [sm: SampleMap, sa: SampleArray, rgb:
RGB, bounds: Rectangle ← nullRectangle, colorDistance:
CARDINAL ← defaultColorDistance];
Selects the pixels in bounds which are within colorDistance of the original pixel.
DiscriminateColor:
PROC [sm: SampleMap, sa: SampleArray, near, far:
RGB, bounds: Rectangle ← nullRectangle];
Selects the pixels in bounds which are within colorDistance of the original pixel.
MatchColorFill:
PROC [sm: SampleMap, sa: SampleArray, loc:
CVEC, bounds: Rectangle ← nullRectangle, colorDistance:
CARDINAL ← defaultColorDistance]
RETURNS [extent: Rectangle];
Selects the portion of the screen spreading out from loc which are closer (Manhatten-wise) to near than to far.
ApplyTRC:
PROC [sm: SampleMap, sa: SampleArray, trcs: TRCSequence, bounds: Rectangle ← nullRectangle];
trc.n must equal sa.n
Differences:
PROC [a, b: Rectangle, action:
PROC [r: Rectangle]];
Calls action for (up to 4) regions covered by a or b, but not both.
Intersect: PROC [a, b: Rectangle] RETURNS [Rectangle];
END.