GGPath.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on September 24, 1986 9:32:33 pm PDT
Contents: Implements the various path classes in Gargoyle. Paths are parts of outlines. They are the editable versions of what the Imager calls Trajectories. One type of path is the familiar Gargoyle Traj.
DIRECTORY
GGBasicTypes, GGSegmentTypes, GGModelTypes, Imager, ImagerPath, ImagerTransformation, Rosary;
GGPath: CEDAR DEFINITIONS
IMPORTS Imager =
BEGIN
BoundBox: TYPE = GGBasicTypes.BoundBox;
Joint: TYPE = GGSegmentTypes.Joint;
Outline: TYPE = GGModelTypes.Outline;
Point: TYPE = GGBasicTypes.Point;
SelectedObjectData: TYPE = GGModelTypes.SelectedObjectData;
FenceHoleOpen: TYPE = {fence, hole, open};
Path: TYPE = REF PathObj;
PathObj: TYPE = RECORD [
class: PathClass,
data: REF ANY,
role: FenceHoleOpen,
parent: Outline,
boundBox: BoundBox,
visibleJoints: BOOLTRUE,
strokeJoint: Imager.StrokeJoint ← round,
loArrow, hiArrow: BOOLFALSE,
selectedInPart: SelectedObjectData
];
PathClass: TYPE = REF PathClassObj;
PathClassObj: TYPE = RECORD [
type: ATOM,
buildPath: BuildPathProc,
drawBorder: DrawBorderProc,
drawBorderTransformSeq: DrawBorderTransformPartsProc
];
BuildPathProc: TYPE = PROC [path: Path, moveTo: ImagerPath.MoveToProc, lineTo: ImagerPath.LineToProc,
curveTo: ImagerPath.CurveToProc, conicTo: ImagerPath.ConicToProc, arcTo: ImagerPath.ArcToProc];
DrawBorderProc: TYPE = PROC [path: Path, dc: Imager.Context];
DrawBorderTransformPartsProc: TYPE = PROC [pathD: PathDescriptor, dc: Imager.Context, transform: ImagerTransformation.Transformation];
PathDescriptor: TYPE = REF PathDescriptorObj;
PathDescriptorObj: TYPE = RECORD [
path: Path,
parts: PathParts
];
PathParts: TYPE = REF ANY;
TrajData: TYPE = REF TrajDataObj;
TrajDataObj: TYPE = RECORD [
segCount: NAT,
segments: Rosary.ROSARY,
joints: Rosary.ROSARY,
extraPoints: LIST OF Joint
];
FetchPathClass: PROC [type: ATOM] RETURNS [class: PathClass];
Traj
Segment: TYPE = GGSegmentTypes.Segment;
TrajEnd: TYPE = {lo, hi};
MakeTrajPath: PROC [point: Point] RETURNS [path: Path];
AddSegment: PROC [traj: Path, trajEnd: TrajEnd, seg: Segment, segEnd: TrajEnd] RETURNS [success: BOOL];
Moves seg so that the specified end of seg coincides with the specified end of traj. In other words, seg is translated. If success = FALSE, AddSegment sends an error message to GGError and returns.
Circle
MakeCirclePath: PROC [origin: Point, outerPoint: Point, strokeWidth: REAL ← 2.0, strokeColor: Imager.Color ← Imager.black, fillColor: Imager.Color ← NIL] RETURNS [path: Path];
END.