Heading:
Revisions to Cedar Graphics
Page Numbers: Yes X: 527 Y: 10.5"
Inter-Office Memorandum
ToCedar InterestDateJanuary 15, 1981
FromDoug WyattLocationPalo Alto
SubjectRevisions to Cedar GraphicsOrganizationPARC/ISL
XEROX
Filed on: [Ivy]<CedarDocs>User>CedarGraphicsRevision.memo
Introduction
The current interface to the Cedar Graphics package is inconsistent or confusing in some aspects, deficient in others. This memo describes a revised Graphics interface which addresses several of these problems.
First Major Topic
Text is in font 0 (TimesRoman 10) Declarations of Mesa types and variables are in font 6 (Helvetica 10), bold. When they first appear in a definitional context, they are also italicized.
Subheading
Text text text..
Type, variable, procedure, and error definitions are extracted from the corresponding definitions files, formatted as shown in the following examples. These were modeled after the Pilot manual. Everything is Helvetica bold; interface names and Mesa reserved words are in font 7 (Helvetica 8.) All names are fully qualified, and if a type definition is simply a copy of another, the real definition is supplied along with the renaming definition.
Graphics.Context: TYPE = REF Graphics.ContextObject;
Graphics.ContextObject: TYPE; -- opaque
Graphics.Device: TYPE = REF OpaqueGraphics.DeviceObject;
OpaqueGraphics.DeviceObject: TYPE; -- opaque
Graphics.Image: TYPE = REF OpaqueGraphics.ImageObject;
OpaqueGraphics.ImageObject: TYPE; -- opaque
Discussion of functions and types may precede or follow the definitions; Except that they appear on their own lines and in funny fonts, the definitions should occur naturally within the prose discussions. Fine points, as usual, appear in font 0.
Display Contexts
Text text text..
Graphics.NewContext: PROC[device: Graphics.Device ← NIL] RETURNS[Graphics.Context];
Color
Text text text..
Graphics.Color: TYPE = LONG CARDINAL;
black: Graphics.Color = ... ;
white: Graphics.Color = ... ;
Graphics.PressColor: PROC[hue, saturation, brightness: [0..256)] RETURNS[Graphics.Color];
Graphics.SetColor: PROC[self: Graphics.Context, color: Graphics.Color];
Graphics.GetColor: PROC[self: Graphics.Context] RETURNS[Graphics.Color];
Graphics.PushColor: PROC[self: Graphics.Context];
Graphics.PopColor: PROC[self: Graphics.Context];
Transformations
These are for redefining the coordinate system.
Graphics.Translate: PROC[self: Graphics.Context, tx,ty: REAL];
Graphics.Scale: PROC[self: Graphics.Context, s: REAL];
Graphics.Rotate: PROC[self: Graphics.Context, angle: REAL];
Graphics.Concat: PROC[self: Graphics.Context, m11,m12,m21,m22: REAL];
Graphics.Map: PROC[sc,dc: Graphics.Context, sx,sy: REAL] RETURNS[dx,dy: REAL];
Graphics.UserToWorld: PROC[self: Graphics.Context, ux,uy: REAL] RETURNS[wx,wy: REAL];
Graphics.WorldToUser: PROC[self: Graphics.Context, wx,wy: REAL] RETURNS[ux,uy: REAL];
The Position
Routines dealing with the current position.
Graphics.GetPosition: PROC[self: Graphics.Context] RETURNS[x,y: REAL];
Graphics.PushPosition: PROC[self: Graphics.Context];
Graphics.PopPosition: PROC[self: Graphics.Context];
Paths
These are for drawing lines and filled areas.
Graphics.Point: PROC[self: Graphics.Context, x,y: REAL];
Graphics.RelPoint: PROC[self: Graphics.Context, dx,dy: REAL];
Graphics.Curve: PROC[self: Graphics.Context, x1,y1,x2,y2,x3,y3: REAL];
Graphics.Close: PROC[self: Graphics.Context];
Graphics.Rectangle: PROC[self: Graphics.Context, x0,y0,x1,y1: REAL];
Graphics.BeginArea: PROC[self: Graphics.Context, oddEven: BOOLEANFALSE];
Graphics.LineStyle: TYPE = {round, flat, miter};
Graphics.BeginLine: PROC[self: Graphics.Context,
width:
REAL ← 0, closed: BOOLEANFALSE, style: Graphics.LineStyle];
Graphics.AbortPath: PROC[self: Graphics.Context];
Graphics.ShowPath: PROC[self: Graphics.Context];
Graphics.ClipPath: PROC[self: Graphics.Context];
Text
Here is an introductory sentence.
Graphics.FontId: TYPE[1];
Graphics.Face: TYPE = [0..377B];
Graphics.RegularFace: PROC[bold, italic: BOOLEANFALSE] RETURNS[Graphics.Face];
Graphics.MakeFont: PROC[family: ATOM, face: Graphics.Face] RETURNS[Graphics.FontId];
Graphics.SetFont: PROC[self: Graphics.Context,
font:
Graphics.FontId, size: REAL];
Graphics.ShowChar: PROC[self: Graphics.Context, c: CHARACTER];
Graphics.ShowText: PROC[self: Graphics.Context, text: REF READONLY TEXT];
Graphics.CharWidth: PROC[self: Graphics.Context, c: CHARACTER] RETURNS[REAL];
Graphics.FontBox: PROC[self: Graphics.Context] RETURNS[xmin,ymin,xmax,ymax: REAL];
Clipping and Bounding Boxes
Here is an introductory sentence.
Graphics.BoundingBox: TYPE = RECORD[xmin,xmax,ymin,ymax: REAL];
Graphics.BeginBox: PROC[self: Graphics.Context];
Graphics.EndBox: PROC[self: Graphics.Context] RETURNS[Graphics.BoundingBox];
Graphics.PushBox: PROC[self: Graphics.Context, box: Graphics.BoundingBox];
Graphics.PopBox: PROC[self: Graphics.Context];
Graphics.Visible: PROC[self: Graphics.Context] RETURNS[BOOLEAN];
More discussion.