ImagerColorMap.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, June 20, 1985 1:14:28 pm PDT
ImagerColorMap is the mid-level Cedar interface for maintaining the color map on the color display device. Its purpose is primarily to provide synchonization between the various clients that modify and use the color map, and to hold extra information about the color map.
DIRECTORY
Terminal USING [Virtual, ChannelValue, ColorValue];
ImagerColorMap: CEDAR DEFINITIONS
~ BEGIN OPEN Terminal;
State: TYPE ~ REF StateRep;
StateRep: TYPE ~ PRIVATE RECORD [next: State, first, count: CARDINAL];
MapEntry: TYPE ~ RECORD [mapIndex: ChannelValue, red, green, blue: ColorValue];
AnyChanges: PROC [since: State] RETURNS [BOOL]
~ INLINE {RETURN [since=NIL OR since.next#NIL]};
Setting the Standard Color Maps
SetStandardColorMap: PROC [vt: Virtual, gamma: REAL ← 2.2];
SetStandardGrayMap: PROC [vt: Virtual, gamma: REAL ← 2.2];
SetGamma: PROC [vt: Virtual, gamma: REAL];
GetGamma: PROC [vt: Virtual] RETURNS [gamma: REAL];
ApplyGamma: PROC [v: REAL, gamma: REAL] RETURNS [ColorValue];
ApplyGammaInverse: PROC [colorValue: ColorValue, gamma: REAL] RETURNS [REAL];
StandardColorMapEntries: PROC [bitsPerPixel: [1..8]] RETURNS [LIST OF MapEntry];
LoadEntries: PROC [vt: Virtual, mapEntries: LIST OF MapEntry, gamma: REAL ← 2.2, b: ChannelValue ← 0, shared: BOOLTRUE];
None of the procedures below have anything to do with gamma.
Client Color Maps
MapProc: TYPE ~ PROC [a, b: ChannelValue ← 0, red, green, blue: ColorValue, shared: BOOLTRUE];
Change: PROC [vt: Virtual, action: PROC[set: MapProc]];
Shared: PROC [vt: Virtual, a, b: ChannelValue] RETURNS [BOOL];
GetChanges: PROC [vt: Virtual, since: State ← NIL, change: MapProc] RETURNS [State];
Client Full Color Maps
FullMapProc: TYPE ~ PROC [gun: Gun, in: ChannelValue, out: ColorValue];
Gun: TYPE ~ {red, green, blue};
ChangeFull: PROC [vt: Virtual, action: PROC[set: FullMapProc]];
GetFullChanges: PROC [vt: Virtual, since: State ← NIL, change: FullMapProc] RETURNS [State];
Change Notification
NotifierRep: TYPE ~ RECORD [proc: PROC [data: REF], data: REF];
Register: PROC [colorMapChanged: NotifierRep];
colorMapChanged.proc is called whenever the color map changes.
UnRegister: PROC [colorMapChanged: NotifierRep];
END.