ImagerScanConverter.mesa
Michael Plass, February 6, 1984 1:28:15 pm PST
Edited by Doug Wyatt, November 22, 1983 11:19 am
DIRECTORY
ImagerPixelMaps USING [DeviceRectangle, Function, PixelMap];
ImagerScanConverter: CEDAR DEFINITIONS
~ BEGIN
DeviceRectangle: TYPE ~ ImagerPixelMaps.DeviceRectangle;
PixelMap: TYPE ~ ImagerPixelMaps.PixelMap;
Function: TYPE ~ ImagerPixelMaps.Function;
DevicePath: TYPE ~ REF DevicePathRep;
PathProc: TYPE ~ PROC [
move: PROC [s, f: REAL],
line: PROC [s, f: REAL],
curve: PROC [s1, f1, s2, f2, s3, f3: REAL]
control points of a bezier cubic
];
CreatePath: PROC [
pathProc: PathProc,
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.