AdjustColor.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
This module serves primarily as an arbiter between various packages that may wish to control the hardware color map.
Last Edited by: Nickell, June 10, 1985 9:56:48 pm PDT
Eric Nickell December 19, 1985 11:54:35 am PST
DIRECTORY
ColorDisplayDefs USING [ColorValue];
AdjustColor: CEDAR DEFINITIONS = BEGIN
Color: TYPE ~ ColorDisplayDefs.ColorValue;
TRC: TYPE ~ ARRAY Color OF Color;
Gamma: TYPE ~ TRC;
redTab: READONLY TRC; --The color curves before gamma correction
grnTab: READONLY TRC;
bluTab: READONLY TRC;
AdjustColorTool: TYPE ~ REF AdjustColorToolRec;
AdjustColorToolRec: TYPE ~ RECORD [
flavor: Flavor,   --Uniquely identifies adjust color tool
byebye: ByeProc ← NIL,   --Called when control lost
private: REFNIL,   --Info client shouldn't play with directly
clientData: REFNIL   --Client's own sandbox
];
Flavor: TYPE ~ ATOM;
NoSuchFlavor: ERROR;
AlreadyExists: ERROR;
ByeProc: TYPE ~ PROC [from, to: Flavor];
RegisterAdjustColorTool: PROC [tool: AdjustColorToolRec];
!AlreadyExists => there is already a tool with the same flavor
Make known the existence of a new adjust color tool
UnRegisterAdjustColorTool: PROC [flavor: Flavor];
! NoSuchFlavor
InControl: PROC RETURNS [flavor: Flavor];
RequestControl: PROC [flavor: Flavor] RETURNS [granted: BOOLEAN];
! NoSuchFlavor
Returns FALSE only if another has locked itself in.
ClientDataForFlavor: PROC [flavor: Flavor] RETURNS [REF];
! NoSuchFlavor
AdjustColors: PROC [flavor: Flavor, red, green, blue: REF TRC] RETURNS [done: BOOL];
This procedure may be called at any time to set the color maps. Note, however, that it will have an effect ONLY if the flavor called with is the flavor in control.
NewGamma: PROC [gammaValue: REAL ← 2.2];
Reload the colormap, after resetting to the desired gamma.
END.