gdk-pixbufs.html

来自「最新gtk中文资料集」· HTML 代码 · 共 829 行 · 第 1/3 页

HTML
829
字号
<td><p><span class="term"><em class="parameter"><code>mask_return</code></em>&#160;:</span></p></td><td> Location to store a pointer to the created mask,  or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if the mask is not needed.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>alpha_threshold</code></em>&#160;:</span></p></td><td> Threshold value for opacity values.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3141417"></a><h3><a name="gdk-pixbuf-get-from-drawable"></a>gdk_pixbuf_get_from_drawable ()</h3><a class="indexterm" name="id3141431"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>*          gdk_pixbuf_get_from_drawable        (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,                                                         <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *src,                                                         <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap,                                                         int src_x,                                                         int src_y,                                                         int dest_x,                                                         int dest_y,                                                         int width,                                                         int height);</pre><p>Transfers image data from a <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> and converts it to an RGB(A)representation inside a <ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>. In other words, copiesimage data from a server-side drawable to a client-side RGB(A) buffer.This allows you to efficiently read individual pixels on the client side.</p><p>If the drawable <em class="parameter"><code>src</code></em> has no colormap (<a class="link" href="gdk-Drawing-Primitives.html#gdk-drawable-get-colormap"><code class="function">gdk_drawable_get_colormap()</code></a>returns <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>), then a suitable colormap must be specified.Typically a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> or a pixmap created by passing a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>to <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#gdk-pixmap-new"><code class="function">gdk_pixmap_new()</code></a> will already have a colormap associated withit.  If the drawable has a colormap, the <em class="parameter"><code>cmap</code></em> argument will beignored.  If the drawable is a bitmap (1 bit per pixel pixmap),then a colormap is not required; pixels with a value of 1 areassumed to be white, and pixels with a value of 0 are assumed to beblack. For taking screenshots, <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system"><code class="function">gdk_colormap_get_system()</code></a> returnsthe correct colormap to use.</p><p>If the specified destination pixbuf <em class="parameter"><code>dest</code></em> is <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>, then thisfunction will create an RGB pixbuf with 8 bits per channel and noalpha, with the same size specified by the <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em>arguments.  In this case, the <em class="parameter"><code>dest_x</code></em> and <em class="parameter"><code>dest_y</code></em> arguments must bespecified as 0.  If the specified destination pixbuf is not <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>and it contains alpha information, then the filled pixels will beset to full opacity (alpha = 255).</p><p>If the specified drawable is a pixmap, then the requested sourcerectangle must be completely contained within the pixmap, otherwisethe function will return <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>. For pixmaps only (not for windows)passing -1 for width or height is allowed to mean the full widthor height of the pixmap.</p><p>If the specified drawable is a window, and the window is off thescreen, then there is no image data in the obscured/offscreenregions to be placed in the pixbuf. The contents of portions of thepixbuf corresponding to the offscreen region are undefined.</p><p>If the window you're obtaining data from is partially obscured byother windows, then the contents of the pixbuf areas correspondingto the obscured regions are undefined.</p><p>If the target drawable is not mapped (typically because it'siconified/minimized or not on the current workspace), then <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>will be returned.</p><p>If memory can't be allocated for the return value, <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returnedinstead.</p><p>(In short, there are several ways this function can fail, and if it fails it returns <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>; so check the return value.)</p><p>This function calls <a class="link" href="gdk-Drawing-Primitives.html#gdk-drawable-get-image"><code class="function">gdk_drawable_get_image()</code></a> internally andconverts the resulting image to a <ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>, so thedocumentation for <a class="link" href="gdk-Drawing-Primitives.html#gdk-drawable-get-image"><code class="function">gdk_drawable_get_image()</code></a> may also be relevant.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>dest</code></em>&#160;:</span></p></td><td> Destination pixbuf, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if a new pixbuf should be created.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>src</code></em>&#160;:</span></p></td><td> Source drawable.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>cmap</code></em>&#160;:</span></p></td><td> A colormap if <em class="parameter"><code>src</code></em> doesn't have one set.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>src_x</code></em>&#160;:</span></p></td><td> Source X coordinate within drawable.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>src_y</code></em>&#160;:</span></p></td><td> Source Y coordinate within drawable.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>dest_x</code></em>&#160;:</span></p></td><td> Destination X coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>dest_y</code></em>&#160;:</span></p></td><td> Destination Y coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>width</code></em>&#160;:</span></p></td><td> Width in pixels of region to get.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>height</code></em>&#160;:</span></p></td><td> Height in pixels of region to get.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> The same pixbuf as <em class="parameter"><code>dest</code></em> if it was non-<ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>, or a newly-createdpixbuf with a reference count of 1 if no destination pixbuf was specified, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> on error</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3141998"></a><h3><a name="gdk-pixbuf-get-from-image"></a>gdk_pixbuf_get_from_image ()</h3><a class="indexterm" name="id3142012"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>*          gdk_pixbuf_get_from_image           (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,                                                         <a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *src,                                                         <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap,                                                         int src_x,                                                         int src_y,                                                         int dest_x,                                                         int dest_y,                                                         int width,                                                         int height);</pre><p>Same as <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-get-from-drawable"><code class="function">gdk_pixbuf_get_from_drawable()</code></a> but gets the pixbuf froman image.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>dest</code></em>&#160;:</span></p></td><td> Destination pixbuf, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if a new pixbuf should be created.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>src</code></em>&#160;:</span></p></td><td> Source <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>cmap</code></em>&#160;:</span></p></td><td> A colormap, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> to use the one for <em class="parameter"><code>src</code></em></td></tr><tr><td><p><span class="term"><em class="parameter"><code>src_x</code></em>&#160;:</span></p></td><td> Source X coordinate within drawable.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>src_y</code></em>&#160;:</span></p></td><td> Source Y coordinate within drawable.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>dest_x</code></em>&#160;:</span></p></td><td> Destination X coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>dest_y</code></em>&#160;:</span></p></td><td> Destination Y coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>width</code></em>&#160;:</span></p></td><td> Width in pixels of region to get.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>height</code></em>&#160;:</span></p></td><td> Height in pixels of region to get.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> <em class="parameter"><code>dest</code></em>, newly-created pixbuf if <em class="parameter"><code>dest</code></em> was <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>, <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> on error</td></tr></tbody></table></div></div></div><div class="refsect1" lang="en"><a name="id3142336"></a><div class="refsect2" lang="en"><a name="id3142337"></a></div><hr><div class="refsect2" lang="en"><a name="id3142338"></a></div></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?