Next Prev Up

9.3.1 Creating Colormaps

CLX provides functions for creating and freeing new colormap objects.

create-colormap visual window &optional alloc-p Function
A visual type ID.
A window.
Specifies whether colormap cells are permanently allocated read-write.

Creates and returns a colormap of the specified visual type for the screen containing the window. The visual type must be one of those supported by the screen.

Initial color cell values are undefined for visual types belonging to the :gray-scale, :pseudo-color, and :direct-color classes. Color cell values for visual types belonging to the :static-gray, :static-color , and :true-color classes have initial values defined by the visual type. However, X does not define the set of possible visual types or their initial color cell values.

If alloc-p is true, all colormap cells are permanently allocated read-write and cannot be freed by free-colors . It is an error for alloc-p to be true when the visual type belongs to the :static-gray, :static-color , or :true-color classes.

Type colormap .

copy-colormap-and-free colormap Function
A colormap.

Creates and returns a new colormap by copying, then freeing, allocated cells from the specified colormap.

All color cells allocated read-only or read-write in the original colormap have the same color values and the same allocation status in the new-colormap. The values of unallocated color cells in the new-colormap are undefined. After copying, all allocated color cells in the original colormap are freed, as if free-colors was called. The unallocated cells of the original colormap are not affected.

If alloc-p was true when the original colormap was created, then all color cells of the new-colormap are permanently allocated read-write, and all the color cells of the original colormap are freed.

Type colormap .

free-colormap colormap Function
A colormap.

Destroys the colormap and frees its server resource. If the colormap is installed, it is uninstalled. For any window associated with the colormap, the window is assigned a nil colormap, and a :colormap-notify event is generated. The colors displayed for a window with a nil colormap are undefined.

However, this function has no effect if the colormap is a screen default colormap.

Next Prev Up
© 1988, 1989 Texas Instruments Incorporated
Conversion to HTML made by Gilbert Baumann.
Last build: Tue Dec 16 23:30:42 1997