📄 xalloccolorplanes.html
字号:
<HTML><HEAD><TITLE>Xlib Programming Manual: XAllocColorPlanes</TITLE></HEAD><BODY><H1 ALIGN=center>XAllocColorPlanes</H1><H2>Syntax</H2><!.IN "Read/write colormap planes" "allocating"><!.IN "Allocation" "read/write colormap planes"><!.IN "Color" "allocation"><!.IN "XAllocColorPlanes" "" "@DEF@"><CODE><PRE><B><A HREF="../introduction/errors.html#Status">Status</A></B> XAllocColorPlanes(<B>display</B>, <B>colormap</B>, <B>contig</B>, <B>pixels_return</B>, <B>ncolors</B>, <B>nreds</B>, <B>ngreens</B>, <B>nblues</B>, <B>rmask_return</B>, <B>gmask_return</B>, <B>bmask_return</B>) <A HREF="../display/opening.html#Display">Display</A> *<B>display</B>; <A HREF="./#colormap">Colormap</A> <B>colormap</B>; Bool <B>contig</B>; unsigned long <B>pixels_return</B>[]; int <B>ncolors</B>; int <B>nreds</B>, <B>ngreens</B>, <B>nblues</B>; unsigned long *<B>rmask_return</B>, *<B>gmask_return</B>, *<B>bmask_return</B>;</PRE></CODE><H2>Arguments</H2><TABLE><TR><TD> <B>display</B><TD> Specifies the connection to the X server.<TR><TD> <B>colormap</B><TD> Specifies the colormap.<TR><TD> <B>contig</B><TD> Specifies a Boolean value that indicates whether the planes must be contiguous.<TR><TD> <B>pixels_return</B><TD> Returns an array of pixel values. <B>XAllocColorPlanes()</B>returns the pixel values in this array.<TR><TD> <B>ncolors</B><TD> Specifies the number of pixel values that are to be returned in the pixels_return array. <TR><TD> <B>nreds</B><BR> <B>ngreens</B><BR> <B>nblues</B><TD>Specify the number of red, green, and blue planes.The value you pass must be nonnegative. <TR><TD> <B>rmask_return</B> <B>gmask_return</B> <B>bmask_return</B><TD> Return bit masks for the red, green, and blue planes.</TABLE><H2>Description</H2>The specified ncolors must be positive; and nreds, ngreens, and nblues must be nonnegative,or a<B>BadValue</B>error results.If ncolors colors, nreds reds, ngreens greens, and nblues blues are requested, ncolors pixels are returned; and the masks have nreds, ngreens, and nblues bits set to 1, respectively.If contig is <B>True</B>, each mask will havea contiguous set of bits set to 1.No mask will have any bits set to 1 in common withany other mask or with any of the pixels.For <B><A HREF="../window/visual-types.html">DirectColor</A></B>, each maskwill lie within the corresponding pixel subfield.By ORing togethersubsets of masks with each pixel value, <I>ncolors * 2<SUP>(nreds+ngreens+nblues)</SUP></I> distinct pixel values can be produced. All of these are allocated by the request.However, in thecolormap, there are only <I>ncolors * 2<SUP>nreds</SUP></I> independent red entries, <I>ncolors * 2<SUP>ngreens</SUP></I> independent green entries, and <I>ncolors * 2<SUP> nblues</SUP></I> independent blue entries. This is true even for <B><A HREF="../window/visual-types.html">PseudoColor</A></B>.When the colormap entry of a pixelvalue is changed (using <B><A HREF="XStoreColors.html">XStoreColors()</A></B>,<B><A HREF="XStoreColor.html">XStoreColor()</A></B>,or <B><A HREF="XStoreNamedColor.html">XStoreNamedColor()</A></B>),the pixel is decomposed according to the masks, and the corresponding independent entries are updated.<B>XAllocColorPlanes()</B>returns nonzero if it succeeded or zero if it failed.<P><B>XAllocColorPlanes()</B>can generate<B>BadColor</B>and<B>BadValue</B> errors.<H2>Diagnostics</H2><TABLE><TR><TD><B>BadColor</B><TD> A value for a Colormap argument does not name a defined Colormap.<TR><TD><B>BadValue</B><TD> Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.</TABLE><H2>See also</H2><B><A HREF="XAllocColor.html">XAllocColor()</A></B>,<B><A HREF="XAllocColorCells.html">XAllocColorCells()</A></B>,<B><A HREF="XAllocNamedColor.html">XAllocNamedColor()</A></B>,<B><A HREF="XCreateColormap.html">XCreateColormap()</A></B>,<B><A HREF="XFreeColors.html">XFreeColors()</A></B>,<B><A HREF="XQueryColor.html">XQueryColor()</A></B>,<B><A HREF="XStoreColors.html">XStoreColors()</A></B>,"<A HREF="cell.html">Allocating and Freeing Color Cells</A>".<HR><ADDRESS><A HREF="http://tronche.com/">Christophe Tronche</A>, <A HREF="mailto:ch.tronche@computer.org">ch.tronche@computer.org</A></ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -