MaskWithColor: DEFINITIONS = BEGIN Ptr: TYPE = LONG POINTER TO WORD; bitsPerUnit: NAT = BITS[UNIT]; bitsPerWord: NAT = BITS[WORD]; unitsPerWord: NAT = UNITS[WORD]; BitOffset: TYPE = [0..bitsPerWord); LogBitOffset: TYPE = [0..BITS[BitOffset]]; RunSeq: TYPE = LONG POINTER TO RunSeqRep; RunSeqRep: TYPE = RECORD [PACKED SEQUENCE len: CARDINAL OF RunByte]; RunByte: TYPE = WORD8 MACHINE DEPENDENT RECORD [ count: RunCount, -- the number of pixels to color or skip color: BOOL, -- color => store the color, else skip last: BOOL -- last => last run in the line ]; RunCount: TYPE = [1..64]; LongRunSeq: TYPE = LONG POINTER TO LongRunSeqRep; LongRunSeqRep: TYPE = RECORD [PACKED SEQUENCE len: CARDINAL OF LongRun]; LongRun: TYPE = MACHINE DEPENDENT RECORD [ fMin: CARD16, -- fMin is relative to the line start lastRun: BOOL, -- lastRun is TRUE for the last run in the line fSize: NAT15]; -- fSize is the length of the run MakeColorWord: PROC [sampleColor: WORD, logDepth: LogBitOffset] RETURNS [WORD]; StoreWithColorMask: PROC [ maskBase: Ptr, maskOffset: CARDINAL, maskWpl: CARDINAL, dstBase: Ptr, dstOffset: CARDINAL, dstWpl: CARDINAL, height: CARDINAL, width: CARDINAL, logDepth: LogBitOffset, colorWord: WORD]; StoreWithColorRuns: PROC [ mask: RunSeq, dstBase: Ptr, dstOffset: CARDINAL, dstWpl: CARDINAL, logDepth: LogBitOffset, colorWord: WORD]; StoreWithLongColorRuns: PROC [ mask: LongRunSeq, dstBase: Ptr, dstOffset: CARDINAL, dstWpl: CARDINAL, logDepth: LogBitOffset, colorWord: WORD]; BadRun: ERROR; MaskToRun: PROC [run: RunSeq, maskPtr: Ptr, offset: CARDINAL, wpl: CARDINAL, height: CARDINAL, width: CARDINAL] RETURNS [CARDINAL]; MaskToLongRun: PROC [run: LongRunSeq, maskPtr: Ptr, offset: CARDINAL, wpl: CARDINAL, height: CARDINAL, width: CARDINAL] RETURNS [CARDINAL]; END. – MaskWithColor.mesa Copyright Σ 1989, 1991 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) August 4, 1989 6:00:06 pm PDT Must be compatible with the runs variant of ImagerMaskCache Takes a pixel value (in the low-order bits) and propagates it through the word as required by other operations, returning the filled word. In the rectangle given by width & height, for each "one" in the mask (specified by maskBase, maskOffset, and maskWpl), the specified color is stored into the corresponding pixel in the the destination (specified by dstBase, dstOffset, and dstWpl). Argument interpretations maskBase: a word pointer to the base of the mask maskOffset: a bit offset into the mask maskWpl: the # of words between lines in the mask dstBase: a word pointer to the base of the destination dstOffset: a pixel index into the destination dstWpl: a # of words between lines in the destination height: the # of lines in the rectangle to color width: the # of pixels per line in the rectangle to color logDepth: 2**logDepth = the number of bits in a pixel colorWord: a word filled with the color (as by MakeColorWord) For each "one" in the run-encoded mask the specified color is stored into the corresponding pixel in the the destination (specified by dstBase, dstOffset, and dstWpl). The height and width are implicit in the mask. Argument interpretations mask: the runs encoded as a byte sequence dstBase: a word pointer to the base of the destination dstOffset: a pixel index into the destination dstWpl: a # of words between lines in the destination logDepth: 2**logDepth = the number of bits in a pixel colorWord: a word filled with the color (as by MakeColorWord) For each "one" in the run-encoded mask the specified color is stored into the corresponding pixel in the the destination (specified by dstBase, dstOffset, and dstWpl). The height and width are implicit in the mask. Argument interpretations mask: the runs encoded as a long run sequence dstBase: a word pointer to the base of the destination dstOffset: a pixel index into the destination dstWpl: a # of words between lines in the destination logDepth: 2**logDepth = the number of bits in a pixel colorWord: a word filled with the color (as by MakeColorWord) Takes a mask specification and calculates the length of run required to describe the mask. If run = NIL, then it calculates the size of the run. If run # NIL, then it fills in the run, raising BadRun if the length is not correct. Takes a mask specification and calculates the length of run required to describe the mask. If run = NIL, then it calculates the size of the run. If run # NIL, then it fills in the run, raising BadRun if the length is not correct. ΚΞ–(cedarcode) style•NewlineDelimiter ™headšœ™Icodešœ Οeœ7™BLšœΟkœ™1L™—šΟn œž œž˜"L˜Lš œžœž œžœžœ˜!Lšœ žœžœžœ˜Lšœ žœžœžœ˜Lšœžœžœžœ˜ Lšœ žœ˜#Lšœžœžœ ˜*L˜Lšœžœžœ ˜)Lš œ žœžœžœžœžœžœ ˜Dš œ žœžœžœž œžœ˜0LšœΟc(˜9Lšœžœ '˜5Lšœžœ ˜+L˜—Lšœ žœ ˜L˜Lš œ žœžœžœžœ˜1Lš œžœžœžœžœžœžœ ˜Hš œ žœžœž œžœ˜*Lšœžœ %˜3Lšœ žœ /˜>Lšœžœ !˜0L™;L˜——š Ÿ œžœžœžœžœ˜OLšœŠ™Š—L˜šŸœžœžœ žœžœ žœ žœ žœ%žœ˜ΤLšœχ™χ™Lšœ0™0Lšœ&™&Lšœ1™1Lšœ6™6Lšœ-™-Lšœ5™5Lšœ0™0Lšœ9™9Lšœ5™5Lšœ=™=——L˜š Ÿœžœ*žœ žœ%žœ˜‡LšœΧ™Χ™Lšœ)™)Lšœ6™6Lšœ-™-Lšœ5™5Lšœ5™5Lšœ=™=L™——š Ÿœžœ.žœ žœ%žœ˜LšœΧ™Χ™Lšœ-™-Lšœ6™6Lšœ-™-Lšœ5™5Lšœ5™5Lšœ=™=——L™šŸœžœ˜L˜—šŸ œžœ$žœžœ žœ žœžœžœ˜ƒLšœežœ4žœH™ηL˜L˜—šŸ œžœ(žœžœ žœ žœžœžœ˜‹Lšœežœ4žœH™ηL˜—Lšžœ˜L˜—…—f