<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="gdk-Pixbufs">
<refmeta>
<refentrytitle role="top_of_page" id="gdk-Pixbufs.top_of_page">Pixbufs</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Pixbufs</refname>
<refpurpose>Functions for rendering pixbufs on drawables</refpurpose>
</refnamediv>

<refsynopsisdiv id="gdk-Pixbufs.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gdk/gdk.h&gt;

<link linkend="void">void</link>                <link linkend="gdk-pixbuf-render-threshold-alpha">gdk_pixbuf_render_threshold_alpha</link>   (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkBitmap">GdkBitmap</link> *bitmap,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height,
                                                         <link linkend="int">int</link> alpha_threshold);
<link linkend="void">void</link>                <link linkend="gdk-pixbuf-render-to-drawable">gdk_pixbuf_render_to_drawable</link>       (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkDrawable">GdkDrawable</link> *drawable,
                                                         <link linkend="GdkGC">GdkGC</link> *gc,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height,
                                                         <link linkend="GdkRgbDither">GdkRgbDither</link> dither,
                                                         <link linkend="int">int</link> x_dither,
                                                         <link linkend="int">int</link> y_dither);
<link linkend="void">void</link>                <link linkend="gdk-pixbuf-render-to-drawable-alpha">gdk_pixbuf_render_to_drawable_alpha</link> (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkDrawable">GdkDrawable</link> *drawable,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height,
                                                         <link linkend="GdkPixbufAlphaMode">GdkPixbufAlphaMode</link> alpha_mode,
                                                         <link linkend="int">int</link> alpha_threshold,
                                                         <link linkend="GdkRgbDither">GdkRgbDither</link> dither,
                                                         <link linkend="int">int</link> x_dither,
                                                         <link linkend="int">int</link> y_dither);
<link linkend="void">void</link>                <link linkend="gdk-pixbuf-render-pixmap-and-mask">gdk_pixbuf_render_pixmap_and_mask</link>   (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkPixmap">GdkPixmap</link> **pixmap_return,
                                                         <link linkend="GdkBitmap">GdkBitmap</link> **mask_return,
                                                         <link linkend="int">int</link> alpha_threshold);
<link linkend="void">void</link>                <link linkend="gdk-pixbuf-render-pixmap-and-mask-for-colormap">gdk_pixbuf_render_pixmap_and_mask_for_colormap</link>
                                                        (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkColormap">GdkColormap</link> *colormap,
                                                         <link linkend="GdkPixmap">GdkPixmap</link> **pixmap_return,
                                                         <link linkend="GdkBitmap">GdkBitmap</link> **mask_return,
                                                         <link linkend="int">int</link> alpha_threshold);
<link linkend="GdkPixbuf">GdkPixbuf</link> *         <link linkend="gdk-pixbuf-get-from-drawable">gdk_pixbuf_get_from_drawable</link>        (<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
                                                         <link linkend="GdkDrawable">GdkDrawable</link> *src,
                                                         <link linkend="GdkColormap">GdkColormap</link> *cmap,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);
<link linkend="GdkPixbuf">GdkPixbuf</link> *         <link linkend="gdk-pixbuf-get-from-image">gdk_pixbuf_get_from_image</link>           (<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
                                                         <link linkend="GdkImage">GdkImage</link> *src,
                                                         <link linkend="GdkColormap">GdkColormap</link> *cmap,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);
</synopsis>
</refsynopsisdiv>









<refsect1 id="gdk-Pixbufs.description" role="desc">
<title role="desc.title">Description</title>
<para>
These functions allow to render pixbufs on drawables. Pixbufs are
client-side images. For details on how to create and manipulate
pixbufs, see the <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link> API documentation.
</para>
</refsect1>

<refsect1 id="gdk-Pixbufs.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="gdk-pixbuf-render-threshold-alpha" role="function">
<title>gdk_pixbuf_render_threshold_alpha ()</title>
<indexterm zone="gdk-pixbuf-render-threshold-alpha"><primary sortas="pixbuf_render_threshold_alpha">gdk_pixbuf_render_threshold_alpha</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_pixbuf_render_threshold_alpha   (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkBitmap">GdkBitmap</link> *bitmap,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height,
                                                         <link linkend="int">int</link> alpha_threshold);</programlisting>
