ImagerStroke.mesa
Copyright © 1984 Xerox Corporation. All rights reserved.
Michael Plass, February 6, 1984 1:34:15 pm PST
Doug Wyatt, September 17, 1984 1:15:29 pm PDT
DIRECTORY
ImagerPath USING [PathProc],
ImagerScanConverter USING [DevicePath, DeviceRectangle],
ImagerTransformation USING [Transformation],
Vector2 USING [VEC];
ImagerStroke: CEDAR DEFINITIONS
~ BEGIN
VEC: TYPE ~ Vector2.VEC;
DevicePath: TYPE ~ ImagerScanConverter.DevicePath;
DeviceRectangle: TYPE ~ ImagerScanConverter.DeviceRectangle;
StrokeStyle: TYPE ~ {
square, -- Square off ends after extending the stroke by half its width
butt, -- Square off ends flush with the endpoint
round, -- Round ends with a semicircular cap
roundWithRoundJoints -- Round ends and joints
};
DevicePathFromStroke: PROC [
pathProc: ImagerPath.PathProc, pathData: REF,
width: REAL, style: StrokeStyle, closed: BOOL,
clientToDevice: ImagerTransformation.Transformation,
clipBox: DeviceRectangle,
scratch: DevicePath ← NIL -- for re-use of storage
] RETURNS [devicePath: DevicePath];
Bezier: TYPE ~ RECORD [b0, b1, b2, b3: VEC]; -- Bezier control points for a cubic curve
Subdivide: PROC [bezier: Bezier, vertex: PROC[VEC], tolerance: REAL ← 0.5];
FlatBezier: PROC [bezier: Bezier, epsilon: REAL] RETURNS [BOOLEAN];
Split: PROC [bezier: Bezier] RETURNS[firstHalf, secondHalf: Bezier];
END.