7.4 Allocating Shared Colors
Since free colorcells can quickly become a scarce resource when clients store private color values, simple clients that mainly use color for decoration are encouraged always to allocate read-only colors, so that these colorcells can be shared by other clients that allocate the same colors read-only.
The returned pixel value can be used to set the
attribute of a window or to set the
background member of a GC, which are used by drawing
requests. (See Chapter 4 and Chapter 5, The for more information.)
Read-only colorcells can be allocated with the following routines:
Returns the index of the colorcell (a pixel value) that contains the RGB values that are requested or that contains the closest RGB values physically possible on the screen.
XcmsAllocColor()is the same except that colors are specified using Xcms syntax.
Returns the index of the colorcell that contains the RGB values associated with a specified color name from the string color name database or the closest RGB values physically possible on the screen. In R5,
XAllocNamedColor()accepts strings in Xcms syntax.
XcmsAllocNamedColor()is almost the same except with a different style of arguments.
XcmsAllocNamedColor()also is capable of returning a symbol describing the format found in the specified string.
By convention, clients allow the user to specify colors on the command line or in the resource database using a color ...