ScanConvert.mesa
Copyright Ó 1984, 1987 by Xerox Corporation. All rights reserved.
Frank Crow, July 1, 1987 5:21:01 pm PDT
Scan conversion for lines and polygons and image manipulation, no anti-aliasing.
DIRECTORY
ImagerPixel USING [ PixelBuffer ],
EdgeBlt USING [ EdgeSequence ],
ThreeDBasics USING [ Context, IntegerPair, Patch,
Pixel, RealSequence, RGB ];
ScanConvert:
CEDAR
DEFINITIONS
~ BEGIN
Type Definitions
Context: TYPE ~ ThreeDBasics.Context;
Pixel: TYPE ~ ThreeDBasics.Pixel; -- red, green, blue, alpha (coverage), z (depth)
PixelBufferProc: TYPE ~ PROC[ImagerPixel.PixelBuffer];
RGB: TYPE ~ ThreeDBasics.RGB; -- RECORD[ r, g, b: REAL];
IntRGBT: TYPE ~ RECORD[ r, g, b, t: CARDINAL];
RealSequence:
TYPE ~ ThreeDBasics.RealSequence;
RECORD [length: NAT ← 0, s: SEQUENCE maxLength: NAT OF REAL];
IntegerPair: TYPE ~ ThreeDBasics.IntegerPair; -- RECORD[x, y: INTEGER]
Patch: TYPE ~ ThreeDBasics.Patch;
EdgeSequence:
TYPE ~ EdgeBlt.EdgeSequence;
RECORD [length: NAT ← 0, s: SEQUENCE maxLength: NAT OF EdgeBlt.EdgeDesc ];
CnvxPoly: TYPE ~ RECORD[ lftSrc, lftDst, rgtSrc, rgtDst, scanSrc, scanDst: REF EdgeSequence ];
Constants
justNoticeable: REAL ~ 0.02; -- percentage intensity change for a just noticeable difference
Utility Procedures
Extend: PROC[ seq: REF RealSequence, newLength: NAT] RETURNS[REF RealSequence];
Power: PROC[ value: CARD16, power: NAT] RETURNS[ result: CARD16 ];
MappedRGB: PROC[renderMode: ATOM, clr: RGB] RETURNS[NAT];
RGBFromMap: PROC[renderMode: ATOM, value: NAT] RETURNS[RGB];
Pixel Operations
DoWithPixels: PROC [ context: REF Context, start: IntegerPair, length: NAT, proc: PixelBufferProc ];
Scan Conversion for Lines
PutLine: PROC [context: REF Context, p1, p2: IntegerPair, color1, color2: Pixel ];
Scan Conversion for Convex Areas
FastFlatTiler: PROC [context: REF Context, plygn: REF Patch, color: Pixel];
LerpTiler: PROC [context: REF Context, plygn: REF Patch];
HiliteTiler: PROC [context: REF Context, plygn: REF Patch, shininess: NAT];
END.