ImagerDevice.mesa
Copyright © 1984, 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, June 11, 1985 2:50:25 pm PDT
Doug Wyatt, March 6, 1986 9:27:16 pm PST
DIRECTORY
ImagerColor USING [Color],
ImagerFont USING [CorrectionType, XChar],
ImagerSample USING [BoxAction, BoxGenerator, SampleMap],
ImagerTransformation USING [Transformation],
Scaled USING [Value],
SF USING [Box, Vec],
Vector2 USING [VEC];
ImagerDevice: CEDAR DEFINITIONS
~ BEGIN
Transformation: TYPE ~ ImagerTransformation.Transformation;
Vec: TYPE ~ SF.Vec;
Box: TYPE ~ SF.Box;
BoxAction: TYPE ~ ImagerSample.BoxAction;
BoxGenerator: TYPE ~ ImagerSample.BoxGenerator;
SampleMap: TYPE ~ ImagerSample.SampleMap;
Color: TYPE ~ ImagerColor.Color;
HalftoneParameters: TYPE ~ RECORD[
dotsPerInch: REAL,
angle: REAL, -- degrees anticlockwise from +x axis
shape: REAL -- 0.5 is circular
];
Device: TYPE ~ REF DeviceRep;
DeviceRep: TYPE ~ RECORD[
class: DeviceClass, -- class operations
data: REF, -- instance data
box: Box, -- bounding rectangle, in device coordinates
surfaceToDevice: Transformation, -- transformation from surface to device coordinates
surfaceUnitsPerInch: Vector2.VEC, -- x and y scale factors
surfaceUnitsPerPixel: NAT -- surface resolution may be a multiple of pixel resolution
];
CharMask: TYPE ~ REF CharMaskRep;
CharMaskRep: TYPE ~ MACHINE DEPENDENT RECORD [
font: REF, -- font and char together provide a unique identifier for this mask
char: ImagerFont.XChar,
sEscapement, fEscapement: Scaled.Value,
sMinBB, fMinBB: INTEGER,
sSizeBB, fSizeBB: CARDINAL,
metricsValid: BOOL, -- numbers above are invalid if this is true.
amplified: BOOL,
correction: ImagerFont.CorrectionType,
flag: PACKED ARRAY [0..10) OF [0..1], -- for padding and expansion
data: SELECT rep: * FROM
raster => [bits: SEQUENCE COMPUTED CARDINAL -- sSize*Ceiling[fSize/16.0] -- OF WORD],
runs => [run: SEQUENCE nRuns: CARDINAL OF Run],
uncached => [],
ENDCASE
];
Run: TYPE ~ MACHINE DEPENDENT RECORD [fMin: CARDINAL, lastRun: BOOL, fSize: NAT];
Same as PDFileFormat.Run; fMin is relative to fMinBB.
SetColorProc: TYPE ~ PROC [self: Device, color: Color, viewToDevice: Transformation];
SetPriorityProc: TYPE ~ PROC [self: Device, priorityImportant: BOOL];
SetHalftoneProc: TYPE ~ PROC [self: Device, halftone: HalftoneParameters];
MaskBoxesProc: TYPE ~ PROC [self: Device, boxes: BoxGenerator, bounds: Box];
MaskBitsProc: TYPE ~ PROC [self: Device, boxes: BoxGenerator, bounds: Box,
src: SampleMap, offset: Vec];
MoveBoxesProc: TYPE ~ PROC [self: Device, boxes: BoxGenerator, bounds: Box, offset: Vec];
MaskCharProc: TYPE ~ PROC [self: Device, mask: CharMask, offset: Vec];
DoWithBufferProc: TYPE ~ PROC [self: Device, action: PROC, bounds: Box];
DeviceClass: TYPE ~ REF DeviceClassRep;
DeviceClassRep: TYPE ~ RECORD [
type: ATOM,
SetColor: SetColorProc,
SetPriority: SetPriorityProc,
SetHalftone: SetHalftoneProc,
MaskBoxes: MaskBoxesProc,
MaskBits: MaskBitsProc,
MoveBoxes: MoveBoxesProc,
MaskChar: MaskCharProc,
DoWithBuffer: DoWithBufferProc
];
NewClass: PROC [
type: ATOM,
SetColor: SetColorProc,
SetPriority: SetPriorityProc ← NIL,
SetHalftone: SetHalftoneProc ← NIL,
MaskBoxes: MaskBoxesProc,
MaskBits: MaskBitsProc ← NIL,
MoveBoxes: MoveBoxesProc,
MaskChar: MaskCharProc ← NIL
] RETURNS [DeviceClass];
END.