PEXMakeColormap - Create a Colormap and Initialize it for PEX Color Approximation


Synopsis

 
   int PEXMakeColormap(
        Display *display,
        XVisualInfo *vis_info,
        PEXColorApproxEntry *capx_info
        Colormap *colormap_id_return
   )
 

Arguments

display
A pointer to a display structure returned by a successful XOpenDisplay call.

vis_info
A pointer to a valid XVisualInfo structure that describes the Visual with which the Colormap will be created.

capx_info
A pointer to a valid PEXColorApproxEntry structure, that describes the color approximation setup for which the Colormap is to be initialized.

colormap_id_return
A pointer to a Colormap identifier. This function returns the resource ID of the created Colormap at this location.

Returns

Zero if successful; otherwise, one of the following return values:

PEXBadLocalAlloc
Indicates that this function ran out of memory.

Description

Invoke PEXMakeColormap to create an X Colormap with the Visual described by vis_info. It uses the provided PEX color approximation table entry (in capx_info) as a guide in initializing the Colormap contents.

This function modifies only the cells in the region of the Colormap described by the color approximation entry from their default values. The function initializes these cells with read-only permission to improve the chances of sharing colors.

If successful, this function returns the new Colormap ID in colormap_id_return. The function does not create or alter any X server properties.

If you specify a color approximation entry of type PEXColorRange, the function initializes the colormap to contain a gray ramp.

Errors

See function return values, also:

BadAlloc
The implementation failed to allocate the requested resource.

BadValue

See Also

For an overview, see PEXlib Access and Information Functions.