<HTML
><HEAD
><TITLE
>Drawables to Pixbufs</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.40"><LINK
REL="HOME"
TITLE="The gdk-pixbuf Library"
HREF="book1.html"><LINK
REL="UP"
TITLE="API Reference"
HREF="r15.html"><LINK
REL="PREVIOUS"
TITLE="Scaling"
HREF="gdk-pixbuf-scaling.html"><LINK
REL="NEXT"
TITLE="Utilities"
HREF="gdk-pixbuf-util.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TH
COLSPAN="4"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="5"
>The <SPAN
CLASS="APPLICATION"
>gdk-pixbuf</SPAN
> Library</FONT
></TH
></TR
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="gdk-pixbuf-scaling.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="r15.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Up</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="gdk-pixbuf-util.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
></TABLE
></DIV
><H1
><A
NAME="GDK-PIXBUF-FROM-DRAWABLES"
>Drawables to Pixbufs</A
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN1407"
></A
><H2
>Name</H2
>Drawables to Pixbufs &#8212; Getting parts of a drawable's image data into a pixbuf.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN1410"
></A
><H2
>Synopsis</H2
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="SYNOPSIS"
>&#13;#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;


<A
HREF="gdk-pixbuf-gdk-pixbuf.html#GDKPIXBUF"
>GdkPixbuf</A
>*  <A
HREF="gdk-pixbuf-from-drawables.html#GDK-PIXBUF-GET-FROM-DRAWABLE"
>gdk_pixbuf_get_from_drawable</A
>    (<A
HREF="gdk-pixbuf-gdk-pixbuf.html#GDKPIXBUF"
>GdkPixbuf</A
> *dest,
                                             <GTKDOCLINK
HREF="GDKDRAWABLE"
>GdkDrawable</GTKDOCLINK
> *src,
                                             <GTKDOCLINK
HREF="GDKCOLORMAP"
>GdkColormap</GTKDOCLINK
> *cmap,
                                             int src_x,
                                             int src_y,
                                             int dest_x,
                                             int dest_y,
                                             int width,
                                             int height);</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN1418"
></A
><H2
>Description</H2
><P
>    The functions in this section allow you to take the image data
    from a GDK drawable and dump it into a <A
HREF="gdk-pixbuf-gdk-pixbuf.html#GDKPIXBUF"
>GdkPixbuf</A
>.  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.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN1422"
></A
><H2
>Details</H2
><DIV
CLASS="REFSECT2"
><A
NAME="AEN1424"
></A
><H3
><A
NAME="GDK-PIXBUF-GET-FROM-DRAWABLE"
></A
>gdk_pixbuf_get_from_drawable ()</H3
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
><A
HREF="gdk-pixbuf-gdk-pixbuf.html#GDKPIXBUF"
>GdkPixbuf</A
>*  gdk_pixbuf_get_from_drawable    (<A
HREF="gdk-pixbuf-gdk-pixbuf.html#GDKPIXBUF"
>GdkPixbuf</A
> *dest,
                                             <GTKDOCLINK
HREF="GDKDRAWABLE"
>GdkDrawable</GTKDOCLINK
> *src,
                                             <GTKDOCLINK
HREF="GDKCOLORMAP"
>GdkColormap</GTKDOCLINK
> *cmap,
                                             int src_x,
                                             int src_y,
                                             int dest_x,
                                             int dest_y,
                                             int width,
                                             int height);</PRE
></TD
></TR
></TABLE
><P
>Transfers image data from a Gdk drawable and converts it to an RGB(A)
representation inside a GdkPixbuf.</P
><P
>If the drawable <TT
CLASS="PARAMETER"
><I
>src</I
></TT
> 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 <TT
CLASS="PARAMETER"
><I
>cmap</I
></TT
> argument will be ignored and the
window's own colormap will be used instead.</P
><P
>If the specified destination pixbuf <TT
CLASS="PARAMETER"
><I
>dest</I
></TT
> is <GTKDOCLINK
HREF="NULL"
>NULL</GTKDOCLINK
>, then this function will
create an RGB pixbuf with 8 bits per channel and no alpha, with the same size
specified by the <TT
CLASS="PARAMETER"
><I
>width</I
></TT
> and <TT
CLASS="PARAMETER"
><I
>height</I
></TT
> arguments.  In this case, the <TT
CLASS="PARAMETER"
><I
>dest_x</I
></TT
> and
<TT
CLASS="PARAMETER"
><I
>dest_y</I
></TT
> arguments must be specified as 0, otherwise the function will return
<GTKDOCLINK
HREF="NULL"
>NULL</GTKDOCLINK
>.  If the specified destination pixbuf is not NULL and it contains alpha
information, then the filled pixels will be set to full opacity.</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 <GTKDOCLINK
HREF="NULL"
>NULL</GTKDOCLINK
>.</P
><P
>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.</P
><P
></P
><DIV
CLASS="INFORMALTABLE"
><P
></P
><TABLE
BORDER="0"
WIDTH="100%"
BGCOLOR="#FFD0D0"
CELLSPACING="0"
CELLPADDING="4"
CLASS="CALSTABLE"
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>dest</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Destination pixbuf, or NULL if a new pixbuf should be created.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>src</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Source drawable.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>cmap</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> A colormap if <TT
CLASS="PARAMETER"
><I
>src</I
></TT
> is a pixmap.  If it is a window, this argument will
be ignored.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>src_x</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Source X coordinate within drawable.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>src_y</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Source Y coordinate within drawable.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>dest_x</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Destination X coordinate in pixbuf, or 0 if <TT
CLASS="PARAMETER"
><I
>dest</I
></TT
> is NULL.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>dest_y</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Destination Y coordinate in pixbuf, or 0 if <TT
CLASS="PARAMETER"
><I
>dest</I
></TT
> is NULL.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>width</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Width in pixels of region to get.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>height</I
></TT
>&nbsp;:</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> Height in pixels of region to get.</TD
></TR
><TR
><TD
WIDTH="20%"
ALIGN="RIGHT"
VALIGN="TOP"
><I
CLASS="EMPHASIS"
>Returns</I
> :</TD
><TD
WIDTH="80%"
ALIGN="LEFT"
VALIGN="TOP"
> The same pixbuf as <TT
CLASS="PARAMETER"
><I
>dest</I
></TT
> 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.</TD
></TR
></TABLE
><P
></P
></DIV
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN1497"
></A
><H2
>See Also</H2
><P
>    <GTKDOCLINK
HREF="GDK-IMAGE-GET"
>gdk_image_get</GTKDOCLINK
>().
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><BR
CLEAR="all"><BR><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="gdk-pixbuf-scaling.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="r15.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Up</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="gdk-pixbuf-util.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="left"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Scaling</B
></FONT
></TD
><TD
COLSPAN="2"
ALIGN="right"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Utilities</B
></FONT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>