PixelMapOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, October 7, 1985 11:46:06 am PDT
Auxillary operations for ImagerPixelMap and ImagerSample interfaces.
DIRECTORY
ImagerPixelMap USING [PixelMap, PixelMapRep],
ImagerSample USING [Sample, SampleBuffer, UnsafeSamples],
PrincOps USING [DstFunc, SrcFunc],
Rope USING [ROPE];
PixelMapOps: CEDAR DEFINITIONS
~ BEGIN OPEN ImagerPixelMap, ImagerSample, Rope;
The get and put operations in this interface do not clip against the pixelMap window; they do perform bounds checks to prevent access to non-existent parts of the raster.
GetF: PROC [pixelMap: PixelMap, s: INTEGER, f: INTEGER, buffer: SampleBuffer, bi: NAT, bj: NAT, count: NAT];
FOR k: NAT IN[0..count) DO
buffer.PutSample[bi, bj+k, pixelMap.GetPixel[s, f+k]]
ENDLOOP;
PutF: PROC [pixelMap: PixelMap, s: INTEGER, f: INTEGER, buffer: SampleBuffer, bi: NAT, bj: NAT, count: NAT, srcFunc: PrincOps.SrcFunc ← null, dstFunc: PrincOps.DstFunc ← null];
FOR k: NAT IN[0..count) DO
pixelMap.Fill[[s, f+k, 1, 1], buffer.GetSample[bi, bj+k], [dstFunc, srcFunc]]
ENDLOOP;
GetS: PROC [pixelMap: PixelMap, s: INTEGER, f: INTEGER, buffer: SampleBuffer, bi: NAT, bj: NAT, count: NAT];
FOR k: NAT IN[0..count) DO
buffer.PutSample[bi, bj+k, pixelMap.GetPixel[s+k, f]]
ENDLOOP;
PutS: PROC [pixelMap: PixelMap, s: INTEGER, f: INTEGER, buffer: SampleBuffer, bi: NAT, bj: NAT, count: NAT, srcFunc: PrincOps.SrcFunc ← null, dstFunc: PrincOps.DstFunc ← null];
FOR k: NAT IN[0..count) DO
pixelMap.Fill[[s+k, f, 1, 1], buffer.GetSample[bi, bj+k], [dstFunc, srcFunc]]
ENDLOOP;
ClearSamples: PROC [buffer: SampleBuffer, i, j: NAT ← 0, count: NAT];
FillSamples: PROC [buffer: SampleBuffer, i, j: NAT ← 0, count: NAT, sample: Sample];
CopySamples: PROC [buffer: SampleBuffer, bi, bj: NAT ← 0, count: NAT, source: SampleBuffer, si, sj: NAT ← 0];
Halftone: PROC [pixelMap: PixelMap, s: INTEGER, f: INTEGER, samples, thresholds: UnsafeSamples, count: NAT, invertOutput: BOOLFALSE, transparent: BOOLFALSE];
UnsafeHalftone: UNSAFE PROC [samples, thresholds: UnsafeSamples, count: NAT,
base: LONG POINTER, wordsPerLine: NAT, s, f: NAT ← 0, invertOutput: BOOLFALSE, transparent: BOOLFALSE];
BoxFilter: PROC [pixelMap: PixelMap, sSizeBox, fSizeBox: [0..256), wrap: BOOLTRUE];
ChangeBitsPerPixel: PROC [pixelMap: PixelMap, newLgBitsPerPixel: [0..4], scratch: REF PixelMapRep ← NIL] RETURNS [PixelMap];
ChangeContrast: PROC [pixelMap: PixelMap, oldminvalue, oldmaxvalue, newminvalue, newmaxvalue: REAL];
AISData: TYPE ~ RECORD [
pixelMap: PixelMap,
bitmap: BOOL,
comment: ROPE
];
LoadAIS: PROC [aisName: ROPE] RETURNS [AISData];
ReadAIS: PROC [pixelMap: PixelMap, aisName: ROPE];
StoreAIS: PROC [aisName: ROPE, aisData: AISData];
END.