ImagerBrick.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Doug Wyatt, May 18, 1985 2:45:00 pm PDT
For creating halftone bricks.
DIRECTORY
ImagerSample USING [Sample, SampleBuffer];
ImagerBrick: CEDAR DEFINITIONS
~ BEGIN
Sample: TYPE ~ ImagerSample.Sample;
SampleBuffer: TYPE ~ ImagerSample.SampleBuffer;
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: SampleBuffer ← NIL] RETURNS [SampleBuffer];
Returns an array of samples IN[0..max], iSize=brick.sSize, jSize=brick.fSize
END.