<?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">

<!ENTITY gdk-pixbuf "<application>gdk-pixbuf</application>">
<!ENTITY Imlib "<application>Imlib</application>">
]>
<refentry id="gdk-pixbuf-gdk-pixbuf-xlib-from-drawables">
<refmeta>
<refentrytitle role="top_of_page" id="gdk-pixbuf-gdk-pixbuf-xlib-from-drawables.top_of_page">X Drawables to Pixbufs</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK-PIXBUF Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>X Drawables to Pixbufs</refname>
<refpurpose>Getting parts of an X drawable's image data into a pixbuf.</refpurpose>
</refnamediv>

<refsynopsisdiv id="gdk-pixbuf-gdk-pixbuf-xlib-from-drawables.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

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

<link linkend="GdkPixbuf">GdkPixbuf</link> *         <link linkend="gdk-pixbuf-xlib-get-from-drawable">gdk_pixbuf_xlib_get_from_drawable</link>   (<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
                                                         <link linkend="Drawable">Drawable</link> src,
                                                         <link linkend="Colormap">Colormap</link> cmap,
                                                         <link linkend="Visual">Visual</link> *visual,
                                                         <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-pixbuf-gdk-pixbuf-xlib-from-drawables.description" role="desc">
<title role="desc.title">Description</title>
  <para>
    The functions in this section allow you to take the image data
    from an X drawable and dump it into a <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link>.  This can be
    used for screenshots and other special effects.  Note that these
    operations can be expensive, since the image data has to be
    transferred from the X server to the client program and converted.
  </para>
  <para>
    These functions are analogous to those for the GDK version of
    &gdk-pixbuf;.
  </para>
</refsect1>

<refsect1 id="gdk-pixbuf-gdk-pixbuf-xlib-from-drawables.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="gdk-pixbuf-xlib-get-from-drawable" role="function">
<title>gdk_pixbuf_xlib_get_from_drawable ()</title>
<indexterm zone="gdk-pixbuf-xlib-get-from-drawable"><primary sortas="xlib_get_from_drawable">gdk_pixbuf_xlib_get_from_drawable</primary></indexterm><programlisting><link linkend="GdkPixbuf">GdkPixbuf</link> *         gdk_pixbuf_xlib_get_from_drawable   (<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
                                                         <link linkend="Drawable">Drawable</link> src,
                                                         <link linkend="Colormap">Colormap</link> cmap,
                                                         <link linkend="Visual">Visual</link> *visual,
                                                         <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 Gdk drawable and converts it to an RGB(A)
representation inside a GdkPixbuf.
</para>
<para>
If the drawable <parameter>src</parameter> is a pixmap, then a suitable colormap must be specified,
since pixmaps are just blocks of pixel data without an associated colormap.
If the drawable is a window, the <parameter>cmap</parameter> argument will be ignored and the
window's own colormap will be used instead.
</para>
<para>
If the specified destination pixbuf <parameter>dest</parameter> is <link linkend="NULL--CAPS"><type>NULL</type></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, otherwise the function will return
<link linkend="NULL--CAPS"><type>NULL</type></link>.  If the specified destination pixbuf is not NULL and it contains alpha
information, then the filled pixels will be set to full opacity.
</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"><type>NULL</type></link>.
</para>
<para>
If the specified drawable is a window, then it must be viewable, i.e. all of
its ancestors up to the root window must be mapped.  Also, the specified
source rectangle must be completely contained within the window and within
the screen.  If regions of the window are obscured by noninferior windows, the
contents of those regions are undefined.  The contents of regions obscured by
inferior windows of a different depth than that of the source window will also
be undefined.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>dest</parameter>&#160;:</term>
<listitem><simpara> Destination pixbuf, or NULL 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> is a pixmap.  If it is a window, this argument will
be ignored.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>visual</parameter>&#160;:</term>
<listitem><simpara> A visual if <parameter>src</parameter> is a pixmap.  If it is a window, this argument will
be ignored.
</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-NULL, or a newly-created
pixbuf with a reference count of 1 if no destination pixbuf was specified; in
the latter case, NULL will be returned if not enough memory could be
allocated for the pixbuf to be created.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