<para>
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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>pixbuf</parameter>&#160;:</term>
<listitem><simpara> A pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>bitmap</parameter>&#160;:</term>
<listitem><simpara> Bitmap where the bilevel mask will be painted to.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_x</parameter>&#160;:</term>
<listitem><simpara> Source X coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_y</parameter>&#160;:</term>
<listitem><simpara> source Y coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_x</parameter>&#160;:</term>
<listitem><simpara> Destination X coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_y</parameter>&#160;:</term>
<listitem><simpara> Destination Y coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara> Width of region to threshold, or -1 to use pixbuf width
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height</parameter>&#160;:</term>
<listitem><simpara> Height of region to threshold, or -1 to use pixbuf height
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha_threshold</parameter>&#160;:</term>
<listitem><simpara> Opacity values below this will be painted as zero; all
other values will be painted as one.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-pixbuf-render-to-drawable" role="function" condition="deprecated:2.4: This function is obsolete. Use gdk_draw_pixbuf() instead.">
<title>gdk_pixbuf_render_to_drawable ()</title>
<indexterm zone="gdk-pixbuf-render-to-drawable" role="deprecated"><primary sortas="pixbuf_render_to_drawable">gdk_pixbuf_render_to_drawable</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_pixbuf_render_to_drawable       (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkDrawable">GdkDrawable</link> *drawable,
                                                         <link linkend="GdkGC">GdkGC</link> *gc,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height,
                                                         <link linkend="GdkRgbDither">GdkRgbDither</link> dither,
                                                         <link linkend="int">int</link> x_dither,
                                                         <link linkend="int">int</link> y_dither);</programlisting>
<warning><para><literal>gdk_pixbuf_render_to_drawable</literal> has been deprecated since version 2.4 and should not be used in newly-written code. This function is obsolete. Use <link linkend="gdk-draw-pixbuf"><function>gdk_draw_pixbuf()</function></link> instead.</para></warning>
<para>
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.
</para>
<para>
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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>pixbuf</parameter>&#160;:</term>
<listitem><simpara> A pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>drawable</parameter>&#160;:</term>
<listitem><simpara> Destination drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>gc</parameter>&#160;:</term>
<listitem><simpara> GC used for rendering.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_x</parameter>&#160;:</term>
<listitem><simpara> Source X coordinate within pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_y</parameter>&#160;:</term>
<listitem><simpara> Source Y coordinate within pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_x</parameter>&#160;:</term>
<listitem><simpara> Destination X coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_y</parameter>&#160;:</term>
<listitem><simpara> Destination Y coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara> Width of region to render, in pixels, or -1 to use pixbuf width
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height</parameter>&#160;:</term>
<listitem><simpara> Height of region to render, in pixels, or -1 to use pixbuf height
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dither</parameter>&#160;:</term>
<listitem><simpara> Dithering mode for GdkRGB.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x_dither</parameter>&#160;:</term>
<listitem><simpara> X offset for dither.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y_dither</parameter>&#160;:</term>
<listitem><simpara> Y offset for dither.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-pixbuf-render-to-drawable-alpha" role="function" condition="deprecated:2.4: This function is obsolete. Use gdk_draw_pixbuf() instead.">
<title>gdk_pixbuf_render_to_drawable_alpha ()</title>
<indexterm zone="gdk-pixbuf-render-to-drawable-alpha" role="deprecated"><primary sortas="pixbuf_render_to_drawable_alpha">gdk_pixbuf_render_to_drawable_alpha</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_pixbuf_render_to_drawable_alpha (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkDrawable">GdkDrawable</link> *drawable,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height,
                                                         <link linkend="GdkPixbufAlphaMode">GdkPixbufAlphaMode</link> alpha_mode,
                                                         <link linkend="int">int</link> alpha_threshold,
                                                         <link linkend="GdkRgbDither">GdkRgbDither</link> dither,
                                                         <link linkend="int">int</link> x_dither,
                                                         <link linkend="int">int</link> y_dither);</programlisting>
