ColorDisplayFace.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Created by Doug Wyatt, 9-Jul-81 15:21:55
Levin, August 8, 1983 2:43 pm
Russ Atkinson (RRA) January 29, 1985 0:38:13 am PST
Doug Wyatt, May 1, 1985 4:20:29 pm PDT
Processor-independent interface to color display.
DIRECTORY
ColorDisplayDefs USING [ChannelsVisible, ChannelValue, ColorDisplayType, ColorMode, ColorValue];
ColorDisplayFace: CEDAR DEFINITIONS
~ BEGIN
ColorMode: TYPE ~ ColorDisplayDefs.ColorMode;
ColorDisplayType: TYPE ~ ColorDisplayDefs.ColorDisplayType;
ChannelValue: TYPE ~ ColorDisplayDefs.ChannelValue;
ColorValue: TYPE ~ ColorDisplayDefs.ColorValue;
ChannelsVisible: TYPE ~ ColorDisplayDefs.ChannelsVisible;
Initialization
globalStateSize: READONLY NAT; -- number of words required by Initialize
Initialize: UNSAFE PROC [globalState: LONG POINTER];
Initializes the implementation; caller must supply a block of globalStateSize words, permanently allocated in first 64K of address space.
InitializeCleanup: UNSAFE PROC;
Initializes the DeviceCleanup coroutine. Client should call this exactly once.
Display characteristics
displayType: READONLY ColorDisplayType; -- type of display, if any
width: READONLY NAT; -- display width, in pixels
height: READONLY NAT; -- display height, in pixels
pixelsPerInch: READONLY NAT; -- approximate number of pixels per inch
SetDisplayType: PROC [type: ColorDisplayType] RETURNS [ok: BOOL];
... establishes a new display type. Returns TRUE iff the operation is implemented on this machine and the specified type is recognized.
nullMode: ColorMode ~ [FALSE, 0, 0];
HasMode: PROC [mode: ColorMode] RETURNS [BOOL];
... indicates whether the given mode is supported.
NextMode: PROC [mode: ColorMode ← nullMode] RETURNS [ColorMode];
... enumerates the available modes; enumeration starts and ends with nullMode.
Color maps
ColorMap: TYPE ~ LONG POINTER TO ColorMapRep;
ColorMapRep: TYPE;
wordsForColorMap: READONLY NAT;
InitializeColorMap: UNSAFE PROC [mode: ColorMode, pointer: LONG POINTER]
RETURNS
[ColorMap];
Initializes the content of a color map. Caller supplies the intended ColorMode and the address of a block of wordsForColorMap words.
SetColor: UNSAFE PROC [map: ColorMap, pixelA, pixelB: ChannelValue, r, g, b: ColorValue];
... sets a color map entry.
GetColor: PROC [map: ColorMap, pixelA, pixelB: ChannelValue] RETURNS [r, g, b: ColorValue];
... gets a color map entry.
SetR: UNSAFE PROC [map: ColorMap, in: ChannelValue, out: ColorValue];
SetG: UNSAFE PROC [map: ColorMap, in: ChannelValue, out: ColorValue];
SetB: UNSAFE PROC [map: ColorMap, in: ChannelValue, out: ColorValue];
... sets a red, green, or blue map entry.
GetR: PROC [map: ColorMap, in: ChannelValue] RETURNS [out: ColorValue];
GetG: PROC [map: ColorMap, in: ChannelValue] RETURNS [out: ColorValue];
GetB: PROC [map: ColorMap, in: ChannelValue] RETURNS [out: ColorValue];
... gets a red, green, or blue map entry.
Display control
Connect: UNSAFE PROC[mode: ColorMode, baseA, baseB: LONG POINTER, map: ColorMap];
Connects frame buffer(s) and color map to the display hardware. Subsequent frame buffer or color map changes will affect the color image, but the image will not appear on the screen until TurnOn is called.
Disconnect: PROC;
Disconnects the display; releases all references to the memory supplied to Connect.
TurnOn: UNSAFE PROC;
Turns display on, causing an image to appear on the screen.
Caution: the connected pages must be pinned before TurnOn is called!
TurnOff: PROC;
Turns display off, causing the screen to be dark; bitmap(s) and colormap remain connected.
The connected pages may be unpinned after TurnOff returns.
SetVisibility: PROC[visibility: ChannelsVisible];
Controls which channels are visible.
END.