-- FitDisplayUtilitiesImpl.mesa
-- Last Edited by Michael Plass August 24, 1982 3:47 pm
DIRECTORY
Cubic,
TJaMGraphics USING [Painter],
JaMFnsDefs,
Graphics,
SafeStorage,
FitDisplayUtilities;
FitDisplayUtilitiesImpl: PROGRAM
IMPORTS TJaMGraphics, Graphics, JaMFnsDefs, SafeStorage
EXPORTS FitDisplayUtilities =
BEGIN
octagonPath: Graphics.Path ← OctagonPath[];
OctagonPath: PROC RETURNS [path: Graphics.Path] = {
path ← Graphics.NewPath[8];
Graphics.MoveTo[path, 1, 2];
Graphics.LineTo[path, 2, 1];
Graphics.LineTo[path, 2, -1];
Graphics.LineTo[path, 1, -2];
Graphics.LineTo[path, -1, -2];
Graphics.LineTo[path, -2, -1];
Graphics.LineTo[path, -2, 1];
Graphics.LineTo[path, -1, 2];
};
HiLight: PUBLIC PROC[x, y: REAL] = {
Paint: PROC[dc: Graphics.Context] = {
oldPaintMode: Graphics.PaintMode ← Graphics.SetPaintMode[dc, invert];
Graphics.Translate[dc, x, y];
Graphics.DrawArea[dc, octagonPath];
Graphics.Translate[dc, -x, -y];
[] ← Graphics.SetPaintMode[dc, oldPaintMode];
};
TJaMGraphics.Painter[Paint];
};
bezierPath: Graphics.Path ← Graphics.NewPath[4];
ShowBezierInverted: PUBLIC PROC[bezier: Cubic.Bezier] = {
Paint: PROC[dc: Graphics.Context] = {
oldPaintMode: Graphics.PaintMode ← Graphics.SetPaintMode[dc, invert];
Graphics.DrawStroke[dc, bezierPath, 0];
[] ← Graphics.SetPaintMode[dc, oldPaintMode];
};
Graphics.MoveTo[bezierPath, bezier.b0.x, bezier.b0.y];
Graphics.CurveTo[bezierPath, bezier.b1.x, bezier.b1.y, bezier.b2.x, bezier.b2.y, bezier.b3.x, bezier.b3.y];
TJaMGraphics.Painter[Paint];
};
CollectGarbage: PROC = {
SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: TRUE];
};
JaMFnsDefs.Register[".collectgarbage", CollectGarbage];
END.
Michael Plass August 24, 1982 3:47 pm: Added CollectGarbage.