DIRECTORY ImagerPixelMap USING [PixelMap], ImagerPixelRow USING [PixelRow], ImagerTransformation USING [Transformation], Scaled USING [Value]; ImagerSampler: CEDAR DEFINITIONS ~ BEGIN PixelMap: TYPE ~ ImagerPixelMap.PixelMap; Transformation: TYPE ~ ImagerTransformation.Transformation; Pixel: TYPE ~ CARDINAL; PixelRow: TYPE ~ ImagerPixelRow.PixelRow; Sampler: TYPE ~ REF SamplerRep; SamplerRep: TYPE ~ RECORD [ m: Transformation, x, y: INTEGER, sPixels, fPixels: NAT, sStart, fStart: Scaled.Value, -- InverseTransform[m, [x+0.5, y+0.5]] MOD [sPixels, fPixels] sDelta, fDelta: Scaled.Value, -- InverseTransformVec[m, [0, 1]] sDeltaLine, fDeltaLine: Scaled.Value -- InverseTransformVec[m, [1, 0]] ]; CreateSampler: PROC [m: Transformation, x, y: INTEGER, sPixels, fPixels: NAT] RETURNS [sampler: Sampler]; SetSamplePosition: PROC [sampler: Sampler, x, y: INTEGER]; ObtainPointSamples: PROC [pixelRow: PixelRow, source: PixelMap, sampler: Sampler, multiplier: CARDINAL _ 1, lgScale: INTEGER _ 0]; ObtainInterpolatedSamples: PROC [pixelRow: PixelRow, source: PixelMap, sampler: Sampler, multiplier: CARDINAL _ 1, lgScale: INTEGER _ 0]; HalftoneLine: PROC [dest: PixelMap, pixels: PixelRow, thresholds: PixelRow, invertOutput: BOOLEAN _ FALSE, transparent: BOOLEAN _ FALSE]; DotScreen: PROC [r: REAL _ 0.5, sSize: NAT _ 16, fSize: NAT _ 16, maxPixelValue: CARDINAL] RETURNS [pixelMap: PixelMap]; ApplyTRC: PROC [thresholds: PixelMap, trc: PROC [x: REAL] RETURNS [y: REAL], maxPixelValue: CARDINAL]; Identity: PROC [x: REAL] RETURNS [y: REAL]; END. nImagerSampler.mesa Copyright c 1984, 1985 by Xerox Corporation. All rights reserved. Michael Plass, August 7, 1984 3:17:05 pm PDT Doug Wyatt, March 7, 1985 2:42:49 pm PST Incremental, assuming sampleHandle is already correct. Uses [pixelRow.sOrigin, pixelRow.fOrigin] to set [sampler.x, sampler.y] Fetches only sample points that fall within source.BoundedWindow Unfetched samples are unchanged in the buffer Pixel values are multiplied by multiplier*2**lgScale Interpolates four surrounding pixels to get result Pixel values are multiplied by multiplier*2**lgScale before interpolation Each threshold is the minimum pixel value that should be displayed as white. White = IF invertOutput THEN 1 ELSE 0 Creates a pixelMap with thresholds derived from two crossed cosines, uncorrected TRC. Adjusts the values in the pixelMap so they turn on according to the given transfer function. The x values of trc specify the inputs, as fractions of maxPixelValue. The y values of trc specify the outputs, as (number of black pixels)/(sSize*fSize) Both x and y range over [0.0..1.0] Trc should be a nondecreasing function. Just returns y. Κ†˜codešœ™Kšœ Οmœ7™BK™,K™(—K˜šΟk ˜ Kšœžœ ˜ Kšœžœ ˜ Kšœžœ˜,Kšœžœ ˜—K˜KšΠbl œžœž ˜ Kšœž˜K˜Kšœ žœ˜)Kšœžœ'˜;Kšœžœžœ˜Kšœ žœ˜)K˜Kšœ žœžœ ˜šœ žœžœ˜K˜Kšœžœ˜Kšœžœ˜KšœΟc=˜\Kšœ !˜?Kšœ% !˜FKšœ˜K˜—K˜š Οn œžœžœžœžœ˜iK˜—š‘œžœžœ˜:Kšœ6™6K˜—š‘œžœFžœžœ˜‚KšœG™GKšœ@™@K™-Kšœ4™4K˜—š‘œžœFžœžœ˜‰K™2KšœI™IK˜—š ‘ œžœHžœžœžœžœ˜‰KšœL™LKšœžœžœžœ™%K˜—š‘ œžœžœžœžœžœžœ˜xKšœQž™UK˜—š‘œžœžœžœžœžœžœ˜fK™\KšœF™FKšœR™RK™"K™'K˜—š ‘œžœžœžœžœ˜+K™K˜—K˜Kšžœ˜—…—