XlColorAccess.mesa
Copyright Ó 1990, 1991, 1993 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, December 5, 1990 4:53:47 pm PST
Christian Jacobi, August 16, 1993 12:09 pm PDT
DIRECTORY Xl;
XlColorAccess: CEDAR DEFINITIONS ~ BEGIN
Package which supports usage of ImagerColorMap entries with X windows.
ColorData: TYPE = REF READONLY ColorDataRec;
ColorDataRec: TYPE = RECORD [
hasColors: BOOL ¬ FALSE,
hasPrivateColormap: BOOL ¬ FALSE, --otherwise colormap simply copied from screen
colormap: Xl.ColorMap,
pseudoBlackPixel, pseudoWhitePixel: Xl.Pixel, --might have indices better suited for inverting then screen defaults
entries: REF ¬ NIL, --good for XlBitmap.SetColormap. Actually ImagerColorMap.MapEntries, but we avoid module import dependency.
reservedForImpl: PRIVATE REF ANY ¬ NIL
];
Access: PROC [screen: Xl.Screen, depth: BYTE, class: Xl.VisualClass] RETURNS [ColorData];
Computes, allocates or fetches colors for a particular screen and visual.
Tries first to use standard colormap, on failure creates private colormap.
Returned ColorData is NOT NIL if a VisualType exists
Internally used utilities maybe usefull externally too.
RealColorValToXColorVal: PROC [r: REAL, invGamma: REAL ¬ 0.4545454] RETURNS [Xl.RGBVal];
Computes X-ish color index from range [0..1)
FindVisualType: PROC [screen: Xl.Screen, depth: BYTE, class: Xl.VisualClass] RETURNS [Xl.VisualType];
Finds visual type for a screen, bits per pixel value and class
Returns NIL in case of none found
END.