Status XcmsAllocColor(display, colormap, color_in_out, result_format)
      Display *display;
      Colormap colormap;
      XcmsColor *color_in_out;
      XcmsColorFormat result_format;


display Specifies the connection to the X server.
colormap Specifies the colormap.
color_in_out Specifies the color to allocate and returns the pixel and color that is actually used in the colormap.
result_format Specifies the color format for the returned color specification.


The XcmsAllocColor() function is similar to XAllocColor() except the color can be specified in any format. The XcmsAllocColor() function ultimately calls XAllocColor() to allocate a read-only color cell (colormap entry) with the specified color. XcmsAllocColor() first converts the color specified to an RGB value and then passes this to XAllocColor(). XcmsAllocColor() returns the pixel value of the color cell and the color specification actually allocated. This returned color specification is the result of converting the RGB value returned by XAllocColor() into the format specified with the result_format argument. If there is no interest in a returned color specification, unnecessary computation can be bypassed if result_format is set to XcmsRGBFormat. The corresponding colormap cell is read-only. If this routine returns XcmsFailure, the color_in_out color specification is left unchanged.

XcmsAllocColor() can generate a BadColor error.


BadColor A value for a Colormap argument does not name a defined Colormap.

See also

XcmsAllocNamedColor(), XcmsQueryColor(), XcmsStoreColor(), "Allocating and Freeing Color Cells".
Christophe Tronche, [email protected]