ImagerHalftone.mesa
Michael Plass, July 11, 1983 3:56 pm
DIRECTORY
ImagerMasks, ImagerBasic, ImagerBrick
;
ImagerHalftone: CEDAR DEFINITIONS ~ BEGIN
Data types
Transformation: TYPE ~ ImagerBasic.Transformation;
PixelArray: TYPE ~ ImagerBasic.PixelArray;
PixelBuffer: TYPE ~ ImagerBasic.PixelBuffer;
Brick: TYPE ~ ImagerBrick.Brick;
Mask: TYPE ~ ImagerMasks.Mask;
DeviceBrick: TYPE ~ REF DeviceBrickRep;
DeviceBrickRep: TYPE ~ RECORD [
fMin, sMin: INTEGER,
fPeriod: NAT,
phase: NAT,
seq: SEQUENCE sPeriod: NAT OF PixelBuffer
];
Operations
MakeDeviceBrick: PROC [brick: Brick, maxPixelValue: CARDINAL] RETURNS [d: DeviceBrick];
MakeSquareBrick: PROC [size: NAT, p, q: INTEGER, pModulation, qModulation: REAL, maxPixelValue: CARDINAL] RETURNS [DeviceBrick];
Makes a square device brick with zero phase. Will return a dot screen if pModulation = qModulation > 0, a line screen if one of these is zero, otherwise something in between a dot and line screen. The screen angle will be arctan (p/q), and the period will be size/sqrt(p*p+q*q).
Halftone: PROC [dest: Mask, mask: Mask, source: PixelArray, transformation: Transformation, deviceBrick: DeviceBrick];
The tranformation takes PixelArray space to device space: [x y 1] T = [s f 1].
DotScreen: PROC [x, y: REAL] RETURNS [fvalue: REAL];
LineScreen: PROC [x, y:REAL] RETURNS [fvalue: REAL];
END.