RasterOp.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, October 1, 1991 11:11 am PDT
DIRECTORY Basics, RasterBasics;
RasterOp: DEFINITIONS
~ BEGIN
Types
DstFunc: TYPE ~ RasterBasics.DstFunc;
SrcFunc: TYPE ~ RasterBasics.SrcFunc;
BitAddress: TYPE ~ RasterBasics.BitAddress;
RawWords: TYPE ~ Basics.RawWords;
BitsPerSample: TYPE ~ [0..BITS[WORD]];
Word: TYPE = WORD;
WordPtr: TYPE = LONG POINTER TO Word;
Offset: TYPE = CARD[0..BITS[Word]);
Packing/Unpacking
Pack: PROC [dst: BitAddress, src: LONG POINTER TO RawWords, bitsPerSample: BitsPerSample, nSamples: CARDINAL];
Packs a bunch of samples into contiguous memory.
dst specifies the first bit of the destination to get filled.
src points to the first sample (one sample per word)
bitsPerSample is the number of bits occupied by each destination sample.
nSamples is the number of samples.
Unpack: PROC [dst: LONG POINTER TO RawWords, src: BitAddress, bitsPerSample: BitsPerSample, nSamples: CARDINAL];
Packs a bunch of samples from contiguous memory into words.
dst points to the slot for the first sample (one sample per word)
src specifies the first bit of first source sample.
bitsPerSample is the number of bits occupied by each source sample.
nSamples is the number of samples.
Filling
FillWords: PROC [dst: WordPtr, len: INT, fill: Word];
FillWords is a fast procedure for filling a number of words with a constant word.
Tiling
tileOp: ARRAY DstFunc OF ARRAY SrcFunc OF UNSAFE PROC [dst: BitAddress, src: LONG POINTER TO RawWords, dstBpl, src0, sSizeTile, sSize, fSize: CARDINAL];
Tiles a raster with a tile 32 bits wide. The destination bits are aligned with the source bits.
dst specifies the first bit of the destination to get filled.
src points to the first word of the tiling pattern.
dstBpl is the number of bits per line in the destination.
src0 is the number of the first line of the tile to get moved.
sSizeTile is the size of the tile in the slow direction (number of lines).
sSize, fSize specify the size of the raster.
Transfers
forwardOp: ARRAY DstFunc OF ARRAY SrcFunc OF UNSAFE PROC [dst: BitAddress, src: BitAddress, dstBpl, srcBpl, sSize, fSize: CARDINAL];
Forward-moving RasterOps. Index into the table to select the function.
dst specifies the first bit of the destination to get filled.
src specifies the first bit of the destination to get copied.
dstBpl is the number of bits per line in the destination (arbitrary).
srcBpl is the number of bits per line in the source (arbitrary).
sSize, fSize specify the size of the raster.
backwardOp: ARRAY DstFunc OF ARRAY SrcFunc OF UNSAFE PROC [dst: BitAddress, src: BitAddress, dstBpl, srcBpl, sSize, fSize: CARDINAL];
Backward-moving RasterOps.
CharBlt
OrBlt: PROC [
src: WordPtr, -- src address (word-aligned)
dst: WordPtr, -- dst address (word-aligned)
offset: Offset, -- bit offset in dst
bpc: CARDINAL, -- bits per character
upl: INT,  -- addressing units per scan line in dst
lines: INT]; -- # of scan lines
OrBlt ORs bits from the src bitmap into the dst bitmap. The src bitmap is assumed to have the scan lines left-justified in an integral number of 32-bit words, with the scan lines padded with zero bits on the right. The number of words in each src scan line is assumed to be no greater than that required to hold bpc bits. The scan lines in the dst bitmap must be word-aligned (upl MOD UNITS[WORD] = 0).
AndCBlt: PROC [
src: WordPtr, -- src address (word-aligned)
dst: WordPtr, -- dst address (word-aligned)
offset: Offset, -- bit offset in dst
bpc: CARDINAL,  -- bits per character
upl: INT,  -- addressing units per scan line in dst
lines: INT]; -- # of scan lines
AndCBlt is just like OrBlt, except that the function used is AND with complement, which is useful for writing white characters on black background.
END.