The Imager Class
Class: TYPE ~ REF ClassRep;
ClassRep:
TYPE ~
RECORD [
type: ATOM ¬,
Class operations for maintaining the imager state; see ImagerState for default implementations.
Save: PROC [context: Context, all: BOOL] RETURNS [REF] ¬,
Restore: PROC [context: Context, ref: REF] ¬,
SetInt: PROC [context: Context, key: IntKey, val: INT] ¬,
SetReal: PROC [context: Context, key: RealKey, val: REAL] ¬,
SetT: PROC [context: Context, m: Transformation] ¬,
SetFont: PROC [context: Context, font: Font] ¬,
SetColor: PROC [context: Context, color: Color] ¬,
SetClipper: PROC [context: Context, clipper: Clipper] ¬,
GetInt: PROC [context: Context, key: IntKey] RETURNS [INT] ¬,
GetReal: PROC [context: Context, key: RealKey] RETURNS [REAL] ¬,
GetT: PROC [context: Context] RETURNS [Transformation] ¬,
GetFont: PROC [context: Context] RETURNS [Font] ¬,
GetColor: PROC [context: Context] RETURNS [Color] ¬,
GetClipper: PROC [context: Context] RETURNS [Clipper] ¬,
ConcatT: PROC [context: Context, m: Transformation] ¬,
Scale2T: PROC [context: Context, s: VEC] ¬,
RotateT: PROC [context: Context, a: REAL] ¬,
TranslateT: PROC [context: Context, t: VEC] ¬,
Move: PROC [context: Context, rounded: BOOL] ¬,
SetXY: PROC [context: Context, p: VEC] ¬,
SetXYRel: PROC [context: Context, v: VEC] ¬,
GetCP: PROC [context: Context, rounded: BOOL] RETURNS [VEC] ¬,
StartUnderline: PROC [context: Context] ¬,
MaskUnderline: PROC [context: Context, dy, h: REAL] ¬,
CorrectMask: PROC [context: Context] ¬,
CorrectSpace: PROC [context: Context, v: VEC] ¬,
Space: PROC [context: Context, x: REAL] ¬,
SetCorrectMeasure: PROC [context: Context, v: VEC] ¬,
SetCorrectTolerance: PROC [context: Context, v: VEC] ¬,
Correct: PROC [context: Context, action: PROC] ¬,
DontCorrect: PROC [context: Context, action: PROC, saveCP: BOOL] ¬,
SetGray: PROC [context: Context, f: REAL] ¬,
SetSampledColor: PROC [context: Context, pa: PixelArray, m: Transformation, colorOperator: ColorOperator] ¬,
SetSampledBlack: PROC [context: Context, pa: PixelArray, m: Transformation, clear: BOOL] ¬,
Clip: PROC [context: Context, path: PathProc, oddWrap: BOOL, exclude: BOOL] ¬,
ClipRectangle: PROC [context: Context, r: Rectangle, exclude: BOOL] ¬,
ClipRectangleI: PROC [context: Context, x, y, w, h: INTEGER, exclude: BOOL] ¬,
Essential class operations; must be supplied by the particular implementation.
Show: PROC [context: Context, string: XStringProc, xrel: BOOL] ¬,
ShowBackward: PROC [context: Context, string: XStringProc] ¬,
MaskFill: PROC [context: Context, path: PathProc, oddWrap: BOOL] ¬,
MaskRectangle: PROC [context: Context, r: Rectangle] ¬,
MaskStroke: PROC [context: Context, path: PathProc, closed: BOOL] ¬,
MaskPixel: PROC [context: Context, pa: PixelArray] ¬,
Convenience operations; default implementations express these in terms of the essential ones.
ShowAndFixedXRel: PROC [context: Context, string: XStringProc, x: REAL] ¬,
ShowText: PROC [context: Context, text: REF READONLY TEXT, start, len: NAT, xrel: BOOL] ¬,
MaskRectangleI: PROC [context: Context, x, y, w, h: INTEGER] ¬,
MaskVector: PROC [context: Context, p1, p2: VEC] ¬,
MaskDashedStroke: PROC [context: Context, path: PathProc, patternLen: NAT, pattern: PROC [NAT] RETURNS [REAL], offset, length: REAL] ¬,
MaskBitmap: PROC [context: Context, bitmap: SampleMap, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC] ¬,
DrawBitmap: PROC [context: Context, bitmap: SampleMap, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC] ¬,
DrawPixels: PROC [context: Context, pixelMap: PixelMap, colorOperator: ColorOperator, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC] ¬,
DoIfVisible: PROC [context: Context, r: Rectangle, action: PROC] ¬,
DoWithBuffer: PROC [context: Context, action: PROC, x, y, w, h: INTEGER, backgroundColor: Color] ¬,
DrawObject: PROC [context: Context, object: Object, position: VEC, interactive: BOOL] ¬,
View and raster operations; default implementations default benignly or raise an appropriate error.
GetBounds: PROC [context: Context] RETURNS [Rectangle] ¬,
ViewReset: PROC [context: Context] ¬,
ViewTranslateI: PROC [context: Context, x, y: INTEGER] ¬,
ViewClip: PROC [context: Context, path: PathProc, oddWrap: BOOL, exclude: BOOL] ¬,
ViewClipRectangleI: PROC [context: Context, x, y, w, h: INTEGER, exclude: BOOL] ¬,
GetTransformation: PROC [context: Context, from, to: CoordSys] RETURNS [Transformation] ¬,
Transform: PROC [context: Context, v: VEC, from, to: CoordSys, vec: BOOL] RETURNS [VEC] ¬,
MoveViewRectangle: PROC [context: Context, width, height, fromX, fromY, toX, toY: INTEGER] ¬,
TestViewRectangle: PROC [context: Context, x, y, w, h: INTEGER] RETURNS [Visibility] ¬,
GetBufferColorOperator: PROC [context: Context] RETURNS [ColorOperator],
AccessBuffer: PROC [context: Context, action: PROC [pixelMap: PixelMap], path: PathProc, oddWrap: BOOL],
SaveBuffer: PROC [context: Context, id: ATOM, path: PathProc, oddWrap: BOOL],
RestoreBuffer: PROC [context: Context, id: ATOM],
DiscardBuffer: PROC [context: Context, id: ATOM],
propList: Prop.PropList ¬ NIL
];
Default implementations for the convenience operators.
DefaultShowAndFixedXRel: PROC [context: Context, string: XStringProc, x: REAL];
DefaultShowText: PROC [context: Context, text: REF READONLY TEXT, start, len: NAT, xrel: BOOL];
DefaultMaskRectangleI: PROC [context: Context, x, y, w, h: INTEGER];
DefaultMaskVector: PROC [context: Context, p1, p2: VEC];
DefaultMaskDashedStroke: PROC [context: Context, path: PathProc, patternLen: NAT, pattern: PROC [NAT] RETURNS [REAL], offset, length: REAL];
DefaultMaskBitmap: PROC [context: Context, bitmap: SampleMap, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC];
DefaultDrawBitmap: PROC [context: Context, bitmap: SampleMap, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC];
DefaultDrawPixels: PROC [context: Context, pixelMap: PixelMap, colorOperator: ColorOperator, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC];
DefaultDoWithBuffer: PROC [context: Context, action: PROC, x, y, w, h: INTEGER, backgroundColor: Color];
DefaultDrawObject: PROC [context: Context, object: Object, position: VEC, interactive: BOOL];
Default implementations for the view operations.
DefaultDoIfVisible: PROC [context: Context, r: Rectangle, action: PROC];
DefaultGetBounds: PROC [context: Context] RETURNS [Rectangle];
DefaultViewReset: PROC [context: Context];
DefaultViewTranslateI: PROC [context: Context, x, y: INTEGER];
DefaultViewClip: PROC [context: Context, path: PathProc, oddWrap: BOOL, exclude: BOOL];
DefaultViewClipRectangleI: PROC [context: Context, x, y, w, h: INTEGER, exclude: BOOL];
DefaultTransform: PROC [context: Context, v: VEC, from, to: CoordSys, vec: BOOL] RETURNS [VEC];
DefaultGetTransformation: PROC [context: Context, from, to: CoordSys] RETURNS [Transformation];
DefaultMoveViewRectangle: PROC [context: Context, width, height, fromX, fromY, toX, toY: INTEGER];
DefaultTestViewRectangle:
PROC [context: Context, x, y, w, h:
INTEGER]
RETURNS [Visibility];
DefaultGetBufferColorOperator: PROC [context: Context] RETURNS [ColorOperator];
DefaultAccessBuffer: PROC [context: Context, action: PROC [pixelMap: PixelMap], path: PathProc, oddWrap: BOOL];
DefaultSaveBuffer: PROC [context: Context, id: ATOM, path: PathProc, oddWrap: BOOL];
DefaultRestoreBuffer: PROC [context: Context, id: ATOM];
DefaultDiscardBuffer:
PROC [context: Context, id:
ATOM];