~
BEGIN
PixelMap: TYPE ~ ImagerPixelMap.PixelMap;
DeviceRectangle: TYPE ~ ImagerPixelMap.DeviceRectangle;
Kernel: TYPE ~ PixelMap;
Intensity: TYPE ~ [0..256);
NoisePenalty:
TYPE ~ [0..5000);
PrinterModel:
TYPE ~
PROC [bitmap: PixelMap, encoding:
CARDINAL]
RETURNS [Intensity, NoisePenalty];
Model: TYPE ~ REF ModelRep;
ModelRep:
TYPE ~
RECORD [
neighborhood: DeviceRectangle,
kernel: Kernel,
data: REF
];
ModelParameterFault:
ERROR [data:
REF];
CreatePrinterModel:
PROC [neighborhood: DeviceRectangle, printerModel: PrinterModel, kernel: PixelMap]
RETURNS [model: Model];
RotateModel:
PROC [model: Model]
RETURNS [Model];
Rotates in the same sense as ImagerPixelMap.Rotate.
Convolve:
PROC [pixelMap: PixelMap, kernel: Kernel, unitIntensity:
CARDINAL];
KernelWeight:
PROC [kernel: Kernel]
RETURNS [weight:
INT];
AddBorder:
PROC [pixelMap: PixelMap, borderSize:
NAT, borderValue:
CARDINAL]
RETURNS [bordered: PixelMap];
ErrorOf:
PROC [gray: PixelMap, bitmap: PixelMap, model: Model]
RETURNS [
INT];
ApplyModel:
PROC [bitmap: PixelMap, model: Model]
RETURNS [PixelMap];
AbsDiff:
PROC [a, b: PixelMap]
RETURNS [error:
INT];
RandomDither:
PROC [gray: PixelMap]
RETURNS [bitmap: PixelMap];
Does a random-dithered version, good for the initial approximation.
FindFixedBits:
PROC [gray: PixelMap, radius:
NAT]
RETURNS [fixedBits: PixelMap];
fixedBits is 1 where the gray map is all black or all white within the given radius of a pixel.
TuneSwath:
PROC [gray: PixelMap, bitmap: PixelMap, fixedBits: PixelMap, swath: DeviceRectangle, model: Model, scratch:
REF]
RETURNS [newScratch:
REF];
swath should have a small fSize; only certain combinations of parameters are supported.
scratch and newScratch are used to pass scratch storage from call to call.
Implementor private stuff below
MakePixelMapFromBits:
PROC [
bitPointer: LONG POINTER,
bitsPerLine: NAT,
window: DeviceRectangle,
scratch: REF ImagerPixelMap.PixelMapRep
]
RETURNS [pixelMap: PixelMap]
;
RegisterImpl:
PROC [class: Class];
For maximum speed, there is a specialized implementation for each allowed combination of parameters; this is the way the different impls make themselves known to the control impl.
Class:
TYPE ~
RECORD [
sKernelRadius: NAT,
fKernelRadius: NAT,
sModelRadius: NAT,
fModelRadius: NAT,
swathSize: NAT,
CreatePrinterModel: PROC [neighborhood: DeviceRectangle, printerModel: PrinterModel, kernel: PixelMap] RETURNS [model: Model],
DoWithPrinterModel: PROC [model: Model, action: PROC[PrinterModel]],
Convolve: PROC [pixelMap: PixelMap, kernel: Kernel, unitIntensity: CARDINAL],
ApplyModel: PROC [bitmap: PixelMap, model: Model] RETURNS [PixelMap],
TuneSwath: PROC [gray: PixelMap, bitmap: PixelMap, fixedBits: PixelMap, swath: DeviceRectangle, model: Model, scratch: REF] RETURNS [newScratch: REF]
];