ImagerDither.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, June 21, 1985 1:16:22 pm PDT
DIRECTORY
Basics USING [BYTE, RawBytes, RawWords],
CountedVM USING [Handle],
IIColorMap USING [MapEntry];
IIDither: CEDAR DEFINITIONS
~ BEGIN
BYTE: TYPE ~ Basics.BYTE;
ChannelValue: TYPE ~ [0..256);
ColorValue: TYPE ~ [0..256);
RawWords: TYPE ~ Basics.RawWords;
RawBytes: TYPE ~ Basics.RawBytes;
BitCount: TYPE ~ [0..16];
PackedColorDesc: TYPE ~ RECORD [
Describes the layout of the bits in a packed color. The bits are packed in the order shown, with the red bits nearest the high-order end, and the tile index in the low-order bits.
redBits: BitCount ← 4,
greenBits: BitCount ← 4,
blueBits: BitCount ← 4,
tileIndexBits: BitCount ← 4
];
PackedColor: TYPE ~ WORD;
MaxPackedColor: PROC [packing: PackedColorDesc] RETURNS [CARDINAL];
Pack: PROC [red, green, blue: BYTE, packing: PackedColorDesc] RETURNS [PackedColor];
Unpack: PROC [packed: PackedColor, packing: PackedColorDesc] RETURNS [red, green, blue: BYTE, tileIndex: CARDINAL];
PackSequence: UNSAFE PROC [dest, red, green, blue: LONG POINTER TO RawWords, count: NAT, packing: PackedColorDesc];
PreDither: UNSAFE PROC [words: LONG POINTER TO RawWords, count: NAT, s: NAT ← 0, bits: NAT ← 8, fractionBits: NAT ← 4];
Table: TYPE ~ REF TableRep;
TableRep: TYPE ~ RECORD [
packing: PackedColorDesc,
maxPackedColor: CARDINAL,
sTileSize: NAT,
fTileSize: NAT,
space: CountedVM.Handle
];
CreateTable: PROC [packing: PackedColorDesc, sTileSize: NAT ← 4, fTileSize: NAT ← 4] RETURNS [Table];
MapEntry: TYPE ~ IIColorMap.MapEntry;
InitTable: PROC [table: Table, map: LIST OF MapEntry, scaleMap: NAT ← 1];
Dither: UNSAFE PROC [destLine: LONG POINTER TO RawBytes, start, count: NAT, packed: LONG POINTER TO RawWords, sTile, fTile: CARDINAL, table: Table];
WordDither: UNSAFE PROC [destLine: LONG POINTER TO RawWords, start, count: NAT, packed: LONG POINTER TO RawWords, sTile, fTile: CARDINAL, table: Table];
DitherConstant: UNSAFE PROC [destLine: LONG POINTER TO RawBytes, start, count: NAT, packed: PackedColor, sTile, fTile: CARDINAL, table: Table];
WordDitherConstant: UNSAFE PROC [destLine: LONG POINTER TO RawWords, start, count: NAT, packed: PackedColor, sTile, fTile: CARDINAL, table: Table];
END.