-- PolygonPen.mesa -- Michael Plass, DIRECTORY Cubic USING [Bezier], Vector USING [Vec]; -- This module provides for the conversion of pen-drawn spline curves to spline-bounded outlines. The simplest kind of pen handled here is the broad pen, which is just a line segment. Polygonal-pen strokes are built up by means of multiple broad-pen strokes. PolygonPen: DEFINITIONS = BEGIN Pen: TYPE = REF PenRec; PenRec: TYPE = RECORD[point: SEQUENCE n:NAT OF Vector.Vec]; -- The points define the outline of the polygon, with the reference point at the origin. Bezier: TYPE = Cubic.Bezier; Vec: TYPE = Vector.Vec; -- a broad pen is represented as a vector, with the reference point at the origin. -- The results are sent by calling procedures of the following types: MoveToProc: TYPE = PROCEDURE [z0: Vec]; LineToProc: TYPE = PROCEDURE [z1: Vec]; CurveToProc: TYPE = PROCEDURE [z1, z2, z3: Vec]; -- three Bezier control points. z3 is the new last point. SimpleStroke: PROCEDURE [pen: Vec, curve: Bezier, moveTo: MoveToProc, lineTo:LineToProc, curveTo:CurveToProc]; -- for when the interior of the curve is known never to be parallel to the pen BroadStroke: PROCEDURE [pen: Vec, curve: Bezier, moveTo: MoveToProc, lineTo:LineToProc, curveTo:CurveToProc]; -- for a compound stroke with a broad pen. Dot: PROCEDURE [pen: Pen, point: Vector.Vec, moveTo: MoveToProc, lineTo:LineToProc, curveTo:CurveToProc]; Line: PROCEDURE [pen: Pen, startPoint,endPoint: Vector.Vec, moveTo: MoveToProc, lineTo:LineToProc, curveTo:CurveToProc]; Stroke: PROCEDURE [pen: Pen, curve: Bezier, moveTo: MoveToProc, lineTo:LineToProc, curveTo:CurveToProc]; END.