Query: xgetrgbcolormaps
OS: hpux
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
XGetRGBColormaps() XGetRGBColormaps()
Name
XGetRGBColormaps - obtain the XStandardColormap structure associated with the specified property.
Synopsis
Status XGetRGBColormaps(display, w, std_colormap_return, count_return, property)
Display *display;
Window w;
XStandardColormap **std_colormap_return;
int *count_return;
Atom property;
Arguments
display Specifies a connection to an X server; returned from XOpenDisplay().
w Specifies the window.
std_colormap_return
Returns the XStandardColormap structure.
count_return
Returns the number of colormaps.
property Specifies the property name.
Returns
Zero on failure, non-zero on success.
Availability
Release 4 and later.
Description
XGetRGBColormaps() returns the RGB colormap definitions stored in the specified property on the named window. If the property exists, is
of type RGB_COLOR_MAP, is of format 32, and is long enough to contain a colormap definition, XGetRGBColormaps() allocates and fills in
space for the returned colormaps, and returns a non-zero status. Otherwise, none of the fields are set, and XGetRGBColormaps() returns a
zero status. If the visualid field is not present, XGetRGBColormaps() assumes the default visual for the screen on which the window is
located; if the killid field is not present, it is assumed to have a value of None, which indicates that the resources cannot be released.
Note that it is the caller's responsibility to honor the ICCCM restriction that only RGB_DEFAULT_MAP contain more than one definition.
XGetRGBColormaps() does not install the colormaps into the hardware colormap, it does not allocate entries, and it does not even create
virtual colormaps. It just provides information about designs of colormap and the IDs of the colormaps if some other client has already
created them. The application can otherwise attempt to create a virtual colormap of the appropriate type, and allocate its entries accord-
ing to the information in the XStandardColormap structure. Installing the colormap must then be done with XInstallColormap(), in coopera-
tion with the window manager. Any of these steps could fail, and the application should be prepared.
If the server or another client has already created a standard colormap of this type, then its ID will be returned in the colormap member
of the XStandardColormap structure. Some servers and window managers, particular on high-performance workstations, will create some or all
of the standard colormaps so they can be quickly installed when needed by applications.
An application should go through the standard colormap creation process only if it needs the special qualities of the standard colormaps
and if another client has not already created them. For one, they allow the application to convert RGB values into pixel values quickly
because the mapping is predictable. Given an XStandardColormap structure for an XA_RGB_BEST_MAP colormap, and floating point RGB coeffi-
cients in the range 0.0 to 1.0, you can compose pixel values with the following C expression:
pixel = base_pixel
+ ((unsigned long) (0.5 + r * red_max)) * red_mult
+ ((unsigned long) (0.5 + g * green_max)) * green_mult
+ ((unsigned long) (0.5 + b * blue_max)) * blue_mult;
The use of addition rather than logical-OR for composing pixel values permits allocations where the RGB value is not aligned to bit bound-
aries.
XGetRGBColormaps() supersedes XGetStandardColormap().
For more information, see Volume One, Chapter 7, Color.
Structures
typedef struct {
Colormap colormap;
unsigned long red_max;
unsigned long red_mult;
unsigned long green_max;
unsigned long green_mult;
unsigned long blue_max;
unsigned long blue_mult;
unsigned long base_pixel;
VisualID visualid; /* added by ICCCM version 1 */
XID killid; /* added by ICCCM version 1 */
} XStandardColormap;
Errors
BadAtom
BadWindow
See Also
XAllocStandardColormap(), XSetRGBColormaps().
Xlib - Window Manager Hints XGetRGBColormaps()