IIStroke.mesa
Copyright © 1984, 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, November 18, 1986 2:07:24 pm PST
Doug Wyatt, February 24, 1986 4:13:34 pm PST
DIRECTORY
IIBox USING [Box],
IIPath USING [PathProc, MoveToProc, LineToProc, CurveToProc, ConicToProc],
IIPen USING [Pen],
IITransformation USING [Transformation],
Real USING [LargestNumber],
Vector2 USING [VEC];
IIStroke: CEDAR DEFINITIONS
~ BEGIN
VEC: TYPE ~ Vector2.VEC;
VertexIndex: TYPE ~ NAT;
maxReal: REAL ~ Real.LargestNumber;
bigBox: IIBox.Box ~ [xmin: -maxReal, ymin: -maxReal, xmax: maxReal, ymax: maxReal];
PathFromStroke: PROC [path: IIPath.PathProc, closed: BOOL,
width: REAL, end: INT, joint: INT, m: IITransformation.Transformation,
moveTo: IIPath.MoveToProc, lineTo: IIPath.LineToProc, conicTo: IIPath.ConicToProc,
box: IIBox.Box ← bigBox
];
Produces the outline of a stroke in device, view or surface coordinates, given a path for the centerline in client coordinates. The box (in the coordinate system of the result) is used to avoid extra work on portions of the trajectory that fall outside of it, but the result is not clipped to the box. The conicTo is in fact only called with parabolic segments, i.e., r=0.5.
PathFromVector: PROC [p0, p1: VEC, width: REAL, end: INT,
m: IITransformation.Transformation, moveTo: IIPath.MoveToProc, lineTo: IIPath.LineToProc];
Similar to PathFromStroke with path ~ { moveTo[p0]; lineTo[p1] };
SquareEndWithNoDirection: SIGNAL;
May be raised as an informational signal by PathFromStroke or PathFromVector; should be turned into an appearance warning by Interpress.
PenStroke: PROC [path: IIPath.PathProc, pen: IIPen.Pen, closed: BOOL,
moveTo: IIPath.MoveToProc, lineTo: IIPath.LineToProc, conicTo: IIPath.ConicToProc,
end: PROC [p: VEC, v: VEC, i0, i1: VertexIndex],
joint: PROC [p: VEC, v0, v1: VEC, i0, i1: VertexIndex],
box: IIBox.Box,
cull: BOOL ← FALSE
];
This is a more basic routine. Produces the polygonal outline of a stroke, given a path for the centerline. The input path is in a coordinate system with one unit per pixel. The output outlines winds counterclockwise in this coordinate system. The pen must be convex. If cull, segments are culled completely if their bounding box extended by the pen bounding box is ouside of box; otherwise the are kept; cull should be false if mitered joints or square ends are used.
MeasurePath: PROC [path: IIPath.PathProc] RETURNS [REAL];
Computes an approximation to the arc length of the path.
Dashes: PROC [path: IIPath.PathProc,
patternLen: NAT, pattern: PROC [i: NAT] RETURNS [REAL], offset, length: REAL,
moveTo: IIPath.MoveToProc, lineTo: IIPath.LineToProc,
conicTo: IIPath.ConicToProc, curveTo: IIPath.CurveToProc
];
Produces dash segments, given a path and dash specification.
END.