ImagerBrick.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Doug Wyatt, March 20, 1986 2:09:51 pm PST
For creating halftone bricks.
DIRECTORY
ImagerSample USING [Sample, SampleMap];
ImagerBrick: CEDAR DEFINITIONS
~ BEGIN
Sample: TYPE ~ ImagerSample.Sample;
SampleMap: TYPE ~ ImagerSample.SampleMap;
Brick: TYPE ~ REF BrickRep;
BrickRep: TYPE ~ RECORD [
sSize, fSize: NAT, -- "slow" and "fast" dimensions
phase: NAT, -- phase shift for successive brick "layers", IN[0..fSize)
u, v: NAT, -- values matrix was derived from
samples: SEQUENCE size: NAT OF REAL
];
FilterProc: TYPE ~ PROC [x, y: REAL] RETURNS [REAL];
A filter function defined on x in [-1..+1], y in [-1..+1], returning values in [0..1]
DotScreen: FilterProc;
LineScreen: FilterProc;
Handy filter functions for NewBrick.
NewBrick: PROC [freq, angle: REAL, filter: FilterProc] RETURNS [Brick];
freq is the screen frequency, in pixels per dot (need not be an integer)
angle is the angle of screen rotation, in degrees
NewSquareBrick: PROC [size: NAT, p, q: INTEGER, pModulation, qModulation: REAL]
RETURNS
[Brick];
Makes a square brick with zero phase. Will return a dot screen if pModulation = qModulation > 0, a line screen if one of these is zero, otherwise something inbetween a dot and line screen. The screen angle will be arctan (p/q), and the period will be size/sqrt(p*p+q*q).
GetElement: PROC [brick: Brick, s, f: NAT] RETURNS [REAL];
Returns the sample value, IN[0..1], corresponding to location s, f.
ThresholdsFromBrick: PROC [brick: Brick, max: Sample,
scratch: SampleMap ← NIL] RETURNS [SampleMap];
Returns an array of samples IN[0..max].
END.