-- CGPath.mesa
-- Last changed by Doug Wyatt, September 15, 1982 5:39 pm
DIRECTORY
GraphicsBasic USING [Box, Path, Vec];
CGPath: CEDAR DEFINITIONS = { OPEN GraphicsBasic;
Ref: TYPE = GraphicsBasic.Path;
Error: ERROR; -- indicates a bug in the implementation
New: PROC[size: NAT ← 0] RETURNS[Ref];
-- create a new path object with given initial size
Reset: PROC[self: Ref];
-- empty the path
Empty: PROC[self: Ref] RETURNS[BOOLEAN];
-- is the path empty?
LastPoint: PROC[self: Ref] RETURNS[Vec];
-- return the path's current last point (lp)
MoveTo: PROC[self: Ref, p: Vec];
-- begin a new trajectory at p
LineTo: PROC[self: Ref, p: Vec];
-- extend a straight line segment to p
CurveTo: PROC[self: Ref, b1, b2, b3: Vec];
-- extend a cubic curve segment to b3
-- the curve's Bezier control points are lp, b1, b2, b3
Rectangle: PROC[self: Ref, p, q: Vec];
-- add a rectangular trajectory to the path
Bounds: PROC[self: Ref] RETURNS[Box];
-- return a bounding box for the current path
Generate: PROC[self: Ref, move: PROC[Vec], line: PROC[Vec], curve: PROC[Vec, Vec, Vec]];
-- generate the current path
MapAndFilter: PROC[self: Ref, map: PROC[Vec] RETURNS[Vec] ← NIL,
move: PROC[Vec], line: PROC[Vec], curve: PROC[Vec, Vec, Vec], close: PROC];
-- generate the current path, filtering out degeneracies
-- optionally, map points before filtering
Copy: PROC[self: Ref] RETURNS[Ref];
-- make a copy of the path
Assign: PROC[self: Ref, copy: Ref];
-- restore the path from another path
}.