ImagerInline.mesa
Michael Plass, August 1, 1983 4:25 pm
Implements the same operations as Imager, saving a procedure call per operation. Object-style notation is not usable with this interface.
DIRECTORY Imager, ImagerBasic, Rope, UnifiedFonts;
ImagerInline: CEDAR DEFINITIONS ~ BEGIN
Rectangle: TYPE ~ Imager.Rectangle;
IntRectangle: TYPE ~ Imager.IntRectangle;
Pair: TYPE ~ Imager.Pair;
IntPair: TYPE ~ Imager.IntPair;
Context: TYPE ~ Imager.Context;
Transformation: TYPE ~ Imager.Transformation;
Clipper: TYPE ~ Imager.Clipper;
Visibility: TYPE ~ Imager.Visibility;
Path: TYPE ~ Imager.Path;
StrokeEnds: TYPE ~ Imager.StrokeEnds;
Color: TYPE ~ Imager.Color;
nullBounds: IntRectangle ~ [FIRST[INTEGER], FIRST[INTEGER], FIRST[INTEGER], FIRST[INTEGER]];
ClassRep: TYPE ~ RECORD [
deviceType: ATOM,
Init: PROC [context: Context, name: Rope.ROPE, bounds: IntRectangle],
DoSaveAll: PROC [context: Context, action: PROC],
DoSave: PROC [context: Context, action: PROC],
Flush: PROC [context: Context],
Close: PROC [context: Context],
TranslateT: PROC [context: Context, dx, dy: REAL],
RotateT: PROC [context: Context, degrees: REAL],
ScaleT: PROC [context: Context, sx, sy: REAL],
ConcatT: PROC [context: Context, transformation: Transformation],
GetT: PROC [context: Context] RETURNS [Transformation],
SetT: PROC [context: Context, transformation: Transformation],
IntTranslateT: PROC [context: Context, dx, dy: INTEGER],
IntScaleT: PROC [context: Context, sx, sy: INTEGER],
GetClipper: PROC [context: Context] RETURNS [Clipper],
SetClipper: PROC [context: Context, clipper: Clipper],
ClipPath: PROC [context: Context, outline: Path, exclude: BOOLEAN],
ClipRectangle: PROC [context: Context, outline: Rectangle, exclude: BOOLEAN],
TestRectangle: PROC [context: Context, area: Rectangle] RETURNS [Visibility],
ClipIntRectangle: PROC [context: Context, outline: IntRectangle, exclude: BOOLEAN],
TestIntRectangle: PROC [context: Context, area: IntRectangle] RETURNS [Visibility],
DoWithoutClipping: PROC [context: Context, bounds: IntRectangle, callBack: PROC[Context]],
SetColor: PROC [context: Context, color: Color],
GetColor: PROC [context: Context] RETURNS [Color],
MaskStroke: PROC [context: Context, path: Path, width: REAL, strokeEnds: StrokeEnds, closed: BOOLEANFALSE],
MaskFill: PROC [context: Context, path: Path],
MaskPixel: PROC [context: Context, pixelArray: ImagerBasic.PixelArray],
MaskBits: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, tile: IntRectangle, area: IntRectangle],
MaskSegment: PROC [context: Context, p: Pair],
MaskIntSegment: PROC [context: Context, p: IntPair],
MaskThinStroke: PROC [context: Context, path: Path],
MaskRectangle: PROC [context: Context, area: Rectangle],
MaskIntRectangle: PROC [context: Context, area: IntRectangle],
SetCP: PROC [context: Context, cp: Pair],
GetCP: PROC [context: Context] RETURNS [Pair],
SetIntCP: PROC [context: Context, cp: IntPair],
GetIntCP: PROC [context: Context] RETURNS [IntPair],
MaskChar: PROC [context: Context, font: UnifiedFonts.FONT, char: CHAR],
MaskCharacters: PROC [context: Context, font: UnifiedFonts.FONT, characters: REF, start: INT ← 0, length: INT],
TransferBuffer: PROC [context, source: Context],
SetView: PROC [context: Context, box: IntRectangle, halftoneOrigin: IntPair],
ClipView: PROC [context: Context, box: IntRectangle, exclude: BOOLEAN],
GetSurfaceBounds: PROC [context: Context] RETURNS [IntRectangle],
GetViewBounds: PROC [context: Context] RETURNS [IntRectangle],
MoveSurfaceRectangle: PROC [context: Context, source: IntRectangle, dest: IntPair] RETURNS [BOOLEAN],
SpecialOp: PROC [context: Context, op: ATOM, data: REF] RETURNS [BOOLEAN]
];
Class: PRIVATE PROC [context: Context] RETURNS [REF ClassRep]
~ INLINE {RETURN[NARROW[context.class]]};
DeviceType: PROC [context: Context] RETURNS [ATOM]
~ INLINE {RETURN [Class[context].deviceType]};
DoSaveAll: PROC [context: Context, action: PROC]
~ INLINE {Class[context].DoSaveAll[context, action]};
DoSave: PROC [context: Context, action: PROC]
~ INLINE {Class[context].DoSave[context, action]};
Flush: PROC [context: Context]
~ INLINE {Class[context].Flush[context]};
Close: PROC [context: Context]
~ INLINE {Class[context].Close[context]};
TranslateT: PROC [context: Context, dx, dy: REAL]
~ INLINE {Class[context].TranslateT[context, dx, dy]};
IntScaleT: PROC [context: Context, sx, sy: INTEGER]
~ INLINE {Class[context].IntScaleT[context, sx, sy]};
RotateT: PROC [context: Context, degrees: REAL]
~ INLINE {Class[context].RotateT[context, degrees]};
ScaleT: PROC [context: Context, sx, sy: REAL]
~ INLINE {Class[context].ScaleT[context, sx, sy]};
ConcatT: PROC [context: Context, transformation: Transformation]
~ INLINE {Class[context].ConcatT[context, transformation]};
GetT: PROC [context: Context] RETURNS [Transformation]
~ INLINE {RETURN [Class[context].GetT[context]]};
SetT: PROC [context: Context, transformation: Transformation]
~ INLINE {Class[context].SetT[context, transformation]};
IntTranslateT: PROC [context: Context, dx, dy: INTEGER]
~ INLINE {Class[context].IntTranslateT[context, dx, dy]};
GetClipper: PROC [context: Context] RETURNS [Clipper]
~ INLINE {RETURN [Class[context].GetClipper[context]]};
SetClipper: PROC [context: Context, clipper: Clipper]
~ INLINE {Class[context].SetClipper[context, clipper]};
ClipPath: PROC [context: Context, outline: Path, exclude: BOOLEANFALSE]
~ INLINE {Class[context].ClipPath[context, outline, exclude]};
ClipRectangle: PROC [context: Context, outline: Rectangle, exclude: BOOLEANFALSE]
~ INLINE {Class[context].ClipRectangle[context, outline, exclude]};
TestRectangle: PROC [context: Context, area: Rectangle] RETURNS [Visibility]
~ INLINE {RETURN [Class[context].TestRectangle[context, area]]};
ClipIntRectangle: PROC [context: Context, outline: IntRectangle, exclude: BOOLEANFALSE]
~ INLINE {Class[context].ClipIntRectangle[context, outline, exclude]};
TestIntRectangle: PROC [context: Context, area: IntRectangle] RETURNS [Visibility]
~ INLINE {RETURN [Class[context].TestIntRectangle[context, area]]};
DoWithoutClipping: PROC [context: Context, bounds: IntRectangle, callBack: PROC[Context]]
~ INLINE {Class[context].DoWithoutClipping[context, bounds, callBack]};
SetColor: PROC [context: Context, color: Color]
~ INLINE {Class[context].SetColor[context, color]};
GetColor: PROC [context: Context] RETURNS [Color]
~ INLINE {RETURN [Class[context].GetColor[context]]};
MaskStroke: PROC [context: Context, path: Path, width: REAL, strokeEnds: StrokeEnds, closed: BOOLEANFALSE]
~ INLINE {Class[context].MaskStroke[context, path, width, strokeEnds, closed]};
MaskFill: PROC [context: Context, path: Path]
~ INLINE {Class[context].MaskFill[context, path]};
MaskPixel: PROC [context: Context, pixelArray: ImagerBasic.PixelArray]
~ INLINE {Class[context].MaskPixel[context, pixelArray]};
MaskBits: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, tile: IntRectangle, area: IntRectangle]
~ INLINE {Class[context].MaskBits[context, base, raster, tile, area]};
MaskSegment: PROC [context: Context, p: Pair]
~ INLINE {Class[context].MaskSegment[context, p]};
MaskIntSegment: PROC [context: Context, p: IntPair]
~ INLINE {Class[context].MaskIntSegment[context, p]};
MaskThinStroke: PROC [context: Context, path: Path]
~ INLINE {Class[context].MaskThinStroke[context, path]};
MaskRectangle: PROC [context: Context, area: Rectangle]
~ INLINE {Class[context].MaskRectangle[context, area]};
MaskIntRectangle: PROC [context: Context, area: IntRectangle]
~ INLINE {Class[context].MaskIntRectangle[context, area]};
SetCP: PROC [context: Context, cp: Pair]
~ INLINE {Class[context].SetCP[context, cp]};
GetCP: PROC [context: Context] RETURNS [Pair]
~ INLINE {RETURN [Class[context].GetCP[context]]};
SetIntCP: PROC [context: Context, cp: IntPair]
~ INLINE {Class[context].SetIntCP[context, cp]};
GetIntCP: PROC [context: Context] RETURNS [IntPair]
~ INLINE {RETURN [Class[context].GetIntCP[context]]};
MaskChar: PROC [context: Context, font: UnifiedFonts.FONT, char: CHAR]
~ INLINE {Class[context].MaskChar[context, font, char]};
MaskCharacters: PROC [context: Context, font: UnifiedFonts.FONT, characters: REF, start: INT ← 0, length: INTLAST[INT]]
~ INLINE {Class[context].MaskCharacters[context, font, characters, start, length]};
TransferBuffer: PROC [context, source: Context]
~ INLINE {Class[context].TransferBuffer[context, source]};
SpecialOp: PROC [context: Context, op: ATOM, data: REF] RETURNS [BOOLEAN]
~ INLINE {RETURN [Class[context].SpecialOp[context, op, data]]};
Procedures for manipulating View-to-Surface transformation and clipper (window packages only, please)
SetView: PROC [context: Context, box: IntRectangle, halftoneOrigin: IntPair ← [0, 0]]
~ INLINE {Class[context].SetView[context, box, halftoneOrigin]};
Sets the View-to-Surface transformation to map the origin in View coordinates to (box.x and box.y) in Surface coordinates, and the View-to-Surface clipper to show the specified box. The halftoneOrigin parameter is for controlling the phase of halftones, and is also expressed in terms of Surface coordinates.
ClipView: PROC [context: Context, box: IntRectangle, exclude: BOOLEAN]
~ INLINE {Class[context].ClipView[context, box, exclude]};
For setting up fancier clippers; the box is in Surface coordinates.
GetSurfaceBounds: PROC [context: Context] RETURNS [IntRectangle]
~ INLINE {RETURN [Class[context].GetSurfaceBounds[context]]};
For finding out where the usable parts of the Surface are. The results are in Surface coordinates.
GetViewBounds: PROC [context: Context] RETURNS [IntRectangle]
~ INLINE {RETURN [Class[context].GetViewBounds[context]]};
Yields the bounding box of the View clipper, in Surface coordinates.
MoveSurfaceRectangle: PROC [context: Context, source: IntRectangle, dest: IntPair] RETURNS [BOOLEAN]
~ INLINE {RETURN [Class[context].MoveSurfaceRectangle[context, source, dest]]};
Moves the source rectangle so that its new origin is at dest. Both source and dest are in Surface coordinates. Returns FALSE if the device does not support the operation. Overlapping source and dest are allowed. Clippers are ignored. Beware of moving images containing halftones, because this may cause misaligned halftone screens. The halftone screens are aligned by SetView, so the window package may move viewers around without problems.
END.