<warning><para><literal>gdk_pixbuf_render_to_drawable_alpha</literal> has been deprecated since version 2.4 and should not be used in newly-written code. This function is obsolete. Use <link linkend="gdk-draw-pixbuf"><function>gdk_draw_pixbuf()</function></link> instead.</para></warning>
<para>
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-<link linkend="NULL--CAPS"><literal>NULL</literal></link> window argument.
Otherwise a colormap must be set on them with gdk_drawable_set_colormap.
</para>
<para>
On older X servers, rendering pixbufs with an alpha channel involves round trips
to the X server, and may be somewhat slow.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>pixbuf</parameter>&#160;:</term>
<listitem><simpara> A pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>drawable</parameter>&#160;:</term>
<listitem><simpara> Destination drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_x</parameter>&#160;:</term>
<listitem><simpara> Source X coordinate within pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_y</parameter>&#160;:</term>
<listitem><simpara> Source Y coordinates within pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_x</parameter>&#160;:</term>
<listitem><simpara> Destination X coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_y</parameter>&#160;:</term>
<listitem><simpara> Destination Y coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara> Width of region to render, in pixels, or -1 to use pixbuf width.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height</parameter>&#160;:</term>
<listitem><simpara> Height of region to render, in pixels, or -1 to use pixbuf height.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha_mode</parameter>&#160;:</term>
<listitem><simpara> Ignored. Present for backwards compatibility.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha_threshold</parameter>&#160;:</term>
<listitem><simpara> Ignored. Present for backwards compatibility
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dither</parameter>&#160;:</term>
<listitem><simpara> Dithering mode for GdkRGB.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x_dither</parameter>&#160;:</term>
<listitem><simpara> X offset for dither.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y_dither</parameter>&#160;:</term>
<listitem><simpara> Y offset for dither.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-pixbuf-render-pixmap-and-mask" role="function">
<title>gdk_pixbuf_render_pixmap_and_mask ()</title>
<indexterm zone="gdk-pixbuf-render-pixmap-and-mask"><primary sortas="pixbuf_render_pixmap_and_mask">gdk_pixbuf_render_pixmap_and_mask</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_pixbuf_render_pixmap_and_mask   (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkPixmap">GdkPixmap</link> **pixmap_return,
                                                         <link linkend="GdkBitmap">GdkBitmap</link> **mask_return,
                                                         <link linkend="int">int</link> alpha_threshold);</programlisting>
<para>
Creates a pixmap and a mask bitmap which are returned in the <parameter>pixmap_return</parameter>
and <parameter>mask_return</parameter> 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 <link linkend="gdk-draw-pixbuf"><function>gdk_draw_pixbuf()</function></link> and <link linkend="gdk-pixbuf-render-threshold-alpha"><function>gdk_pixbuf_render_threshold_alpha()</function></link>.
</para>
<para>
The pixmap that is created is created for the colormap returned
by <link linkend="gdk-rgb-get-colormap"><function>gdk_rgb_get_colormap()</function></link>. You normally will want to instead use
the actual colormap for a widget, and use
<link linkend="gdk-pixbuf-render-pixmap-and-mask-for-colormap"><function>gdk_pixbuf_render_pixmap_and_mask_for_colormap()</function></link>.
</para>
<para>
If the pixbuf does not have an alpha channel, then *<parameter>mask_return</parameter> will be set
to <link linkend="NULL--CAPS"><literal>NULL</literal></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>pixbuf</parameter>&#160;:</term>
<listitem><simpara> A pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pixmap_return</parameter>&#160;:</term>
<listitem><simpara> Location to store a pointer to the created pixmap,
  or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the pixmap is not needed.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mask_return</parameter>&#160;:</term>
<listitem><simpara> Location to store a pointer to the created mask,
  or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the mask is not needed.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha_threshold</parameter>&#160;:</term>
<listitem><simpara> Threshold value for opacity values.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-pixbuf-render-pixmap-and-mask-for-colormap" role="function">
<title>gdk_pixbuf_render_pixmap_and_mask_for_colormap ()</title>
<indexterm zone="gdk-pixbuf-render-pixmap-and-mask-for-colormap"><primary sortas="pixbuf_render_pixmap_and_mask_for_colormap">gdk_pixbuf_render_pixmap_and_mask_for_colormap</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_pixbuf_render_pixmap_and_mask_for_colormap
                                                        (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                                         <link linkend="GdkColormap">GdkColormap</link> *colormap,
                                                         <link linkend="GdkPixmap">GdkPixmap</link> **pixmap_return,
                                                         <link linkend="GdkBitmap">GdkBitmap</link> **mask_return,
                                                         <link linkend="int">int</link> alpha_threshold);</programlisting>
