ImagerColorImpl.mesa
Michael Plass, August 1, 1983 11:43 am
DIRECTORY
Imager,
ImagerColor,
ImagerBasic,
Real;
ImagerColorImpl:
CEDAR PROGRAM
IMPORTS Imager, Real
EXPORTS ImagerColor
~ BEGIN
Color: TYPE ~ ImagerBasic.Color;
Card:
PROC [real:
REAL]
RETURNS [card:
CARDINAL] ~ {
int: INT ← Real.RoundLI[real*LAST[CARDINAL]];
card ← MAX[MIN[int, LAST[CARDINAL]], 0];
};
MakeGray:
PUBLIC
PROC [intensity:
REAL]
RETURNS [Color] ~ {
IF intensity <= 0 THEN RETURN [Imager.black];
IF intensity >= 1 THEN RETURN [Imager.white];
RETURN [NEW[ImagerBasic.CIEColorRep ← [x: Card[0.3101], y: Card[0.3163], Y: Card[intensity]]]];
};
END.