1
<refentry id="gdk-pixbuf-gdk-pixbuf-xlib-from-drawables">
3
<refentrytitle>X Drawables to Pixbufs</refentrytitle>
4
<manvolnum>3</manvolnum>
5
<refmiscinfo>GDK-PIXBUF Library</refmiscinfo>
9
<refname>X Drawables to Pixbufs</refname><refpurpose>Getting parts of an X drawable's image data into a pixbuf.</refpurpose>
12
<refsynopsisdiv><title>Synopsis</title>
15
#include <gdk-pixbuf/gdk-pixbuf.h>
18
<link linkend="GdkPixbuf">GdkPixbuf</link>* <link linkend="gdk-pixbuf-xlib-get-from-drawable">gdk_pixbuf_xlib_get_from_drawable</link>
19
(<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
20
<link linkend="Drawable">Drawable</link> src,
21
<link linkend="Colormap">Colormap</link> cmap,
22
<link linkend="Visual">Visual</link> *visual,
37
<title>Description</title>
39
The functions in this section allow you to take the image data
40
from an X drawable and dump it into a <link linkend="GdkPixbuf">GdkPixbuf</link>. This can be
41
used for screenshots and other special effects. Note that these
42
operations can be expensive, since the image data has to be
43
transferred from the X server to the client program and converted.
47
These functions are analogous to those for the Gdk version of
53
<title>Details</title>
55
<title><anchor id="gdk-pixbuf-xlib-get-from-drawable">gdk_pixbuf_xlib_get_from_drawable ()</title>
56
<programlisting><link linkend="GdkPixbuf">GdkPixbuf</link>* gdk_pixbuf_xlib_get_from_drawable
57
(<link linkend="GdkPixbuf">GdkPixbuf</link> *dest,
58
<link linkend="Drawable">Drawable</link> src,
59
<link linkend="Colormap">Colormap</link> cmap,
60
<link linkend="Visual">Visual</link> *visual,
66
int height);</programlisting>
68
Transfers image data from a Gdk drawable and converts it to an RGB(A)
69
representation inside a GdkPixbuf.
72
If the drawable <parameter>src</parameter> is a pixmap, then a suitable colormap must be specified,
73
since pixmaps are just blocks of pixel data without an associated colormap.
74
If the drawable is a window, the <parameter>cmap</parameter> argument will be ignored and the
75
window's own colormap will be used instead.
78
If the specified destination pixbuf <parameter>dest</parameter> is <literal>NULL</literal>, then this function will
79
create an RGB pixbuf with 8 bits per channel and no alpha, with the same size
80
specified by the <parameter>width</parameter> and <parameter>height</parameter> arguments. In this case, the <parameter>dest_x</parameter> and
81
<parameter>dest_y</parameter> arguments must be specified as 0, otherwise the function will return
82
<literal>NULL</literal>. If the specified destination pixbuf is not <literal>NULL</literal> and it contains alpha
83
information, then the filled pixels will be set to full opacity.
86
If the specified drawable is a pixmap, then the requested source rectangle
87
must be completely contained within the pixmap, otherwise the function will
88
return <literal>NULL</literal>.
91
If the specified drawable is a window, then it must be viewable, i.e. all of
92
its ancestors up to the root window must be mapped. Also, the specified
93
source rectangle must be completely contained within the window and within
94
the screen. If regions of the window are obscured by noninferior windows, the
95
contents of those regions are undefined. The contents of regions obscured by
96
inferior windows of a different depth than that of the source window will also
100
</para><informaltable pgwide=1 frame="none" role="params">
102
<colspec colwidth="2*">
103
<colspec colwidth="8*">
105
<row><entry align="right"><parameter>dest</parameter> :</entry>
106
<entry> Destination pixbuf, or <literal>NULL</literal> if a new pixbuf should be created.
108
<row><entry align="right"><parameter>src</parameter> :</entry>
109
<entry> Source drawable.
111
<row><entry align="right"><parameter>cmap</parameter> :</entry>
112
<entry> A colormap if <parameter>src</parameter> is a pixmap. If it is a window, this argument will
115
<row><entry align="right"><parameter>visual</parameter> :</entry>
116
<entry> A visual if <parameter>src</parameter> is a pixmap. If it is a window, this argument will
119
<row><entry align="right"><parameter>src_x</parameter> :</entry>
120
<entry> Source X coordinate within drawable.
122
<row><entry align="right"><parameter>src_y</parameter> :</entry>
123
<entry> Source Y coordinate within drawable.
125
<row><entry align="right"><parameter>dest_x</parameter> :</entry>
126
<entry> Destination X coordinate in pixbuf, or 0 if <parameter>dest</parameter> is <literal>NULL</literal>.
128
<row><entry align="right"><parameter>dest_y</parameter> :</entry>
129
<entry> Destination Y coordinate in pixbuf, or 0 if <parameter>dest</parameter> is <literal>NULL</literal>.
131
<row><entry align="right"><parameter>width</parameter> :</entry>
132
<entry> Width in pixels of region to get.
134
<row><entry align="right"><parameter>height</parameter> :</entry>
135
<entry> Height in pixels of region to get.
137
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The same pixbuf as <parameter>dest</parameter> if it was non-<literal>NULL</literal>, or a newly-created
138
pixbuf with a reference count of 1 if no destination pixbuf was specified; in
139
the latter case, <literal>NULL</literal> will be returned if not enough memory could be
140
allocated for the pixbuf to be created.
142
</tbody></tgroup></informaltable></refsect2>