ImagerHalftone.mesa
Michael Plass, January 16, 1984 2:48 pm
Edited by Doug Wyatt, November 22, 1983 12:57 pm
DIRECTORY
ImagerBasic USING [PixelArray, PixelBuffer, Transformation],
ImagerBrick USING [Brick],
ImagerPixelMaps USING [PixelMap];
ImagerHalftone: CEDAR DEFINITIONS
~ BEGIN
Data types
Transformation: TYPE ~ ImagerBasic.Transformation;
PixelArray: TYPE ~ ImagerBasic.PixelArray;
PixelBuffer: TYPE ~ ImagerBasic.PixelBuffer;
Brick: TYPE ~ ImagerBrick.Brick;
PixelMap: TYPE ~ ImagerPixelMaps.PixelMap;
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: PixelMap, runs:
PROC[run:
PROC[sMin, fMin:
INTEGER, fSize:
NAT]], source: PixelArray, transformation: Transformation, deviceBrick: DeviceBrick, invertOutput:
BOOLEAN ←
FALSE, transparent:
BOOLEAN ←
FALSE];
The transformation 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.