IIDevice.mesa
Copyright © 1984, 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, November 21, 1986 12:44:22 pm PST
Doug Wyatt, May 19, 1985 4:00:08 pm PDT
DIRECTORY
Atom USING [PropList],
II USING [Color, Context, SampleMap, ScanMode, Transformation, VEC],
IISample USING [EdgeAction, RawArray, rawArraySize],
IIMaskCache USING [CharMask, MaskCache],
SF USING [Box, BoxGenerator, Vec];
IIDevice: CEDAR DEFINITIONS
~ BEGIN OPEN II;
Box: TYPE ~ SF.Box;
BoxGenerator: TYPE ~ SF.BoxGenerator;
Vec: TYPE ~ SF.Vec;
CharMask: TYPE ~ IIMaskCache.CharMask;
SampleMap: TYPE ~ II.SampleMap;
ScanMode: TYPE ~ II.ScanMode;
RawArray: TYPE ~ IISample.RawArray;
rawArraySize: NAT ~ IISample.rawArraySize;
Font Tuning Provisions
FontTuner: TYPE ~ REF FontTunerRep;
FontTunerRep: TYPE ~ RECORD [proc: FontTunerProc, data: REF, propList: Atom.PropList];
FontTunerProc: TYPE ~ PROC [self: FontTuner, charProc: PROC [Context], context: Context];
Should call charProc to get the character, and should draw it into context.
Device Class
The common raster implementation calls these to do the device-dependent work; the instance data for the device is found in context.data.
AllowedMasks: TYPE ~ RECORD [
unorderedBoxes: BOOL,
If TRUE, boxes sent to MaskBoxes may come in any order; otherwise the boxes will be disjoint, nonempty, and for any two consecutive boxes a and b, b.min.s >= a.max.s-1. This invariant is needed, for instance, by the anti-aliasing implementation.
regionFill: BOOL,
If TRUE, may use MaskRegion
bitmap: BOOL,
If TRUE, MaskBitmap may be called; otherwise runs are generated.
rawBitmaps: BOOL,
If TRUE, MaskRawBitmaps may be called.
runGroupChar: BOOL,
If TRUE, MaskChar may be called with a run-group character; otherwise runs are generated.
rasterChar: BOOL
If TRUE, MaskChar may be called with a raster character; otherwise MaskBitmap is called, or runs are generated.
];
DeviceClass: TYPE ~ REF DeviceClassRep;
DeviceClassRep: TYPE ~ RECORD [
SetColor: PROC [context: Context, color: Color, viewToDevice: Transformation] RETURNS [AllowedMasks] ←,
Notifies device of a color change. The return value indicates the kinds of masks that the device is willing to accept.
SetPriority: PROC [context: Context, priorityImportant: BOOL] ← NIL,
Notifies device of a change to priorityImportant.
MaskBoxes: PROC [context: Context, bounds: Box, boxes: BoxGenerator] ← ,
The basic means of communicating masks; this is the only mask proc that is required.
No guarantees about order. All boxes will fall within bounds.
MaskRegion: PROC [context: Context, bounds: Box, edgeGenerator: PROC [IISample.EdgeAction]] ← NIL,
Masks a monotone region designated by the edges. The edgeGenerator must specify the edges in nondecreasing sMin order.
MaskBitmap: PROC [context: Context, bitmap: SampleMap, delta: Vec, bounds: Box, boxes: BoxGenerator] ← NIL,
Optional proc for masking a bitmap.
MaskRawBitmaps: PROC [context: Context, n: [0..rawArraySize], a: POINTER TO RawArray] ← NIL,
Optional proc for masking multiple bitmaps
DrawBitmap: PROC [context: Context, bitmap: SampleMap, delta: Vec, bounds: Box, boxes: BoxGenerator] ← NIL,
Optional proc for drawing a bitmap.
MaskChar: PROC [context: Context, delta: Vec, mask: CharMask] ← NIL,
Optional proc for masking a character from a font cache.
MoveBox: PROC [context: Context, dstMin, srcMin, size: Vec] ← NIL,
Optional proc for moving a rectangular region of the raster. If not supplied, IIBackdoor.MoveViewRectangle will raise an error when called.
DoBuffered: PROC [context: Context, bounds: Box, copy: BOOL, action: PROC] ← NIL
If supplied, allows full implementation of DoWithBuffer.
If copy=TRUE, device should copy from the main buffer to the temporary buffer; otherwise garbage in the buffer is OK, since the first thing that will happen is to fill it with a color.
];
Device Parameter Record
Static instance data that the common raster implementation needs to know.
DeviceParm: TYPE ~ REF DeviceParmRep;
DeviceParmRep: TYPE ~ RECORD [
class: DeviceClass, -- class operations
sSize, fSize: NAT, -- size of device coordinate system
scanMode: ScanMode, -- orientation of device coordinate system
surfaceUnitsPerInch: VEC, -- x and y scale factors
surfaceUnitsPerPixel: NAT, -- surface resolution may be a multiple of pixel resolution
fontTuner: FontTuner ← NIL, -- hook for doing font-tuning
fontCache: IIMaskCache.MaskCache ← NIL, -- cache for device-dependent character masks
rastWeight: REAL ← 1.0, -- larger numbers favor bitmaps in the cache
propList: Atom.PropList ← NIL
];
END.