<para>
Creates a pixmap and a mask bitmap which are returned in the <parameter>pixmap_return</parameter>
and <parameter>mask_return</parameter> 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 <link linkend="gdk-draw-pixbuf"><function>gdk_draw_pixbuf()</function></link>, and <link linkend="gdk-pixbuf-render-threshold-alpha"><function>gdk_pixbuf_render_threshold_alpha()</function></link>.
</para>
<para>
The pixmap that is created uses the <link linkend="GdkColormap"><type>GdkColormap</type></link> specified by <parameter>colormap</parameter>.
This colormap must match the colormap of the window where the pixmap
will eventually be used or an error will result.
</para>
<para>
If the pixbuf does not have an alpha channel, then *<parameter>mask_return</parameter> will be set
to <link linkend="NULL--CAPS"><literal>NULL</literal></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>pixbuf</parameter>&#160;:</term>
<listitem><simpara> A pixbuf.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>colormap</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GdkColormap"><type>GdkColormap</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pixmap_return</parameter>&#160;:</term>
<listitem><simpara> Location to store a pointer to the created pixmap,
  or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the pixmap is not needed.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mask_return</parameter>&#160;:</term>
<listitem><simpara> Location to store a pointer to the created mask,
  or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the mask is not needed.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha_threshold</parameter>&#160;:</term>
<listitem><simpara> Threshold value for opacity values.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-pixbuf-get-from-drawable" role="function">
<title>gdk_pixbuf_get_from_drawable ()</title>
<indexterm zone="gdk-pixbuf-get-from-drawable"><primary sortas="pixbuf_get_from_drawable">gdk_pixbuf_get_from_drawable</primary></indexterm><programlisting><link linkend="GdkPixbuf">GdkPixbuf</link> *         gdk_pixbuf_get_from_drawable        (<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
                                                         <link linkend="GdkDrawable">GdkDrawable</link> *src,
                                                         <link linkend="GdkColormap">GdkColormap</link> *cmap,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);</programlisting>
<para>
Transfers image data from a <link linkend="GdkDrawable"><type>GdkDrawable</type></link> and converts it to an RGB(A)
representation inside a <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link>. 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.
</para>
<para>
If the drawable <parameter>src</parameter> has no colormap (<link linkend="gdk-drawable-get-colormap"><function>gdk_drawable_get_colormap()</function></link>
returns <link linkend="NULL--CAPS"><literal>NULL</literal></link>), then a suitable colormap must be specified.
Typically a <link linkend="GdkWindow"><type>GdkWindow</type></link> or a pixmap created by passing a <link linkend="GdkWindow"><type>GdkWindow</type></link>
to <link linkend="gdk-pixmap-new"><function>gdk_pixmap_new()</function></link> will already have a colormap associated with
it.  If the drawable has a colormap, the <parameter>cmap</parameter> 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, <link linkend="gdk-colormap-get-system"><function>gdk_colormap_get_system()</function></link> returns
the correct colormap to use.
</para>
<para>
If the specified destination pixbuf <parameter>dest</parameter> is <link linkend="NULL--CAPS"><literal>NULL</literal></link>, then this
function will create an RGB pixbuf with 8 bits per channel and no
alpha, with the same size specified by the <parameter>width</parameter> and <parameter>height</parameter>
arguments.  In this case, the <parameter>dest_x</parameter> and <parameter>dest_y</parameter> arguments must be
specified as 0.  If the specified destination pixbuf is not <link linkend="NULL--CAPS"><literal>NULL</literal></link>
and it contains alpha information, then the filled pixels will be
set to full opacity (alpha = 255).
</para>
<para>
If the specified drawable is a pixmap, then the requested source
rectangle must be completely contained within the pixmap, otherwise
the function will return <link linkend="NULL--CAPS"><literal>NULL</literal></link>. For pixmaps only (not for windows)
passing -1 for width or height is allowed to mean the full width
or height of the pixmap.
</para>
<para>
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.
</para>
<para>
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.
</para>
<para>
If the target drawable is not mapped (typically because it's
iconified/minimized or not on the current workspace), then <link linkend="NULL--CAPS"><literal>NULL</literal></link>
will be returned.
</para>
<para>
If memory can't be allocated for the return value, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned
instead.
</para>
<para>
(In short, there are several ways this function can fail, and if it fails
 it returns <link linkend="NULL--CAPS"><literal>NULL</literal></link>; so check the return value.)
