DIRECTORY Imager USING [StrokeEnd, StrokeJoint], ImagerBox USING [Box], ImagerPath USING [ConicToProc, CurveToProc, LineToProc, MoveToProc, PathProc], ImagerPen USING [Pen], ImagerTransformation USING [Transformation], Real USING [LargestNumber], Vector2 USING [VEC]; ImagerStroke: CEDAR DEFINITIONS ~ BEGIN VEC: TYPE ~ Vector2.VEC; VertexIndex: TYPE ~ NAT; maxReal: REAL ~ Real.LargestNumber; bigBox: ImagerBox.Box ~ [xmin: -maxReal, ymin: -maxReal, xmax: maxReal, ymax: maxReal]; EndCode: TYPE ~ INT; warningSquareEnd: EndCode ~ -1; squareEnd: EndCode ~ ORD[Imager.StrokeEnd.square]; buttEnd: EndCode ~ ORD[Imager.StrokeEnd.butt]; roundEnd: EndCode ~ ORD[Imager.StrokeEnd.round]; JointCode: TYPE ~ INT; miterJoint: JointCode ~ ORD[Imager.StrokeJoint.miter]; bevelJoint: JointCode ~ ORD[Imager.StrokeJoint.bevel]; roundJoint: JointCode ~ ORD[Imager.StrokeJoint.round]; SignalSquareEndWithNoDirection: PROC; PathFromStroke: PROC [path: ImagerPath.PathProc, closed: BOOL, pen: ImagerPen.Pen, end: EndCode, joint: JointCode, m: ImagerTransformation.Transformation, moveTo: ImagerPath.MoveToProc, lineTo: ImagerPath.LineToProc, conicTo: ImagerPath.ConicToProc, box: ImagerBox.Box ¬ bigBox, pathT: ImagerTransformation.Transformation ¬ NIL, miterLimit: REAL ¬ 0]; PathFromVector: PROC [p0, p1: VEC, pen: ImagerPen.Pen, end: EndCode, m: ImagerTransformation.Transformation, moveTo: ImagerPath.MoveToProc, lineTo: ImagerPath.LineToProc]; PenStroke: PROC [path: ImagerPath.PathProc, pen: ImagerPen.Pen, closed: BOOL, moveTo: ImagerPath.MoveToProc, lineTo: ImagerPath.LineToProc, conicTo: ImagerPath.ConicToProc, end: PROC [p: VEC, v: VEC, i0, i1: VertexIndex], joint: PROC [p: VEC, v0, v1: VEC, i0, i1: VertexIndex], box: ImagerBox.Box, cull: BOOL ¬ FALSE ]; MeasurePath: PROC [path: ImagerPath.PathProc, closed: BOOL ¬ FALSE] RETURNS [REAL]; Dashes: PROC [path: ImagerPath.PathProc, patternLen: NAT, pattern: PROC [i: NAT] RETURNS [REAL], offset, length: REAL, moveTo: ImagerPath.MoveToProc, lineTo: ImagerPath.LineToProc, conicTo: ImagerPath.ConicToProc, curveTo: ImagerPath.CurveToProc, closed: BOOL ¬ FALSE ]; FindVertex: PROC [pen: ImagerPen.Pen, direction: VEC, i: NAT ¬ 0] RETURNS [NAT]; ConvolvePenWithPath: PROC [path: ImagerPath.PathProc, pen: ImagerPen.Pen, moveTo: ImagerPath.MoveToProc, lineTo: ImagerPath.LineToProc]; MapBitPath: PROC [byte: BYTE, p0, v1, v2: VEC, moveTo: ImagerPath.MoveToProc, lineTo: ImagerPath.LineToProc]; END. , ImagerStroke.mesa Copyright Σ 1984, 1985, 1986, 1987, 1989, 1991 by Xerox Corporation. All rights reserved. Michael Plass, August 17, 1991 0:27 am PDT Doug Wyatt, February 24, 1986 4:13:34 pm PST A special encoding to indicate that a signal ought to be raised when a square end is requested for a zero-length trajectory. Raises the appropriate signal (currently Imager.Warning); provided so the error description is in only one place. 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. If pathT # NIL, then the path coordinates will be transformed by pathT, otherwise they will be transformed by m. miterLimit controls when to bevel joints if joint is miter. If miterLimit is less than 1, then miterJoints always go through. thickening compensates for marking process, and can have negative values (for thinning). Similar to PathFromStroke with path ~ { moveTo[p0]; lineTo[p1] }; 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. Computes an approximation to the arc length of the path. Produces dash segments, given a path and dash specification. If closed is TRUE, then Dashes will perform a lineto[firstPoint] at the end of each trajectory of the provided path. Finds the vertex of the pen that is farthest in the given direction; i provides the initial guess. Useful for enlarging an outline, provided it meets some fairly restrictive conditions. The path must be wrapped in a counterclockwise direction, and must consist only of line segments. Turns eight bits into a counterclockwise path; this is a utility for the code that renders bitmaps by using the show machinery. Κό•NewlineDelimiter –(cedarcode) style™code™Kšœ ΟeœO™ZK™*K™,—K˜šΟk ˜ Kšœžœ˜&Kšœ žœ˜Kšœ žœ>˜NKšœ žœ˜Kšœžœ˜,Kšœžœ˜Kšœžœžœ˜—K˜KšΠbl œžœž ˜šœž˜K˜Kšžœžœ žœ˜—˜Kšœ žœžœ˜Kšœ žœ˜#šœW˜WK˜—šœ žœžœ˜šœ˜K™|—Kšœžœ˜2Kšœžœ˜.Kšœžœ˜0K˜—šœ žœžœ˜Kšœžœ˜6Kšœžœ˜6Kšœžœ˜6K˜—šΟnœžœ˜%K™qK˜—š  œžœ%žœˆžœžœ˜ΰKšœψ™ψKšœp™pKšœ™KšœX™XK™K™—š œžœ žœŠ˜«KšœA™AK™—š  œžœ9žœgžœžœžœ žœžœ žœ2žœžœ˜ΑKšœΩ™ΩK˜—K˜š   œžœ%žœžœžœžœ˜SK™8K˜—š œžœ*žœ žœžœžœžœžœŒžœžœ˜‘K™²K™—š   œžœ!žœžœžœžœ˜P™bK™——š œžœo˜ˆK™ΉK˜—š  œžœžœžœ@˜mK™K™——Kšžœ˜K˜—…— œΔ