ImagerDitherContextImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, August 5, 1985 10:07:59 am PDT
DIRECTORY
Imager USING [Context],
ImagerColorDefs USING [ColorRep, ConstantColor],
ImagerDitherContext USING [MapEntries, SpecialPixel],
ImagerDitheredDevicePrivate USING [Data],
ImagerRasterPrivate USING [Data];
ImagerDitherContextImpl: CEDAR PROGRAM
EXPORTS ImagerDitherContext
~
BEGIN
OPEN ImagerDitherContext;
ConstantColor:
TYPE ~ ImagerColorDefs.ConstantColor;
SetDitherMap:
PUBLIC
PROC [context: Imager.Context, mapEntries: MapEntries] ~ {
WITH context.data
SELECT
FROM
rasterData: ImagerRasterPrivate.Data => {
WITH rasterData.device.data
SELECT
FROM
data: ImagerDitheredDevicePrivate.Data => {
data.mapEntries ← mapEntries;
};
ENDCASE => NULL;
};
ENDCASE => NULL;
};
DoWithDitherMap:
PUBLIC
PROC [context: Imager.Context, mapEntries: MapEntries, action:
PROC] ~ {
WITH context.data
SELECT
FROM
rasterData: ImagerRasterPrivate.Data => {
WITH rasterData.device.data
SELECT
FROM
data: ImagerDitheredDevicePrivate.Data => {
old: MapEntries ← data.mapEntries;
data.mapEntries ← mapEntries;
action[ ! UNWIND => data.mapEntries ← old];
data.mapEntries ← old;
RETURN;
};
ENDCASE => NULL;
};
ENDCASE => NULL;
action[];
};
MakeSpecialColor:
PUBLIC
PROC [ordinaryColor: ConstantColor, specialPixel: SpecialPixel]
RETURNS [special: ConstantColor] ~ {
special ← NEW[ImagerColorDefs.ColorRep.constant ← ordinaryColor^];
special.data ← NEW[SpecialPixel←specialPixel];
};
END.