ImagerRast.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Doug Wyatt, April 15, 1985 5:26:12 pm PST
Michael Plass, May 19, 1985 2:29:10 pm PDT
DIRECTORY
Atom USING [PropList],
Basics USING [BITAND, BITNOT, BITOR],
Imager USING [Context, ClassRep],
ImagerCache USING [Ref],
ImagerDev USING [Device],
ImagerFontPrivate USING [FontAtom],
ImagerManhattan USING [DeviceRectangle, Polygon],
ImagerScanConverter USING [DevicePath],
ImagerTransformation USING [Transformation];
ImagerRast: CEDAR DEFINITIONS
IMPORTS Basics
~ BEGIN
Context: TYPE ~ Imager.Context;
Device: TYPE ~ ImagerDev.Device;
DevicePath: TYPE ~ ImagerScanConverter.DevicePath;
FontAtom: TYPE ~ ImagerFontPrivate.FontAtom;
Transformation: TYPE ~ ImagerTransformation.Transformation;
ManhattanPolygon: TYPE ~ ImagerManhattan.Polygon;
DeviceRectangle: TYPE ~ ImagerManhattan.DeviceRectangle;
Types for internal use
Flags: TYPE ~ RECORD[
clientToDevice: BOOLFALSE, -- clientToDevice is valid
charToDevice: BOOLFALSE, -- charToDevice is valid
clientClipper: BOOLFALSE, -- clientClipMask and clientClipBox are valid
deviceColor: BOOLFALSE, -- color last set by SetColor[device, ...] is valid
devicePriority: BOOLFALSE, -- priority last set by SetPriority[device, ...] is valid
fontAtom: BOOLFALSE, -- fontAtom is valid
unused: [0..1777B] ← 0
];
noFlags: Flags ~ [];
OrFlags: PROC[f1, f2: Flags] RETURNS[Flags] ~ INLINE {
RETURN[LOOPHOLE[Basics.BITOR[LOOPHOLE[f1], LOOPHOLE[f2]]]];
};
AndFlags: PROC[f1, f2: Flags] RETURNS[Flags] ~ INLINE {
RETURN[LOOPHOLE[Basics.BITAND[LOOPHOLE[f1], LOOPHOLE[f2]]]];
};
NotFlags: PROC[f: Flags] RETURNS[Flags] ~ INLINE {
RETURN[LOOPHOLE[Basics.BITNOT[LOOPHOLE[f]]]];
};
FontCache: TYPE ~ ImagerCache.Ref;
Data: TYPE ~ REF DataRep;
DataRep: TYPE ~ RECORD[
device: Device ← NIL, -- a particular raster device
fontCache: FontCache ← NIL,
fontAtom: ImagerFontPrivate.FontAtom ← NIL,
rastWeight: REAL ← 0.0, -- bigger values favor bitmaps in the cache.
fontTuner: FontTuner ← NIL,
devicePath: DevicePath ← NIL, -- scratch storage for scan converter
valid: Flags ← [],
viewToDevice: Transformation ← NIL, -- always valid
viewClipMask: ManhattanPolygon ← NIL, -- device coords; always valid
viewClipBox: DeviceRectangle ← [0, 0, 0, 0], -- device coords; always valid
clientToDevice: Transformation ← NIL, -- valid iff valid.clientToDevice
clientClipMask: ManhattanPolygon ← NIL, -- device coords; valid iff valid.clientClipper
clientClipBox: DeviceRectangle ← [0, 0, 0, 0], -- device coords; valid iff valid.clientClipper
charToDevice: Transformation ← NIL -- valid iff valid.charToDevice
];
Context creation
Create: PROC [device: Device, pixelUnits: BOOLFALSE, fontCache: FontCache ← NIL, rastWeight: REAL ← 1.0, fontTuner: FontTuner ← NIL, class: REF Imager.ClassRep ← NIL] RETURNS [Context];
If fontCache=NIL, no caching will be done.
If fontTuner=NIL, no font tuning will be done.
Font tuning hook
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.
Subclassing
CreateClass: PROC [type: ATOM] RETURNS [REF Imager.ClassRep];
For clients that want to do some simple subclassing of the raster class.
END.