ImagerDitherContextImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, August 5, 1985 10:07:59 am PDT
DIRECTORY
II USING [Context],
IIColorDefs USING [ColorRep, ConstantColor],
IIDitherContext USING [MapEntries, SpecialPixel],
IIDitheredDevicePrivate USING [Data],
IIRasterPrivate USING [Data];
IIDitherContextImpl: CEDAR PROGRAM
EXPORTS IIDitherContext
~ BEGIN OPEN IIDitherContext;
ConstantColor: TYPE ~ IIColorDefs.ConstantColor;
SetDitherMap: PUBLIC PROC [context: II.Context, mapEntries: MapEntries] ~ {
WITH context.data SELECT FROM
rasterData: IIRasterPrivate.Data => {
WITH rasterData.device.data SELECT FROM
data: IIDitheredDevicePrivate.Data => {
data.mapEntries ← mapEntries;
};
ENDCASE => NULL;
};
ENDCASE => NULL;
};
DoWithDitherMap: PUBLIC PROC [context: II.Context, mapEntries: MapEntries, action: PROC] ~ {
WITH context.data SELECT FROM
rasterData: IIRasterPrivate.Data => {
WITH rasterData.device.data SELECT FROM
data: IIDitheredDevicePrivate.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[IIColorDefs.ColorRep.constant ← ordinaryColor^];
special.data ← NEW[SpecialPixel←specialPixel];
};
END.