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]; NumberOfRuns: PROC [devicePath: DevicePath] RETURNS [numberOfRuns: INT]; ConvertToRuns: PROC [ devicePath: DevicePath, runProc: PROC [sMin, fMin: INTEGER, fSize: NAT], clipBox: DeviceRectangle, parityFill: BOOLEAN _ FALSE ]; ConvertToPixels: PROC [ devicePath: DevicePath, pixelMap: PixelMap, value: CARDINAL _ 1, parityFill: BOOLEAN _ FALSE, function: Function _ [null, null] ]; ConvertToManhattanPolygon: PROC [ devicePath: DevicePath, clipBox: DeviceRectangle, parityFill: BOOLEAN _ FALSE ] RETURNS [LIST OF DeviceRectangle]; 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 [ 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 ]; END. (ImagerScanConverter.mesa Copyright c 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 Not always as tight as possible, but should be pretty close. Guaranteed to be an upper bound, should be close to the actual. Satisfies assertion for an ImagerManhattan.Polygon. Implementor private stuff 1 word long, ordered so it can be sorted like a cardinal In device coordinates, the coordinates of point i is (fi/fScale + 1/2 + fOrg, (si+sOffset)/sScale + sOrg) Ê瘚œ™Jšœ Ïmœ.™9J™.J™-—J˜šÏk ˜ Jšœ žœ ˜Jšœžœ'˜;Jšœžœ˜,—J˜Jšœž˜&Jšœž˜J˜Jšœžœ"˜7Jšœ žœ˜)šœ žœ˜)J˜—šœ žœžœ˜%J˜—šÏn œžœ˜Jšœ)žœ˜-J˜4J˜JšœžœÏc˜2Jšœžœ˜J˜—šŸ œžœžœ˜EJ™