FitDisplayUtilitiesImpl.mesa
Last Edited by Maureen Stone May 30, 1984 4:45:15 pm PDT
Last Edited by Michael Plass August 24, 1982 3:47 pm
DIRECTORY
Cubic,
JaMImager USING [Painter],
JaM,
Imager USING [MoveTo, LineTo, CurveTo, Context, SetColor, XOR, TranslateT, MaskFill, MaskStroke, DoSaveAll, Trajectory],
ImagerTransform, --implicit for Imager.TranslateT
FitDisplayUtilities;
FitDisplayUtilitiesImpl:
CEDAR
PROGRAM
IMPORTS JaMImager, Imager
EXPORTS FitDisplayUtilities =
BEGIN
octagonPath: Imager.Trajectory ← OctagonPath[];
OctagonPath:
PROC
RETURNS [path: Imager.Trajectory] = {
path ← Imager.MoveTo[[1, 2]];
path ← Imager.LineTo[path, [2, 1]];
path ← Imager.LineTo[path, [2, -1]];
path ← Imager.LineTo[path, [1, -2]];
path ← Imager.LineTo[path, [-1, -2]];
path ← Imager.LineTo[path, [-2, -1]];
path ← Imager.LineTo[path, [-2, 1]];
path ← Imager.LineTo[path, [-1, 2]];
};
HiLight:
PUBLIC
PROC[state: JaM.State, x, y:
REAL] = {
Paint:
PROC[dc: Imager.Context] = {
doIt:
PROC = {
Imager.SetColor[dc, Imager.XOR];
Imager.TranslateT[dc, x, y];
Imager.MaskFill[dc, octagonPath];
Imager.TranslateT[dc, -x, -y];
};
Imager.DoSaveAll[dc,doIt];
};
JaMImager.Painter[Paint, state];
};
ShowBezierInverted:
PUBLIC
PROC[state: JaM.State, bezier: Cubic.Bezier] = {
Paint:
PROC[dc: Imager.Context] = {
doIt: PROC = {Imager.SetColor[dc, Imager.XOR]; Imager.MaskStroke[dc, bezierPath, 0]};
Imager.DoSaveAll[dc,doIt];
};
bezierPath: Imager.Trajectory ← Imager.MoveTo[[bezier.b0.x, bezier.b0.y]];
bezierPath ← Imager.CurveTo[bezierPath, [bezier.b1.x, bezier.b1.y], [bezier.b2.x, bezier.b2.y], [bezier.b3.x, bezier.b3.y]];
JaMImager.Painter[Paint, state];
END.
Michael Plass August 24, 1982 3:47 pm: Added CollectGarbage.