ImagerRaster.mesa
Copyright Ó 1984, 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, August 19, 1991 2:33 pm PDT
Doug Wyatt, May 30, 1985 11:21:34 pm PDT
This private interface provides the Imager class operations that are common to all of the raster Context implementations.
DIRECTORY
Imager USING [Context],
ImagerDevice USING [Device, DeviceClass, DeviceClipper, DeviceParm],
ImagerDeviceInterchange USING [InterchangeState],
ImagerFont USING [Font],
ImagerManhattan USING [Polygon],
ImagerPrivate USING [Class],
ImagerRasterPublic USING [InterceptProc, InterceptorRep],
SF USING [Box, Vec];
ImagerRaster: CEDAR DEFINITIONS
~ BEGIN OPEN Imager;
Class: TYPE ~ ImagerPrivate.Class;
Device: TYPE ~ ImagerDevice.Device;
ManhattanPolygon: TYPE ~ ImagerManhattan.Polygon;
Context Class Creation
CreateClass: PROC [type: ATOM] RETURNS [Class];
Creates a class record initialized with appropriate defaults for all of the class procedures; the raster subclass may redefine these procedures as required, to implement fast cases, detect special situations, etc.
Context Creation
Create: PROC [class: Class, deviceClass: ImagerDevice.DeviceClass, deviceParm: ImagerDevice.DeviceParm, data: REF, pixelUnits: BOOL ¬ FALSE] RETURNS [Context];
If pixelUnits=TRUE, coordinate system is in pixels; otherwise it is in meters
Device Access
GetDevice: PROC [context: Context] RETURNS [Device];
For access to the deviceClass, deviceParm, and data passed to Create.
Don't use this device for imaging, since it is unvalidated and unintercepted; use DoWithDevice for that purpose.
DoWithDevice: PROC [context: Context, bounds: SF.Box, action: PROC [device: Device, clipper: ImagerDevice.DeviceClipper]];
Should be used by raster implementation cheaters to ensure that interceptions can happen.
Clipping Regions in Device Coordinates
GetContainingBox: PROC [context: Context, p: SF.Vec] RETURNS [SF.Box];
Gets a box that is either empty or contains p and lies within the clipping region.
GetClipper: PROC [context: Context] RETURNS [ImagerDevice.DeviceClipper];
Gets the composite clipper.
GetDeviceClipBox: PROC [context: Context] RETURNS [SF.Box];
SetDeviceClipBox: PROC [context: Context, clipBox: SF.Box];
Sets the lowest-level clipping box.
Intercepting Raster Accesses
Interceptor: TYPE ~ REF InterceptorRep;
InterceptorRep: TYPE ~ ImagerRasterPublic.InterceptorRep;
InterceptProc: TYPE ~ ImagerRasterPublic.InterceptProc;
SetInterceptor: PROC [context: Context, interceptor: Interceptor] RETURNS [Interceptor];
Sets a new interceptor and returns the previous one.
InterceptorInEffect: PROC [context: Context] RETURNS [BOOL];
InterchangeState
GetInterchangeState: PROC [context: Context] RETURNS [ImagerDeviceInterchange.InterchangeState];
Returns NIL if context is not a raster context.
The device will be validated, and will include any layered devices (e.g. interceptors).
The clipper will be the composite clipper.
ContextFromInterchangeState: PROC [iState: ImagerDeviceInterchange.InterchangeState, scratch: Context ¬ NIL] RETURNS [Context];
Makes a raster context, with a generic imager class.
Destroys iState.
iState.clipper becomes the view clipper.
The scratch context is used for memory re-use; none of its state is relevant.
GetFontAtom: PROC [context: Context] RETURNS [ImagerFont.Font];
Makes a font that takes the current transformation into account.
END.