XAllocColorPlanes()XAllocColorPlanes()Name
XAllocColorPlanes – allocate read/write (nonshareable) color planes.
Synopsis
Status XAllocColorPlanes(display, colormap, contig, pixels_return,
npixels_return, nreds, ngreens, nblues, rmask_return,
gmask_return, bmask_return)
Display *display;
Colormap colormap;
Bool contig;
unsigned long pixels_return[npixels];
int npixels;
int nreds, ngreens, nblues;
unsigned long *rmask_return, *gmask_return, *bmask_return;
Arguments
display Specifies a connection to an X server; returned from
XOpenDisplay().
colormap Specifies the ID of the colormap to be used.
contig Specifies a boolean value. Pass True if the planes must be
contiguous or False if the planes do not need to be con‐
tiguous.
pixels_return
Returns an array of pixel values.
npixels Specifies the number of pixel values returned in the pixels
array. Must be positive.
nreds Specify the number of red, green, and blue planes (shades).
ngreens Must be nonnegative.
nblues
rmask_return
Return bit masks for the red, green, and blue planes.
gmask_return
bmask_return
Returns
Zero on failure, non-zero on success.
Description
If npixels colors, nreds reds, ngreens greens, and nblues blues are
requested, then npixels base values are returned, and the masks have
nreds, ngreens, and nblues bits set to 1 respectively. No mask will
have any bits in common with any other mask, or with any of the pix‐
els_return. Unique pixel values are generated by ORing together sub‐
sets of masks with each item in the pixels_return list (pixels_return
does not by itself contain pixel values). In doing this, note that
npixels* (2(nreds+ngreens+nblues) ) distinct pixel values are allo‐
cated.
If contig is True, then each mask will have a contiguous set of bits.
For DirectColor, each mask will lie within the corresponding pixel sub‐
field.
Note, however, that there are actually only npixels*(2nreds ) indepen‐
dent red entries, npixels*(2ngreens ) independent green entries, and
npixels*(2nblues ) independent blue entries in the colormap. This is
true even for PseudoColor. When the pixel value of a colormap entry is
changed using XStoreColors() or XStoreNamedColor(), the pixel is decom‐
posed according to rmask_return, gmask_return, and bmask_return and the
corresponding pixel subfield entries are updated.
Status is zero on failure, and non-zero on success.
For more information, see Volume One, Chapter 7, Color.
Errors
BadColor colormap is invalid.
BadValue npixels_return is not positive.
At least one of nreds, ngreens, nblues is negative.
See AlsoXBlackPixel(), XWhitePixel(), XAllocColor(), XAllocColorCells(), XAl‐
locNamedColor(), XFreeColors(), XLookupColor(), XParseColor(), XQuery‐
Color(), XQueryColors(), XStoreColor(), XStoreColors(), XStoreNamed‐
Color().
Xlib - Color Cells XAllocColorPlanes()