IIPixel.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, August 19, 1986 10:32:14 am PDT
Doug Wyatt, March 7, 1986 2:41:21 pm PST
DIRECTORY
IISample USING [Function, maxCount, nullFunction, Sample, SampleBuffer, SampleMap],
IITransformation USING [Transformation],
SF USING [Box, BoxGenerator, Vec, zeroVec];
~
BEGIN
Function: TYPE ~ IISample.Function;
maxCount: NAT ~ IISample.maxCount;
nullFunction: Function ~ IISample.nullFunction;
Sample: TYPE ~ IISample.Sample;
SampleBuffer: TYPE ~ IISample.SampleBuffer;
SampleMap:
TYPE ~ IISample.SampleMap;
Transformation: TYPE ~ IITransformation.Transformation;
Pixels, PixelBuffers and PixelMaps
PixelProc: TYPE ~ PROC [i: NAT] RETURNS [Sample];
PixelBuffer: TYPE ~ REF PixelBufferRep;
PixelBufferRep:
TYPE ~
RECORD [
length: NAT,
sampleBuffers: SEQUENCE samplesPerPixel: NAT OF SampleBuffer
];
NewPixels:
PROC [samplesPerPixel:
NAT, length:
NAT,
scratch: PixelBuffer ←
NIL]
RETURNS [PixelBuffer];
ObtainScratchPixels:
PROC [samplesPerPixel:
NAT, length:
NAT]
RETURNS [PixelBuffer];
ReleaseScratchPixels:
PROC [pixels: PixelBuffer];
DoWithScratchPixels:
PROC [samplesPerPixel:
NAT, length:
NAT, action:
PROC [PixelBuffer]];
PixelMap: TYPE ~ REF PixelMapRep;
PixelMapRep:
TYPE ~
RECORD [
box: SF.Box,
sampleMaps: SEQUENCE samplesPerPixel: NAT OF SampleMap
];
NewPixelMap:
PROC [samplesPerPixel:
NAT, box:
SF.Box, maxSample: PixelProc]
RETURNS [PixelMap];
MakePixelMap:
PROC [s0, s1, s2, s3, s4: SampleMap ←
NIL]
RETURNS [PixelMap];
Convenience for creating a PixelMap from up to 5 existing SampleMaps. The boxes of the SampleMaps must all be the same.
GetPixels:
PROC [self: PixelMap, initIndex:
SF.Vec ←
SF.zeroVec, delta:
SF.Vec ← [s: 0, f: 1],
pixels: PixelBuffer, start:
NAT ← 0, count:
NAT ← maxCount];
Gets a run of pixels from a pixel map into a pixel buffer. The effect is:
FOR i: NAT IN [0..self.samplesPerPixel) DO
self[i].GetSamples[initIndex, delta, pixels[i], start, count];
ENDLOOP;
PutPixels:
PROC [self: PixelMap, initIndex:
SF.Vec ←
SF.zeroVec, delta:
SF.Vec ← [s: 0, f: 1],
pixels: PixelBuffer, start:
NAT ← 0, count:
NAT ← maxCount,
function: Function ← nullFunction];
Stores a run of pixels into a pixel map from a pixel buffer. The effect is:
FOR i: NAT IN [0..self.samplesPerPixel) DO
self[i].PutSamples[initIndex, delta, pixels[i], start, count, function];
ENDLOOP;
ResampleAction:
TYPE ~
PROC [pixels: PixelBuffer, min:
SF.Vec];
Resample: PROC [self: PixelMap, m: Transformation, interpolate: BOOL,
boxes: SF.BoxGenerator, bounds: SF.Box, action: ResampleAction];