IIRasterShow.mesa
Copyright Ó 1986 by Xerox Corporation. All rights reserved.
Michael Plass, November 26, 1986 4:16:37 pm PST
This private interface provides access to pieces of the raster Show implementation.
DIRECTORY
II USING [Context, Transformation],
IIBox USING [Box],
IIFont USING [Font, XChar, XStringProc],
IIMaskCache USING [CharMask, CharMaskRep, MaskCache, ScaledVec],
IIDevice USING [AllowedMasks, DeviceClass, DeviceParm],
Scaled USING [zero],
SF USING [Box, Vec],
IIState USING [State];
IIRasterShow: CEDAR DEFINITIONS
~ BEGIN
Context: TYPE ~ II.Context;
State: TYPE ~ IIState.State;
Support for Show
This section is mostly for private communication between parts of the Raster impl.
ScaledVec: TYPE ~ IIMaskCache.ScaledVec;
zeroScaledVec: ScaledVec ~ [Scaled.zero, Scaled.zero];
ShowData: TYPE ~ REF ShowDataRep;
ShowDataRep: TYPE ~ RECORD [
fontCache: IIMaskCache.MaskCache ← NIL,
fontAtom: IIFont.Font ← NIL, -- canonicalized ref used as part of key for font cache
fontBB: IIBox.Box ← [0, 0, 0, 0], -- device coords; valid iff valid.fontBB
viewToDevice: II.Transformation ← NIL,
clipBounds: SF.Box ← [],
deviceClass: IIDevice.DeviceClass ← NIL,
deviceParm: IIDevice.DeviceParm ← NIL,
allow: IIDevice.AllowedMasks ← [FALSE, FALSE, FALSE, FALSE, FALSE, FALSE],
-- The remaining items are set and used only inside of fast cases of Show
correctPass: [0..2] ← 0, -- matches state.np.correctPass
valid: BOOL ← FALSE, -- says whether any of the following is valid
cp: ScaledVec ← zeroScaledVec, -- device coordinates, offset by 1/2 pixel
correctSum: ScaledVec ← zeroScaledVec, -- used only in correct pass 1
correctMask: ScaledVec ← zeroScaledVec, -- used only in correct pass 2
lastAmpMask: IIMaskCache.CharMask ← NIL, -- validates lastAmp
lastAmp: ScaledVec ← zeroScaledVec, -- amplified space width
lastUnCorrectedSpace: ScaledVec ← zeroScaledVec, -- validates lastCorrectedSpace
lastCorrectedSpace: ScaledVec ← zeroScaledVec -- used only in correct pass 2
];
GetShowData: PROC [context: Context] RETURNS [ShowData];
Gets data needed by a fast case of Show. Also validates color and priorityImportant
BasicShowChar: PROC [context: Context, char: IIFont.XChar];
Shows a single character in the most straightforward way, without going through a cache.
CachedShowChar: PROC [context: Context, char: IIFont.XChar];
Shows a single character, attempting to use the cache.
MaskCharMask: PROC [context: Context, charMask: IIMaskCache.CharMask] RETURNS [ok: BOOL];
Trys to apply a single cached mask, without updating the imager variables. Returns FALSE if it fails.
RasterMask: TYPE ~ REF IIMaskCache.CharMaskRep.raster;
CommonChar: TYPE ~ [0..255];
GetCharArray: PROC [fontAtom: IIFont.Font] RETURNS [r: REF ARRAY CommonChar OF RasterMask];
CommonCharLookup: PROC [showData: ShowData, charArray: REF ARRAY CommonChar OF RasterMask, char: IIFont.XChar] RETURNS [m: RasterMask ← NIL];
TryFastState: PROC [state: State, showData: ShowData];
Attempts to set up the fixed-point state representation; showData.valid if successful
DoCharMetrics: PROC [state: State, showData: ShowData, m: IIMaskCache.CharMask];
Updates showData and/or state as a result of showing m. Assumes showData.valid on entry
FlushState: PROC [state: State, showData: ShowData];
Updates state from showData.
BitFont: PROC RETURNS [IIFont.Font];
Makes a special-purpose typeface for rendering bitmaps using SHOW
RasterShow: PROC [context: Context, string: IIFont.XStringProc, xrel: BOOL];
The normal Show implementation
FastShow: PROC [context: Context, string: IIFont.XStringProc, xrel: BOOL];
A fast Show implementation for the case the destination is a bitmap
END.