PathToBox.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Contents: Returns a bounding box of a Path.
Blair MacIntyre July 2, 1992 11:25 am PDT
DIRECTORY
Imager, ImagerBox, ImagerPath;
PathToBox: CEDAR DEFINITIONS ~ BEGIN
MoveToProc: TYPE ~ ImagerPath.MoveToProc;
LineToProc: TYPE ~ ImagerPath.LineToProc;
CurveToProc: TYPE ~ ImagerPath.CurveToProc;
ConicToProc: TYPE ~ ImagerPath.ConicToProc;
ArcToProc: TYPE ~ ImagerPath.ArcToProc;
PathProc: TYPE ~ ImagerPath.PathProc;
Box: TYPE ~ ImagerBox.Box;
The precision specifies how tight a bounding box will be created.
BoxPrecision: TYPE = {conic, curve, device};
conic: arcs are converted to conics, conics are bounded by the bounding box of the triangle [p0, p1, p2], curves are bounded by the bounding box of the quadrilateral [p0, p1, p2, p3], moves are bounded by the trivial bounding box around [p0], lines are bounded by the box around [p0, p1].
curve: arcs are converted to conics, conics are converted to curves, curves are bounded by the bounding box of the quadrilateral [p0, p1, p2, p3], moves are bounded by the trivial bounding box around [p0], lines are bounded by the box around [p0, p1].
device: the path is converted to a devicePath, from which the bounding box is obtained.
PathToBox: PROC [context: Imager.Context, path: PathProc, precision: BoxPrecision ¬ device] RETURNS [box: Box];
Return the smallest bounding box around the given path.
END.