ImagerState.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Doug Wyatt, November 11, 1985 4:59:36 pm PST
DIRECTORY
Basics USING [BITAND, BITOR],
Imager USING [Color, ColorOperator, Context, Font, PathProc, PixelArray, Rectangle, Transformation, VEC],
ImagerBackdoor USING [Clipper, IntKey, RealKey];
ImagerState: CEDAR DEFINITIONS
IMPORTS Basics
~ BEGIN OPEN ImagerBackdoor, Imager;
ChangeFlags: TYPE ~ RECORD [
T: BOOLFALSE,
clipper: BOOLFALSE,
font: BOOLFALSE,
color: BOOLFALSE,
priority: BOOLFALSE,
unused: [0..3777B] ← 0
];
notChanged: ChangeFlags ~ [];
OrChangeFlags: PROC[c1, c2: ChangeFlags] RETURNS[ChangeFlags] ~ INLINE {
RETURN[LOOPHOLE[Basics.BITOR[LOOPHOLE[c1], LOOPHOLE[c2]]]];
};
AndChangeFlags: PROC[c1, c2: ChangeFlags] RETURNS[ChangeFlags] ~ INLINE {
RETURN[LOOPHOLE[Basics.BITAND[LOOPHOLE[c1], LOOPHOLE[c2]]]];
};
PersistentVariables: TYPE ~ RECORD [
cp: VEC ← [0, 0], -- current position, view coords
correctMeasure: VEC ← [0, 0], -- target line measure for Correct, view coords
correctMaskCount: INT ← 0, -- tally number of CorrectMask calls in pass 1
correctSum: VEC ← [0, 0], -- tally adjustable space from CorrectSpace calls in pass 1
correctMask: VEC ← [0, 0], -- space inserted by each CorrectMask call in pass 2
correctSpace: VEC ← [0, 0] -- adjustment factors for each CorrectSpace call in pass 2
];
NonPersistentVariables: TYPE ~ RECORD [
changed: ChangeFlags ← notChanged, -- changes since np variables were saved
priorityImportant: INT ← 0, -- if nonzero, priority of masks is important
mediumSize: VEC ← [0, 0], -- size of medium, in meters
fieldMin: VEC ← [0, 0], -- minimum x and y of field, in meters
fieldMax: VEC ← [0, 0], -- maximum x and y of field, in meters
noImage: INT ← 0, -- if nonzero, don't image masks
strokeWidth: REAL ← 0, -- stroke width, client coords
strokeEnd: INT ← 0, -- stroke end treatment
strokeJoint: INT ← 0, -- stroke joint treatment
underlineStart: REAL ← 0, -- starting x position for underline, client coords
amplifySpace: REAL ← 1.0, -- multiplies width of amplified characters
correctPass: INT ← 0, -- which pass, during Correct
correctShrink: REAL ← 0.5, -- allowable space shrink
correctTolerance: VEC ← [0, 0] -- tolerable deviation from correctMeasure, view coords
];
Contains no REFs, so can be copied with block transfers.
State: TYPE ~ REF StateRep;
StateRep: TYPE ~ RECORD [
changed: ChangeFlags ← notChanged,
p: PersistentVariables ← [], -- persistent variables
np: NonPersistentVariables ← [], -- non-persistent variables other than REFs below
T: Transformation ← NIL, -- current transformation (mutable!)
font: Font ← NIL, -- current "showVec"
color: Color ← NIL, -- current color
clipper: Clipper ← NIL -- current clipping outline
];
StateDoSave: PROC[context: Context, action: PROC, all: BOOL];
StateSetInt: PROC[context: Context, key: IntKey, val: INT];
StateSetReal: PROC[context: Context, key: RealKey, val: REAL];
StateSetT: PROC[context: Context, m: Transformation];
StateSetFont: PROC[context: Context, font: Font];
StateSetColor: PROC[context: Context, color: Color];
StateSetClipper: PROC[context: Context, clipper: Clipper];
StateGetInt: PROC[context: Context, key: IntKey] RETURNS[INT];
StateGetReal: PROC[context: Context, key: RealKey] RETURNS[REAL];
StateGetT: PROC[context: Context] RETURNS[Transformation];
StateGetFont: PROC[context: Context] RETURNS[Font];
StateGetColor: PROC[context: Context] RETURNS[Color];
StateGetClipper: PROC[context: Context] RETURNS[Clipper];
StateConcatT: PROC[context: Context, m: Transformation];
StateScale2T: PROC[context: Context, s: VEC];
StateRotateT: PROC[context: Context, a: REAL];
StateTranslateT: PROC[context: Context, t: VEC];
StateMove: PROC[context: Context, rounded: BOOL];
StateSetXY: PROC[context: Context, p: VEC];
StateSetXYRel: PROC[context: Context, v: VEC];
StateGetCP: PROC[context: Context, rounded: BOOL] RETURNS[VEC];
StateStartUnderline: PROC[context: Context];
StateMaskUnderline: PROC[context: Context, dy, h: REAL];
StateCorrectMask: PROC[context: Context];
StateCorrectSpace: PROC[context: Context, v: VEC];
StateSpace: PROC[context: Context, x: REAL];
StateSetCorrectMeasure: PROC[context: Context, v: VEC];
StateSetCorrectTolerance: PROC[context: Context, v: VEC];
StateCorrect: PROC[context: Context, action: PROC];
StateDontCorrect: PROC[context: Context, action: PROC, saveCP: BOOL];
StateSetGray: PROC[context: Context, f: REAL];
StateSetSampledColor: PROC[context: Context, pa: PixelArray,
m: Transformation, colorOperator: ColorOperator];
StateSetSampledBlack: PROC[context: Context, pa: PixelArray,
m: Transformation, clear: BOOL];
StateClip: PROC[context: Context, path: PathProc, oddWrap: BOOL, exclude: BOOL];
StateClipRectangle: PROC[context: Context, r: Rectangle, exclude: BOOL];
StateClipRectangleI: PROC[context: Context, x, y, w, h: INTEGER, exclude: BOOL];
END.