</para>
<para>
This function calls <link linkend="gdk-drawable-get-image"><function>gdk_drawable_get_image()</function></link> internally and
converts the resulting image to a <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link>, so the
documentation for <link linkend="gdk-drawable-get-image"><function>gdk_drawable_get_image()</function></link> may also be relevant.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>dest</parameter>&#160;:</term>
<listitem><simpara> Destination pixbuf, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if a new pixbuf should be created.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src</parameter>&#160;:</term>
<listitem><simpara> Source drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cmap</parameter>&#160;:</term>
<listitem><simpara> A colormap if <parameter>src</parameter> doesn't have one set.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_x</parameter>&#160;:</term>
<listitem><simpara> Source X coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_y</parameter>&#160;:</term>
<listitem><simpara> Source Y coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_x</parameter>&#160;:</term>
<listitem><simpara> Destination X coordinate in pixbuf, or 0 if <parameter>dest</parameter> is NULL.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_y</parameter>&#160;:</term>
<listitem><simpara> Destination Y coordinate in pixbuf, or 0 if <parameter>dest</parameter> is NULL.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara> Width in pixels of region to get.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height</parameter>&#160;:</term>
<listitem><simpara> Height in pixels of region to get.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The same pixbuf as <parameter>dest</parameter> if it was non-<link linkend="NULL--CAPS"><literal>NULL</literal></link>, or a newly-created
pixbuf with a reference count of 1 if no destination pixbuf was specified, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> on error
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-pixbuf-get-from-image" role="function">
<title>gdk_pixbuf_get_from_image ()</title>
<indexterm zone="gdk-pixbuf-get-from-image"><primary sortas="pixbuf_get_from_image">gdk_pixbuf_get_from_image</primary></indexterm><programlisting><link linkend="GdkPixbuf">GdkPixbuf</link> *         gdk_pixbuf_get_from_image           (<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
                                                         <link linkend="GdkImage">GdkImage</link> *src,
                                                         <link linkend="GdkColormap">GdkColormap</link> *cmap,
                                                         <link linkend="int">int</link> src_x,
                                                         <link linkend="int">int</link> src_y,
                                                         <link linkend="int">int</link> dest_x,
                                                         <link linkend="int">int</link> dest_y,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);</programlisting>
<para>
Same as <link linkend="gdk-pixbuf-get-from-drawable"><function>gdk_pixbuf_get_from_drawable()</function></link> but gets the pixbuf from
an image.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>dest</parameter>&#160;:</term>
<listitem><simpara> Destination pixbuf, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if a new pixbuf should be created.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src</parameter>&#160;:</term>
<listitem><simpara> Source <link linkend="GdkImage"><type>GdkImage</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cmap</parameter>&#160;:</term>
<listitem><simpara> A colormap, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to use the one for <parameter>src</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_x</parameter>&#160;:</term>
<listitem><simpara> Source X coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src_y</parameter>&#160;:</term>
<listitem><simpara> Source Y coordinate within drawable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_x</parameter>&#160;:</term>
<listitem><simpara> Destination X coordinate in pixbuf, or 0 if <parameter>dest</parameter> is NULL.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_y</parameter>&#160;:</term>
<listitem><simpara> Destination Y coordinate in pixbuf, or 0 if <parameter>dest</parameter> is NULL.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara> Width in pixels of region to get.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height</parameter>&#160;:</term>
<listitem><simpara> Height in pixels of region to get.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <parameter>dest</parameter>, newly-created pixbuf if <parameter>dest</parameter> was <link linkend="NULL--CAPS"><literal>NULL</literal></link>, <link linkend="NULL--CAPS"><literal>NULL</literal></link> on error
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
