IIRaster.mesa
Copyright © 1984, 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, December 10, 1986 11:14:45 am PST
Doug Wyatt, May 30, 1985 11:21:34 pm PDT
This private interface provides the II class operations that are common to all of the raster Context implementations.
DIRECTORY
II USING [Context],
IIDevice USING [AllowedMasks, DeviceClass, DeviceParm],
IIManhattan USING [Polygon],
SF USING [Box, BoxGenerator, Vec],
IIPrivate USING [Class];
IIRaster: CEDAR DEFINITIONS
~ BEGIN OPEN II;
Class: TYPE ~ IIPrivate.Class;
DeviceParm: TYPE ~ IIDevice.DeviceParm;
DeviceClass: TYPE ~ IIDevice.DeviceClass;
ManhattanPolygon: TYPE ~ IIManhattan.Polygon;
Context Class Creation
CreateClass: PROC [type: ATOM, deviceClass: DeviceClass] 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. The deviceClass is required so that the appropriate collection of context class procs may be supplied.
Context Creation
Create: PROC [class: Class, deviceParm: DeviceParm, data: REF, pixelUnits: BOOLFALSE] RETURNS [Context];
If pixelUnits=TRUE, coordinate system is in pixels; otherwise it is in meters
Device Access
GetDeviceParm: PROC [context: Context] RETURNS [DeviceParm];
Returns the device record, or NIL if not a raster device.
ValidateState: PROC [context: Context] RETURNS [IIDevice.AllowedMasks];
Makes sure the device knows the current color and priorityImportant (this happens automatically before the masking procs in the device class are called).
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.
GetDeviceClipBox: PROC [context: Context] RETURNS [SF.Box];
SetDeviceClipBox: PROC [context: Context, clipBox: SF.Box];
Sets the lowest-level clipping box.
Masking Boxes in Device Coordinates
MaskDeviceBoxes: PROC [context: Context, bounds: SF.Box, boxes: SF.BoxGenerator];
This provides low-level access to the context's masking facilities; the boxes must all lie within bounds (or a fault may occur), and will be clipped to the current clipping region.
Intercepting Raster Accesses
Interceptor: TYPE ~ REF InterceptorRep;
InterceptorRep: TYPE ~ RECORD [intercept: InterceptProc, data: REF];
InterceptProc: TYPE ~ PROC [self: Interceptor, box: SF.Box, action: PROC, context: Context];
The active InterceptProc is called whenever a change to the raster is called for; it should call back action, which will in turn call back one or more of the other class procs. The intercept proc may be used for raster implementations that need to know a bounding box for the operations before they happen (for software cursors, etc). An attempt is made to avoid recursive calls on the intercept proc.
SetInterceptor: PROC [context: Context, interceptor: Interceptor] RETURNS [Interceptor];
Sets a new interceptor and returns the previous one.
InterceptorInEffect: PROC [context: Context] RETURNS [BOOL];
So client knows whether ModifyRaster must be called.
ModifyRaster: PROC [context: Context, box: SF.Box, action: PROC];
Should be used by raster implementations that access the raster without going through the normal DeviceClass procedures, to ensure that interceptions can happen.
END.