GriffinImageUtils.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Eric Nickell, July 30, 1985 12:38:22 pm PDT
DIRECTORY
BasicTime USING [GMT],
CubicSplines USING [SplineType],
GFileFormatDefs USING [GFileHardcopyController, ValidFigRange],
Imager USING [Context],
Vector2 USING [VEC],
Rope USING [ROPE];
GriffinImageUtils: CEDAR DEFINITIONS
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
VEC: TYPE ~ Vector2.VEC;
ValidFigRange: TYPE ~ GFileFormatDefs.ValidFigRange;
GriffinImage: TYPE ~ REF GriffinImageRep;
GriffinImageRep: TYPE ~ RECORD [
header: Header,
figures: SEQUENCE nFigures: ValidFigRange OF Figure
];
Header: TYPE ~ REF HeaderRep;
HeaderRep: TYPE ~ RECORD [
majorVersion, minorVersion: CARDINAL, --Major & minor version numbers
createTime: BasicTime.GMT,
creatorName, portfolioName: ROPE
];
Figure: TYPE ~ REF FigureRep;
FigureRep: TYPE ~ RECORD [
font: FontDir,
display: DisplayController,
hardcopy: HardcopyController,
styles: Styles,
objects: Objects,
name: ROPE
];
HardcopyController: TYPE ~ GFileFormatDefs.GFileHardcopyController;
DisplayController: TYPE ~ RECORD [
centerX: CARDINAL,
centerY: CARDINAL,
width: CARDINAL,
height: CARDINAL,
xScale: REAL,
yScale: REAL,
gridXo: REAL,
gridYo: REAL,
gridSize: CARDINAL,
pairs: LIST OF ControlPair
];
ControlPair: TYPE ~ RECORD [
color: Color,
grey: CARDINAL
];
FontDir: TYPE ~ REF FontDirRep;
FontDirRep: TYPE ~ RECORD [
SEQUENCE nFonts: CARDINAL OF Font
];
Font: TYPE ~ RECORD [
points, face, rotation: CARDINAL,
name: ROPE
];
Styles: TYPE ~ REF StylesRep;
StylesRep: TYPE ~ RECORD [
SEQUENCE nStyles: CARDINAL OF Style
];
Style: TYPE ~ REF StyleRep;
StyleRep: TYPE ~ RECORD [
color, areaColor, textBackgroundColor: Color,
fillArea, outlineArea, useTextBackground: BOOLEAN,
beginning, end: End,
thickness: REAL,
font: CARDINAL,   --Index into FontDir
dashedness: [0..15],   --0=not dashed, 1-7=various sizes
anchor: TextAnchor,
junction: Junction,
textRotation: Direction,
styleName: ROPE
];
Color: TYPE ~ RECORD [
hue, saturation, brightness: CARDINAL
];
End: TYPE ~ RECORD [
type: EndType,
dx, dy: REAL, --Meaningful only if type=flat or angled
a, b, c: REAL--Meaningful only if type=angled
];
EndType: TYPE ~ {round, cyclic, flat, angled};
TextAnchor: TYPE ~ {left, center, right};
Junction: TYPE ~ {round, square, angled};
Direction: TYPE ~ {d0, d90, d180, d270};
Objects: TYPE ~ REF ObjectsRep;
ObjectsRep: TYPE ~ RECORD [
SEQUENCE nObjects: CARDINAL OF Object
];
Object: TYPE ~ REF ObjectRep;
ObjectRep: TYPE ~ RECORD [
hidden: BOOLEAN,  --FALSE=main window, TRUE=hidden window
visibility: Visibility,
style: CARDINAL,  --Index into Style
cluster: CARDINAL,
variant: Variant
];
Variant: TYPE ~ RECORD [
SELECT type: ObjectType FROM
caption => [caption: CaptionPart],
token => [token: TokenPart],
curve, area => [curve: CurvePart]
ENDCASE
];
Visibility: TYPE ~ {partlyVisible, entirelyVisible, inVisible};
ObjectType: TYPE ~ {caption, token, curve, area};
CaptionPart: TYPE ~ RECORD [
position: VEC,
text: ROPE
];
TokenPart: TYPE ~ RECORD [
x, y: INTEGER,
type: TokenType
];
TokenType: TYPE ~ {cp, center, gridOrigin};
CurvePart: TYPE ~ RECORD [
SELECT type: * FROM
linked => [linked: LinkPart],
cyclicSpline => [cyclicSpline: CyclicSplinePart]
ENDCASE
];
LinkPart: TYPE ~ REF LinkPartRep;
LinkPartRep: TYPE ~ RECORD [
splineType: CubicSplines.SplineType,
links: SEQUENCE nLinks: CARDINAL OF Link
];
Link: TYPE ~ REF LinkRep;
LinkRep: TYPE ~ RECORD [
degree: [0..7],
knots: SEQUENCE nKnots: CARDINAL OF VEC
];
CyclicSplinePart: TYPE ~ RECORD [
splineType: CubicSplines.SplineType,
link: Link
];
ReadGriffinImage: PROC [name: ROPE] RETURNS [g: GriffinImage];
GriffinObjectToImagerCalls: PROC [context: Imager.Context, object: Object, style: Style, fonts: FontDir];
GriffinToImagerCalls: PROC [context: Imager.Context, g: GriffinImage];
END.