--GraphicsToImager.cm
--Maureen Stone December 9, 1983 4:49 pm
--Types
Path
Trajectory, Polygon, Outline
DeviceRef
--eliminated
baseMark, Box, DeviceRef, Mark, nullMark, YMode, PaintMode
--new
PixelArray, Transformation, Visibility, Pair, RopeOrRefText, IntPair, IntRectangle
GetCP:
PROC[self: Context, rounded:
BOOLEAN]
RETURNS[x,y:
REAL],
use IGet;
SetCP:
PROC[self: Context, x,y:
REAL, rel:
BOOLEAN],
SetXY: PROC[context: Context, p: Pair];
and more...
DrawTo:
PROC[self: Context, x,y:
REAL, rel:
BOOLEAN],
gone?
Path operators. The semantics of paths have changed some. A Graphics.Path is equivalent to an Imager.Outline. An Imager.Outline is a list of Imager.Trajectory. An Imager.Trajectory is a single geometric trace or loop. You only need to build an outline if you have a closed path with holes. All trajectory operations are of the form:
trajectory ← op[trajectory];
You start a Trajectory by doing a MoveTo, add to it by using LineTo, CurveTo, etc.
NewPath:
PROC[size:
INT ← 0]
RETURNS[Path];
--part of MoveTo
LastPoint:
PROC[self: Path]
RETURNS[x, y:
REAL];
LastPoint: PROC[t: Trajectory] RETURNS[Pair];
FlushPath:
PROC[self: Path];
--gone
MoveTo:
PROC[self: Path, x, y:
REAL, flush:
BOOLEAN ←
TRUE];
MoveTo: PROC[p: Pair] RETURNS[Trajectory];
LineTo:
PROC[self: Path, x, y:
REAL];
LineTo: PROC[t: Trajectory, p: Pair] RETURNS[Trajectory];
LineToX: PROC[t: Trajectory, x: REAL] RETURNS[Trajectory];
LineToY: PROC[t: Trajectory, y: REAL] RETURNS[Trajectory];
CurveTo:
PROC[self: Path, x1, y1, x2, y2, x3, y3:
REAL];
CurveTo: PROC[t: Trajectory, p1, p2, p3: Pair] RETURNS[Trajectory];
ConicTo: PROC[t: Trajectory, p1, p2: Pair, r: REAL] RETURNS[Trajectory];
ArcTo: PROC[t: Trajectory, p1, p2: Pair] RETURNS[Trajectory];
Rectangle:
PROC[self: Path, x0, y0, x1, y1:
REAL];
MaskRectangle: PROC[context: Context, x, y, w, h: REAL];
IntegerMaskRectangle: PROC[context: Context, x, y, w, h: INTEGER];
ClipRectangle: PROC[context: Context, x, y, w, h: REAL];
IntegerClipRectangle: PROC[context: Context, x, y, w, h: INTEGER];
IntegerExcludeRectangle: PROC[context: Context, x, y, w, h: INTEGER];
--drawing routines
DrawStroke: PROC[self: Context, path: Path, width: REAL, closed: BOOLEAN, ends: StrokeEnds],
DrawArea: PROC[self: Context, path: Path, parityFill: BOOLEAN],
DrawBox: PROC[self: Context, box: Box],
DrawImage: PROC[self: Context, image: ImageRef, raw: BOOLEAN],
Translate: PROC[self: Context, tx,ty: REAL, round: BOOLEAN],
Concat: PROC[self: Context, m11,m12,m21,m22: REAL],
WorldToUser: PROC[self: Context, wx,wy: REAL] RETURNS[x,y: REAL],
UserToWorld: PROC[self: Context, x,y: REAL] RETURNS[wx,wy: REAL],
SetColor: PROC[self: Context, color: Color],
GetColor: PROC[self: Context] RETURNS[Color],
SetPaintMode: PROC[self: Context, mode: PaintMode] RETURNS[PaintMode],
SetFat: PROC[self: Context, fat: BOOLEAN] RETURNS[BOOLEAN],
GetDefaultFont: PROC[self: Context] RETURNS[FontRef],
SetDefaultFont: PROC[self: Context, font: FontRef],
DrawChars: PROC[self: Context, font: FontRef, map: PROC[PROC[CHAR] RETURNS[BOOL]]],
ClipArea: PROC[self: Context, path: Path, parityFill: BOOLEAN, exclude: BOOLEAN],
ClipBox: PROC[self: Context, box: Box, exclude: BOOLEAN],
IsPointVisible: PROC[self: Context, x,y: REAL] RETURNS[BOOLEAN],
IsRectangular: PROC[self: Context] RETURNS[BOOLEAN],
GetBounds: PROC[self: Context] RETURNS[Box],
Visible: PROC[self: Context] RETURNS[BOOLEAN],
Save: PROC[self: Context] RETURNS[Mark],
Restore: PROC[self: Context, mark: Mark],
DrawBits: UNSAFE PROC[self: Context,
base: LONG POINTER, raster: CARDINAL, bitsPerPixel: [0..16),
x, y, w, h: CARDINAL, xorigin, yorigin: INTEGER],
UserToDevice: PROC[self: Context, x, y: REAL, rel: BOOLEAN] RETURNS[tx, ty: REAL],
DeviceToUser: PROC[self: Context, tx, ty: REAL, rel: BOOLEAN] RETURNS[x, y: REAL],
GetYMode: PROC[self: Context] RETURNS[GraphicsBasic.YMode],
SetYMode: PROC[self: Context, mode: GraphicsBasic.YMode],
DrawTexturedBox: PROC[self: Context, box: Box, texture: GraphicsBasic.Texture],
Disable: PROC[self: Context],
MoveDeviceRectangle: PROC[self: Context, width, height, fromX, fromY, toX, toY: NAT]
];