HBrick.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Michael Plass, July 13, 1987 4:34:09 pm PDT
For creating halftone bricks and tiles.
DIRECTORY
ImagerBitmapContext USING [Brick],
ImagerTransformation USING [Transformation];
HBrick: CEDAR DEFINITIONS
~ BEGIN
Transformation: TYPE ~ ImagerTransformation.Transformation;
BrickShape: TYPE ~ RECORD [sSize, fSize, phase: CARD];
BrickShapeFromDeltas: PROC [s0, f0, s1, f1: INT] RETURNS [BrickShape];
BrickSpec: TYPE ~ RECORD [brickShape: BrickShape, m: Transformation];
BrickSpecFromTransformedRectangle: PROC [w, h: REAL, clientToDevice: Transformation, allowedRelativeError: REAL ← 0.05, minLevels: CARD ← 1] RETURNS [BrickSpec];
BrickSpec.m is a perturbed version of clientToDevice that maps the brick exactly
allowedRelativeError controls how close m ought to be to clientToDevice
minLevels puts a lower limit on the number of pixels in the result
Brick: TYPE ~ ImagerBitmapContext.Brick;
BrickFromDotScreen: PROC [pixelsPerDot: REAL, degrees: REAL, shape: REAL ← 0.5, allowedRelativeError: REAL ← 0.05, minLevels: CARD ← 16, maxSample: CARDINAL ← 255, pixelToDevice: Transformation ← NIL, trc: PROC [REAL] RETURNS [REAL] ← NIL] RETURNS [Brick];
pixelsPerDot is the number of "normalized" device pixels per halftone dot
degrees is the counterclockwise rotation
shape controls how elliptical the dots are; 0.0 and 1.0 give two different line screens, and 0.5 produces a dot symmetrical in x and y (before rotation). A shape parameter that is a little different from 0.5 usually gives a more uniform response curve.
allowedRelativeError, minLevels as above
maxSample is the maximum sample value in the output
pixelToDevice specifies a transformation from the "normalized" device pixels do the actual device pixels; this is useful to account for different scan directions and to allow for differing resolutions in the two directions.
trc is a specification of the desired output-to-input mapping effected by the brick; it should map the interval [0.0..1.0] monotonically onto itself.
FilterProc: TYPE ~ PROC [x, y: REAL] RETURNS [REAL];
A filter function defined on x in [-1..+1], y in [-1..+1], returning values over any range.
BrickFromFilter: PROC [brickSpec: BrickSpec, filter: FilterProc, maxSample: CARDINAL ← 255, trc: PROC [REAL] RETURNS [REAL] ← NIL] RETURNS [Brick];
Calls the FilterProc to generate the samples; linearizes the result.
maxSample and trc are as above
END.