|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21585/root/usr/share/gtk-doc/html/gdk/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Pixbufs</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GDK Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk-Images.html" title="Images">
<link rel="next" href="gdk-Colormaps-and-Colors.html" title="Colormaps and Colors">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="reference.html" title="API Reference">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Images.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK Reference Manual</th>
<td><a accesskey="n" href="gdk-Colormaps-and-Colors.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2981019" class="shortcut">Top</a>
 | 
<a href="#id2981592" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-Pixbufs"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2981019"></a><span class="refentrytitle">Pixbufs</span>
</h2>
<p>Pixbufs — Functions for rendering pixbufs on drawables</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gdk/gdk.h>
void <a href="gdk-Pixbufs.html#gdk-pixbuf-render-threshold-alpha">gdk_pixbuf_render_threshold_alpha</a>
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> *bitmap,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
int alpha_threshold);
void <a href="gdk-Pixbufs.html#gdk-pixbuf-render-to-drawable">gdk_pixbuf_render_to_drawable</a> (<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dither,
int x_dither,
int y_dither);
void <a href="gdk-Pixbufs.html#gdk-pixbuf-render-to-drawable-alpha">gdk_pixbuf_render_to_drawable_alpha</a>
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbufAlphaMode"
>GdkPixbufAlphaMode</a> alpha_mode,
int alpha_threshold,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dither,
int x_dither,
int y_dither);
void <a href="gdk-Pixbufs.html#gdk-pixbuf-render-pixmap-and-mask">gdk_pixbuf_render_pixmap_and_mask</a>
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> **pixmap_return,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> **mask_return,
int alpha_threshold);
void <a href="gdk-Pixbufs.html#gdk-pixbuf-render-pixmap-and-mask-for-colormap">gdk_pixbuf_render_pixmap_and_mask_for_colormap</a>
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> **pixmap_return,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> **mask_return,
int alpha_threshold);
<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a>* <a href="gdk-Pixbufs.html#gdk-pixbuf-get-from-drawable">gdk_pixbuf_get_from_drawable</a> (<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *dest,
<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *src,
<a 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);
<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a>* <a href="gdk-Pixbufs.html#gdk-pixbuf-get-from-image">gdk_pixbuf_get_from_image</a> (<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *dest,
<a href="gdk-Images.html#GdkImage">GdkImage</a> *src,
<a 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>
</div>
<div class="refsect1" lang="en">
<a name="id2981592"></a><h2>Description</h2>
<p>
These functions allow to render pixbufs on drawables. Pixbufs are
client-side images. For details on how to create and manipulate
pixbufs, see the <a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a> API documentation.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2981617"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2981627"></a><h3>
<a name="gdk-pixbuf-render-threshold-alpha"></a>gdk_pixbuf_render_threshold_alpha ()</h3>
<a class="indexterm" name="id2981642"></a><pre class="programlisting">void gdk_pixbuf_render_threshold_alpha
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> *bitmap,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
int alpha_threshold);</pre>
<p>
Takes the opacity values in a rectangular portion of a pixbuf and thresholds
them to produce a bi-level alpha mask that can be used as a clipping mask for
a drawable.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>bitmap</code></em> :</span></td>
<td> Bitmap where the bilevel mask will be painted to.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_x</code></em> :</span></td>
<td> Source X coordinate.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_y</code></em> :</span></td>
<td> source Y coordinate.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> Destination X coordinate.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> Destination Y coordinate.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> Width of region to threshold, or -1 to use pixbuf width
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> Height of region to threshold, or -1 to use pixbuf height
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></td>
<td> Opacity values below this will be painted as zero; all
other values will be painted as one.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2981868"></a><h3>
<a name="gdk-pixbuf-render-to-drawable"></a>gdk_pixbuf_render_to_drawable ()</h3>
<a class="indexterm" name="id2981885"></a><pre class="programlisting">void gdk_pixbuf_render_to_drawable (<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dither,
int x_dither,
int y_dither);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_pixbuf_render_to_drawable</code> has been deprecated since version 2.4 and should not be used in newly-written code. This function is obsolete. Use <a href="gdk-Drawing-Primitives.html#gdk-draw-pixbuf"><code class="function">gdk_draw_pixbuf()</code></a> instead.</p>
</div>
<p>
Renders a rectangular portion of a pixbuf to a drawable while using the
specified GC. This is done using GdkRGB, so the specified drawable must have
the GdkRGB visual and colormap. Note that this function will ignore the
opacity information for images with an alpha channel; the GC must already
have the clipping mask set if you want transparent regions to show through.
</p>
<p>
For an explanation of dither offsets, see the GdkRGB documentation. In
brief, the dither offset is important when re-rendering partial regions of an
image to a rendered version of the full image, or for when the offsets to a
base position change, as in scrolling. The dither matrix has to be shifted
for consistent visual results. If you do not have any of these cases, the
dither offsets can be both zero.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td> Destination drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td> GC used for rendering.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_x</code></em> :</span></td>
<td> Source X coordinate within pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_y</code></em> :</span></td>
<td> Source Y coordinate within pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> Destination X coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> Destination Y coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> Width of region to render, in pixels, or -1 to use pixbuf width
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> Height of region to render, in pixels, or -1 to use pixbuf height
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dither</code></em> :</span></td>
<td> Dithering mode for GdkRGB.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x_dither</code></em> :</span></td>
<td> X offset for dither.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y_dither</code></em> :</span></td>
<td> Y offset for dither.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2982219"></a><h3>
<a name="gdk-pixbuf-render-to-drawable-alpha"></a>gdk_pixbuf_render_to_drawable_alpha ()</h3>
<a class="indexterm" name="id2982237"></a><pre class="programlisting">void gdk_pixbuf_render_to_drawable_alpha
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbufAlphaMode"
>GdkPixbufAlphaMode</a> alpha_mode,
int alpha_threshold,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dither,
int x_dither,
int y_dither);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_pixbuf_render_to_drawable_alpha</code> has been deprecated since version 2.4 and should not be used in newly-written code. This function is obsolete. Use <a href="gdk-Drawing-Primitives.html#gdk-draw-pixbuf"><code class="function">gdk_draw_pixbuf()</code></a> instead.</p>
</div>
<p>
Renders a rectangular portion of a pixbuf to a drawable. The destination
drawable must have a colormap. All windows have a colormap, however, pixmaps
only have colormap by default if they were created with a non-<a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> window argument.
Otherwise a colormap must be set on them with gdk_drawable_set_colormap.
</p>
<p>
On older X servers, rendering pixbufs with an alpha channel involves round trips
to the X server, and may be somewhat slow.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td> Destination drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_x</code></em> :</span></td>
<td> Source X coordinate within pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_y</code></em> :</span></td>
<td> Source Y coordinates within pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> Destination X coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> Destination Y coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> Width of region to render, in pixels, or -1 to use pixbuf width.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> Height of region to render, in pixels, or -1 to use pixbuf height.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha_mode</code></em> :</span></td>
<td> Ignored. Present for backwards compatibility.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></td>
<td> Ignored. Present for backwards compatibility
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dither</code></em> :</span></td>
<td> Dithering mode for GdkRGB.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x_dither</code></em> :</span></td>
<td> X offset for dither.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y_dither</code></em> :</span></td>
<td> Y offset for dither.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2982592"></a><h3>
<a name="gdk-pixbuf-render-pixmap-and-mask"></a>gdk_pixbuf_render_pixmap_and_mask ()</h3>
<a class="indexterm" name="id2982606"></a><pre class="programlisting">void gdk_pixbuf_render_pixmap_and_mask
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> **pixmap_return,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> **mask_return,
int alpha_threshold);</pre>
<p>
Creates a pixmap and a mask bitmap which are returned in the <em class="parameter"><code>pixmap_return</code></em>
and <em class="parameter"><code>mask_return</code></em> arguments, respectively, and renders a pixbuf and its
corresponding thresholded alpha mask to them. This is merely a convenience
function; applications that need to render pixbufs with dither offsets or to
given drawables should use <a href="gdk-Drawing-Primitives.html#gdk-draw-pixbuf"><code class="function">gdk_draw_pixbuf()</code></a> and <a href="gdk-Pixbufs.html#gdk-pixbuf-render-threshold-alpha"><code class="function">gdk_pixbuf_render_threshold_alpha()</code></a>.
</p>
<p>
The pixmap that is created is created for the colormap returned
by <a href="gdk-GdkRGB.html#gdk-rgb-get-colormap"><code class="function">gdk_rgb_get_colormap()</code></a>. You normally will want to instead use
the actual colormap for a widget, and use
<a href="gdk-Pixbufs.html#gdk-pixbuf-render-pixmap-and-mask-for-colormap"><code class="function">gdk_pixbuf_render_pixmap_and_mask_for_colormap()</code></a>.
</p>
<p>
If the pixbuf does not have an alpha channel, then *<em class="parameter"><code>mask_return</code></em> will be set
to <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixmap_return</code></em> :</span></td>
<td> Location to store a pointer to the created pixmap,
or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if the pixmap is not needed.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mask_return</code></em> :</span></td>
<td> Location to store a pointer to the created mask,
or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if the mask is not needed.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></td>
<td> Threshold value for opacity values.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2982832"></a><h3>
<a name="gdk-pixbuf-render-pixmap-and-mask-for-colormap"></a>gdk_pixbuf_render_pixmap_and_mask_for_colormap ()</h3>
<a class="indexterm" name="id2982847"></a><pre class="programlisting">void gdk_pixbuf_render_pixmap_and_mask_for_colormap
(<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> **pixmap_return,
<a href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> **mask_return,
int alpha_threshold);</pre>
<p>
Creates a pixmap and a mask bitmap which are returned in the <em class="parameter"><code>pixmap_return</code></em>
and <em class="parameter"><code>mask_return</code></em> arguments, respectively, and renders a pixbuf and its
corresponding tresholded alpha mask to them. This is merely a convenience
function; applications that need to render pixbufs with dither offsets or to
given drawables should use <a href="gdk-Drawing-Primitives.html#gdk-draw-pixbuf"><code class="function">gdk_draw_pixbuf()</code></a>, and <a href="gdk-Pixbufs.html#gdk-pixbuf-render-threshold-alpha"><code class="function">gdk_pixbuf_render_threshold_alpha()</code></a>.
</p>
<p>
The pixmap that is created uses the <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a> specified by <em class="parameter"><code>colormap</code></em>.
This colormap must match the colormap of the window where the pixmap
will eventually be used or an error will result.
</p>
<p>
If the pixbuf does not have an alpha channel, then *<em class="parameter"><code>mask_return</code></em> will be set
to <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> A <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixmap_return</code></em> :</span></td>
<td> Location to store a pointer to the created pixmap,
or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if the pixmap is not needed.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mask_return</code></em> :</span></td>
<td> Location to store a pointer to the created mask,
or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if the mask is not needed.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></td>
<td> Threshold value for opacity values.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2983094"></a><h3>
<a name="gdk-pixbuf-get-from-drawable"></a>gdk_pixbuf_get_from_drawable ()</h3>
<a class="indexterm" name="id2983108"></a><pre class="programlisting"><a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a>* gdk_pixbuf_get_from_drawable (<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *dest,
<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *src,
<a 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 href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> and converts it to an RGB(A)
representation inside a <a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a>. In other words, copies
image 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 href="gdk-Drawing-Primitives.html#gdk-drawable-get-colormap"><code class="function">gdk_drawable_get_colormap()</code></a>
returns <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>), then a suitable colormap must be specified.
Typically a <a href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> or a pixmap created by passing a <a href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>
to <a href="gdk-Bitmaps-and-Pixmaps.html#gdk-pixmap-new"><code class="function">gdk_pixmap_new()</code></a> will already have a colormap associated with
it. If the drawable has a colormap, the <em class="parameter"><code>cmap</code></em> argument will be
ignored. If the drawable is a bitmap (1 bit per pixel pixmap),
then a colormap is not required; pixels with a value of 1 are
assumed to be white, and pixels with a value of 0 are assumed to be
black. For taking screenshots, <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system"><code class="function">gdk_colormap_get_system()</code></a> returns
the correct colormap to use.
</p>
<p>
If the specified destination pixbuf <em class="parameter"><code>dest</code></em> is <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>, then this
function will create an RGB pixbuf with 8 bits per channel and no
alpha, 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 be
specified as 0. If the specified destination pixbuf is not <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
and it contains alpha information, then the filled pixels will be
set to full opacity (alpha = 255).
</p>
<p>
If the specified drawable is a pixmap, then the requested source
rectangle must be completely contained within the pixmap, otherwise
the function will return <a
href="../glib/glib-Standard-Macros.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 width
or height of the pixmap.
</p>
<p>
If the specified drawable is a window, and the window is off the
screen, then there is no image data in the obscured/offscreen
regions to be placed in the pixbuf. The contents of portions of the
pixbuf corresponding to the offscreen region are undefined.
</p>
<p>
If the window you're obtaining data from is partially obscured by
other windows, then the contents of the pixbuf areas corresponding
to the obscured regions are undefined.
</p>
<p>
If the target drawable is not mapped (typically because it's
iconified/minimized or not on the current workspace), then <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
will be returned.
</p>
<p>
If memory can't be allocated for the return value, <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> will be returned
instead.
</p>
<p>
(In short, there are several ways this function can fail, and if it fails
it returns <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>; so check the return value.)
</p>
<p>
This function calls <a href="gdk-Drawing-Primitives.html#gdk-drawable-get-image"><code class="function">gdk_drawable_get_image()</code></a> internally and
converts the resulting image to a <a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a>, so the
documentation for <a 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>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td> Destination pixbuf, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if a new pixbuf should be created.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> Source drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cmap</code></em> :</span></td>
<td> A colormap if <em class="parameter"><code>src</code></em> doesn't have one set.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_x</code></em> :</span></td>
<td> Source X coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_y</code></em> :</span></td>
<td> Source Y coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> Destination X coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> Destination Y coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> Width in pixels of region to get.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> Height in pixels of region to get.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The same pixbuf as <em class="parameter"><code>dest</code></em> if it was non-<a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>, or a newly-created
pixbuf with a reference count of 1 if no destination pixbuf was specified, or <a
href="../glib/glib-Standard-Macros.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="id2983673"></a><h3>
<a name="gdk-pixbuf-get-from-image"></a>gdk_pixbuf_get_from_image ()</h3>
<a class="indexterm" name="id2983687"></a><pre class="programlisting"><a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a>* gdk_pixbuf_get_from_image (<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *dest,
<a href="gdk-Images.html#GdkImage">GdkImage</a> *src,
<a 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 href="gdk-Pixbufs.html#gdk-pixbuf-get-from-drawable"><code class="function">gdk_pixbuf_get_from_drawable()</code></a> but gets the pixbuf from
an image.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td> Destination pixbuf, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if a new pixbuf should be created.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> Source <a href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cmap</code></em> :</span></td>
<td> A colormap, or <a
href="../glib/glib-Standard-Macros.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>
<span class="term"><em class="parameter"><code>src_x</code></em> :</span></td>
<td> Source X coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src_y</code></em> :</span></td>
<td> Source Y coordinate within drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> Destination X coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> Destination Y coordinate in pixbuf, or 0 if <em class="parameter"><code>dest</code></em> is NULL.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> Width in pixels of region to get.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> Height in pixels of region to get.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <em class="parameter"><code>dest</code></em>, newly-created pixbuf if <em class="parameter"><code>dest</code></em> was <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>, <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> on error
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>