XCopyColormapAndFree

Syntax

Colormap XCopyColormapAndFree(display, colormap)
      Display *display;
      Colormap colormap;

Arguments

display Specifies the connection to the X server.
colormap Specifies the colormap.

Description

The XCopyColormapAndFree() function creates a colormap of the same visual type and for the same screen as the specified colormap and returns the new colormap ID. It also moves all of the client's existing allocation from the specified colormap to the new colormap with their color values intact and their read-only or writable characteristics intact and frees those entries in the specified colormap. Color values in other entries in the new colormap are undefined. If the specified colormap was created by the client with alloc set to AllocAll, the new colormap is also created with AllocAll, all color values for all entries are copied from the specified colormap, and then all entries in the specified colormap are freed. If the specified colormap was not created by the client with AllocAll, the allocations to be moved are all those pixels and planes that have been allocated by the client using XAllocColor(), XAllocNamedColor(), XAllocColorCells(), or XAllocColorPlanes() and that have not been freed since they were allocated.

XCopyColormapAndFree() can generate BadAlloc and BadColor errors.

Diagnostics

BadAlloc The server failed to allocate the requested source or server memory.
BadColor A value for a Colormap argument does not name a defined Colormap.

See also

XAllocColor(), XChangeWindowAttributes(), XCreateColormap(), XCreateWindow(), XFreeColormap(), XQueryColor(), XStoreColors(), "Creating, Copying, and Destroying Colormaps".
Christophe Tronche, ch@tronche.com