DIRECTORY Atom USING [PropList], IIPixel USING [PixelBuffer, PixelMap, PixelProc], IISample USING [Function, maxVec, nullFunction, Sample, SampleMap, SampleBuffer, Vec, zeroVec], IITransformation USING [ScanMode, Transformation], Rope USING [ROPE], SF USING [Box]; IIPixelArray: CEDAR DEFINITIONS ~ BEGIN Transformation: TYPE ~ IITransformation.Transformation; ScanMode: TYPE ~ IITransformation.ScanMode; Sample: TYPE ~ IISample.Sample; SampleBuffer: TYPE ~ IISample.SampleBuffer; SampleMap: TYPE ~ IISample.SampleMap; PixelProc: TYPE ~ IIPixel.PixelProc; PixelBuffer: TYPE ~ IIPixel.PixelBuffer; PixelMap: TYPE ~ IIPixel.PixelMap; Vec: TYPE ~ IISample.Vec; zeroVec: Vec ~ IISample.zeroVec; maxVec: Vec ~ IISample.maxVec; Function: TYPE ~ IISample.Function; nullFunction: Function ~ IISample.nullFunction; ROPE: TYPE ~ Rope.ROPE; maxCount: NAT ~ NAT.LAST; PixelArray: TYPE ~ REF PixelArrayRep; PixelArrayRep: TYPE ~ RECORD [ immutable: BOOL, samplesPerPixel: NAT, -- number of samples for each pixel sSize, fSize: INT, -- slow and fast dimensions (Interpress calls these xPixels, yPixels) m: Transformation, -- transforms [s, f] coordinates to "upright" [x, y] coordinates class: REF PixelArrayClassRep, -- class operations data: REF, -- instance data propList: Atom.PropList _ NIL ]; PixelArrayClassRep: TYPE; -- see IIPixelArrayPrivate ErrorDesc: TYPE ~ RECORD [code: ATOM, explanation: ROPE]; Error: ERROR [error: ErrorDesc]; GetClass: PROC [self: PixelArray] RETURNS [ATOM]; MaxSampleValue: PROC [self: PixelArray, i: NAT] RETURNS [Sample]; Get: PROC [self: PixelArray, i: NAT _ 0, s, f: INT] RETURNS [Sample]; GetSamples: PROC [self: PixelArray, i: NAT _ 0, s, f: INT _ 0, buffer: SampleBuffer, start: NAT _ 0, count: NAT _ maxCount]; GetPixels: PROC [self: PixelArray, s, f: INT _ 0, pixels: PixelBuffer, start: NAT _ 0, count: NAT _ maxCount]; Transfer: PROC [self: PixelArray, i: NAT _ 0, s, f: INT _ 0, dst: SampleMap, dstMin: Vec _ zeroVec, size: Vec _ maxVec, function: Function _ nullFunction]; Copy: PROC [self: PixelArray] RETURNS [PixelArray]; Extract: PROC [old: PixelArray, samplesPerPixel: NAT, select: PROC [NAT] RETURNS [NAT]] RETURNS [new: PixelArray]; Join: PROC [list: LIST OF PixelArray] RETURNS [PixelArray]; Join3: PROC [pa1, pa2, pa3: PixelArray] RETURNS [PixelArray]; FromPixelMap: PROC [pixelMap: PixelMap, box: SF.Box, scanMode: ScanMode, immutable: BOOL _ FALSE] RETURNS [PixelArray]; FromAIS: PROC [name: ROPE] RETURNS [PixelArray]; Join3AIS: PROC [name1, name2, name3: ROPE] RETURNS [PixelArray]; END. PIIPixelArray.mesa Copyright c 1984, 1985, 1986 by Xerox Corporation. All rights reserved. Michael Plass, September 15, 1986 4:32:42 pm PDT Doug Wyatt, March 3, 1986 3:09:37 pm PST Basic operations The pixel array contains sSize*fSize pixels, samplesPerPixel*sSize*fSize samples. A sample is named by a triple: i IN[0..samplesPerPixel), s IN[0..sSize), f IN[0..fSize). ... returns an ATOM that identifies the PixelArray's class. ... returns the maximum sample value for the ith sample. For all i IN[0..self.samplesPerPixel), s IN[0..self.sSize), f IN[0..self.fSize): self.Get[i, s, f] IN[0..self.MaxSampleValue[i]]. ... returns the sample value with indices [i, s, f]. ! BoundsFault if i ~IN[0..self.samplesPerPixel) OR s ~IN[0..self.sSize) OR f ~IN[0..self.fSize). ... fetches a run of samples into a buffer. The effect is: FOR k: NAT IN[0..MIN[samples.length-start, count]) DO samples[start+k] _ self.Get[i, s, f+k] ENDLOOP ! BoundsFault if any index into the pixel array is out of range ... fetches a run of pixels into a buffer. The effect is: FOR i: NAT IN[0..self.samplesPerPixel) DO self.GetSamples[i, s, f, pixels[i], start, count] ENDLOOP ! BoundsFault if any index into the pixel array is out of range ... like IISample.Transfer, where the pixel array is the source. ! BoundsFault if any sample index is out of range Creating pixel arrays ... makes an immutable copy of a pixel array; returns self if self.immutable. ... extracts selected sample layers from a pixel array. new.samplesPerPixel = samplesPerPixel new.sSize = old.sSize, new.fSize = old.fSize IITransformation.Equal[new.m, old.m] new.MaxSampleValue[i] = old.MaxSampleValue[select[i]] new.Get[i, s, f] = old.Get[select[i], s, f] ! BoundsFault if for any i IN[0..samplesPerPixel), select[i] ~IN[0..pa.samplesPerPixel). ... joins multiple sample planes into one PixelArray. ! Error[[$incompatibleJoin, ...]] if sizes or transformations do not match. If immutable=TRUE, caller guarantees that the contents of the PixelMap will not change as long as the PixelArray is in use. The ScanMode relates the (slow, fast) coords of the PixelMap to the client coords of the PixelArray. The box must lie completely within the bounds of the map, or a bounds fault will occur. The pixel indexed by box.min in the pixelMap will be at [0, 0] in the PixelArray. ... makes a pixel array from an AIS file with the specified name. ! FS.Error if the named file cannot be opened. ! Error[[$malformedAISFile, ...]] if the file is not a valid AIS file. A convenience, equivalent to Join3[FromAIS[name1], FromAIS[name2], FromAIS[name3]]. ! FS.Error or Error, as for FromAIS or Join. Κο˜codešœ™Kšœ Οmœ=™HK™0K™(—K˜šΟk ˜ Kšœžœ ˜Kšœžœ$˜1Kšœ žœQ˜_Kšœžœ˜2Kšœžœžœ˜Kšžœžœ˜—K˜KšΠbl œžœž ˜šœž˜K˜Kšœžœ#˜7Kšœ žœ˜+Kšœžœ˜Kšœžœ˜+Kšœ žœ˜%Kšœ žœ˜$Kšœ žœ˜(Kšœ žœ˜"Kšœžœ˜Kšœ ˜ Kšœ˜Kšœ žœ˜#Kšœ/˜/Kšžœžœžœ˜Kšœ žœžœžœ˜—head™Kšœ žœžœ˜%šœžœžœ˜Kšœ žœ˜KšœžœΟc#˜9Kšœžœ E˜XKšœ @˜SKšœžœ ˜2Kšœžœ ˜Kšœž˜K˜KšœQ™QKšœ!žœžœžœ ™XK™—Kšœžœ ˜4K˜Kš œ žœžœžœžœ˜9Kšœžœ˜ K˜šΟnœžœžœžœ˜1Kšœžœ(™;K™—š‘œžœžœžœ ˜AK™8šœ žœžœžœ™PKšœžœ™0—K™—š ‘œžœžœ žœžœ ˜EK™4Kš œžœžœžœžœžœ™`K˜—š ‘ œžœžœ žœ$žœ žœ ˜}™:š žœžœžœžœž™5Kšœ&™&Kšž™——Kšœ?™?K˜—š ‘ œžœžœ#žœ žœ ˜o™9šžœžœžœž™)K™1Kšž™——Kšœ?™?K˜—š‘œžœžœ žœe˜œKšœ@™@Kšœ1™1K˜——™š‘œžœžœ˜3KšœM™MK˜—š‘œžœ$žœ žœžœžœžœžœ˜s™7Kšœ%™%Kšœ,™,Kšœ$™$Kšœ5™5Kšœ+™+—Kšœžœ!žœ™XK˜—K˜Kš ‘œžœžœžœ žœ˜;š‘œžœžœ˜=Kšœ5™5KšœK™KK™—K˜š ‘ œžœžœ%žœžœžœ˜wKšœ žœj™{Kšœd™dKšœW™WKšœQ™QK˜—K˜š‘œžœžœžœ˜0KšœA™AKšœžœ*™.KšœF™FK™—š‘œžœžœžœ˜@KšœS™SKšœžœ(™,K™——K˜Kšžœ˜J˜—…— ώ=