ImagerScanConverter.mesa
Copyright © 1984 Xerox Corporation. All rights reserved.
Michael Plass, February 6, 1984 1:28:15 pm PST
Doug Wyatt, September 13, 1984 5:15:14 pm PDT
DIRECTORY
ImagerPath USING [PathProc],
ImagerPixelMap USING [DeviceRectangle, Function, PixelMap],
ImagerTransformation USING [Transformation];
ImagerScanConverter: CEDAR DEFINITIONS
~ BEGIN
DeviceRectangle: TYPE ~ ImagerPixelMap.DeviceRectangle;
PixelMap: TYPE ~ ImagerPixelMap.PixelMap;
Function: TYPE ~ ImagerPixelMap.Function;
DevicePath: TYPE ~ REF DevicePathRep;
CreatePath: PROC [
pathProc: ImagerPath.PathProc, pathData: REF,
transformation: ImagerTransformation.Transformation,
clipBox: DeviceRectangle,
scratch: DevicePath ← NIL -- for re-use of storage
] RETURNS [DevicePath];
BoundingBox: PROC [devicePath: DevicePath] RETURNS [DeviceRectangle];
Not always as tight as possible, but should be pretty close.
NumberOfRuns: PROC [devicePath: DevicePath] RETURNS [numberOfRuns: INT];
Guaranteed to be an upper bound, should be close to the actual.
ConvertToRuns: PROC [
devicePath: DevicePath,
runProc: PROC [sMin, fMin: INTEGER, fSize: NAT],
clipBox: DeviceRectangle,
parityFill: BOOLEANFALSE
];
ConvertToPixels: PROC [
devicePath: DevicePath,
pixelMap: PixelMap,
value: CARDINAL ← 1,
parityFill: BOOLEANFALSE,
function: Function ← [null, null]
];
ConvertToManhattanPolygon: PROC [
devicePath: DevicePath,
clipBox: DeviceRectangle,
parityFill: BOOLEANFALSE
] RETURNS [LIST OF DeviceRectangle];
Satisfies assertion for an ImagerManhattan.Polygon.
Implementor private stuff
DevicePathRep: PRIVATE TYPE ~ RECORD [
scanLineCrossings: INT,
sMin, sMax, fMin, fMax: INTEGER,
pointTable: PointTable,
bucketTable: BucketTable,
segmentList: LIST OF SegmentRep,
pieceList: LIST OF PieceRep
];
PointTable: PRIVATE TYPE ~ REF PointTableRec;
PointTableRec: PRIVATE TYPE ~ RECORD [
SEQUENCE maxLength: NAT OF Point
];
Point: TYPE ~ MACHINE DEPENDENT RECORD [
1 word long, ordered so it can be sorted like a cardinal
fRel: NAT, -- relative to devicePath.fMin
direction: Direction
];
Direction: TYPE ~ {increasing, decreasing};
BucketTable: PRIVATE TYPE ~ REF BucketTableRec;
BucketTableRec: PRIVATE TYPE ~ RECORD [length: NAT, seq: SEQUENCE maxLength: NAT OF INTEGER];
SegmentRep: PRIVATE TYPE ~ RECORD [
sFirstScan: INTEGER, -- sFirstScan + 1/2 defines the first scan line that crosses this segment.
direction: Direction,
scanCount: NAT, -- number of scan lines that cross this segment.
s0, f0, s1, f1: REAL
];
PieceRep: PRIVATE TYPE ~ RECORD [
sOrg, fOrg: INTEGER, -- in device units
sScale: CARDINAL,
sOffset: CARDINAL,
sFirstScan: INTEGER, -- sFirstScan + 1/2 defines the first scan line that crosses this piece.
scanCount: CARDINAL, -- number of scan lines that cross this piece.
direction: Direction,
iterationsUntilFlat: NAT,
f0: CARDINAL,
s1, f1: CARDINAL,
s2, f2: CARDINAL,
s3, f3: CARDINAL
In device coordinates, the coordinates of point i is
(fi/fScale + 1/2 + fOrg, (si+sOffset)/sScale + sOrg)
];
END.