XAllocColor

Syntax

Status XAllocColor(display, colormap, screen_in_out)
      Display *display;
      Colormap colormap;
      XColor *screen_in_out;

Arguments

display Specifies the connection to the X server.
colormap Specifies the colormap.
screen_in_out Specifies and returns the values actually used in the colormap.

Description

The XAllocColor() function allocates a read-only colormap entry corresponding to the closest RGB value supported by the hardware. XAllocColor() returns the pixel value of the color closest to the specified RGB elements supported by the hardware and returns the RGB value actually used. The corresponding colormap cell is read-only. In addition, XAllocColor() returns nonzero if it succeeded or zero if it failed. Multiple clients that request the same effective RGB value can be assigned the same read-only entry, thus allowing entries to be shared. When the last client deallocates a shared cell, it is deallocated. XAllocColor() does not use or affect the flags in the XColor structure.

XAllocColor() can generate a BadColor error.

Diagnostics

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

See also

XAllocColorCells(), XAllocColorPlanes(), XAllocNamedColor(), XCreateColormap(), XFreeColors(), XQueryColor(), XStoreColors(), "Allocating and Freeing Color Cells".
Christophe Tronche, ch@tronche.com