<refentry id="gdk-pixbuf-gdk-pixbuf">
<refmeta>
<refentrytitle>The GdkPixbuf Structure</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK-PIXBUF Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>The GdkPixbuf Structure</refname><refpurpose>Information that describes an image.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

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


enum        <link linkend="GdkPixbufError">GdkPixbufError</link>;
#define     <link linkend="GDK-PIXBUF-ERROR-CAPS">GDK_PIXBUF_ERROR</link>
enum        <link linkend="GdkColorspace">GdkColorspace</link>;
enum        <link linkend="GdkPixbufAlphaMode">GdkPixbufAlphaMode</link>;
struct      <link linkend="GdkPixbuf-struct">GdkPixbuf</link>;
<link linkend="GdkColorspace">GdkColorspace</link> <link linkend="gdk-pixbuf-get-colorspace">gdk_pixbuf_get_colorspace</link>     (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
int         <link linkend="gdk-pixbuf-get-n-channels">gdk_pixbuf_get_n_channels</link>       (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
<link linkend="gboolean">gboolean</link>    <link linkend="gdk-pixbuf-get-has-alpha">gdk_pixbuf_get_has_alpha</link>        (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
int         <link linkend="gdk-pixbuf-get-bits-per-sample">gdk_pixbuf_get_bits_per_sample</link>  (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
<link linkend="guchar">guchar</link>*     <link linkend="gdk-pixbuf-get-pixels">gdk_pixbuf_get_pixels</link>           (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
int         <link linkend="gdk-pixbuf-get-width">gdk_pixbuf_get_width</link>            (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
int         <link linkend="gdk-pixbuf-get-height">gdk_pixbuf_get_height</link>           (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
int         <link linkend="gdk-pixbuf-get-rowstride">gdk_pixbuf_get_rowstride</link>        (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);
G_CONST_RETURN <link linkend="gchar">gchar</link>* <link linkend="gdk-pixbuf-get-option">gdk_pixbuf_get_option</link> (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                             const <link linkend="gchar">gchar</link> *key);


</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>

  <para><anchor id="GdkPixbuf">
    The <structname>GdkPixbuf</structname> structure contains
    information that describes an image in memory.
  </para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GdkPixbufError">enum GdkPixbufError</title>
<programlisting>typedef enum {
        /* image data hosed */
        GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
        /* no mem to load image */
        GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
        /* bad option passed to save routine */
        GDK_PIXBUF_ERROR_BAD_OPTION,
        /* unsupported image type (sort of an ENOSYS) */
        GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
        /* unsupported operation (load, save) for image type */
        GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
        GDK_PIXBUF_ERROR_FAILED
} GdkPixbufError;
</programlisting>
<para>
An error code in the <link linkend="GDK-PIXBUF-ERROR-CAPS">GDK_PIXBUF_ERROR</link> domain. Many &gdk-pixbuf;
operations can cause errors in this domain, or in the <link linkend="G-FILE-ERROR-CAPS">G_FILE_ERROR</link>
domain.
</para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>GDK_PIXBUF_ERROR_CORRUPT_IMAGE</literal></entry>
<entry>An image file was broken somehow.
</entry>
</row>
<row>
<entry><literal>GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY</literal></entry>
<entry>Not enough memory.
</entry>
</row>
<row>
<entry><literal>GDK_PIXBUF_ERROR_BAD_OPTION</literal></entry>
<entry>A bad option was passed to a pixbuf save module.
</entry>
</row>
<row>
<entry><literal>GDK_PIXBUF_ERROR_UNKNOWN_TYPE</literal></entry>
<entry>Unknown image type.
</entry>
</row>
<row>
<entry><literal>GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION</literal></entry>
<entry>Don't know how to perform the
given operation on the type of image at hand.
</entry>
</row>
<row>
<entry><literal>GDK_PIXBUF_ERROR_FAILED</literal></entry>
<entry>Generic failure code, something went wrong.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GDK-PIXBUF-ERROR-CAPS">GDK_PIXBUF_ERROR</title>
<programlisting>#define GDK_PIXBUF_ERROR gdk_pixbuf_error_quark ()
</programlisting>
<para>
Error domain used for pixbuf operations. Indicates that the error code
will be in the <link linkend="GdkPixbufError">GdkPixbufError</link> enumeration. See <link linkend="GError">GError</link> for
information on error domains and error codes.
</para></refsect2>
<refsect2>
<title><anchor id="GdkColorspace">enum GdkColorspace</title>
<programlisting>typedef enum {
	GDK_COLORSPACE_RGB
} GdkColorspace;
</programlisting>
  <para>
    This enumeration defines the color spaces that are supported by
    the &gdk-pixbuf; library.  Currently only RGB is supported.
  </para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>GDK_COLORSPACE_RGB</literal></entry>
<entry>Indicates a red/green/blue additive color space.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkPixbufAlphaMode">enum GdkPixbufAlphaMode</title>
<programlisting>typedef enum
{
        GDK_PIXBUF_ALPHA_BILEVEL,
        GDK_PIXBUF_ALPHA_FULL
} GdkPixbufAlphaMode;
</programlisting>
  <para>
    These values can be passed to
    <link linkend="gdk-pixbuf-render-to-drawable-alpha">gdk_pixbuf_render_to_drawable_alpha</link>() to control how the alpha
    chanel of an image should be handled.  This function can create a
    bilevel clipping mask (black and white) and use it while painting
    the image.  In the future, when the X Window System gets an alpha
    channel extension, it will be possible to do full alpha
    compositing onto arbitrary drawables.  For now both cases fall
    back to a bilevel clipping mask.
  </para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>GDK_PIXBUF_ALPHA_BILEVEL</literal></entry>
<entry>A bilevel clipping mask (black and white)
will be created and used to draw the image.  Pixels below 0.5 opacity
will be considered fully transparent, and all others will be
considered fully opaque.
</entry>
</row>
<row>
<entry><literal>GDK_PIXBUF_ALPHA_FULL</literal></entry>
<entry>For now falls back to <link linkend="GDK-PIXBUF-ALPHA-BILEVEL-CAPS">GDK_PIXBUF_ALPHA_BILEVEL</link>.
In the future it will do full alpha compositing.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkPixbuf-struct">struct GdkPixbuf</title>
<programlisting>struct GdkPixbuf;</programlisting>
  <para>
    This is the main structure in the &gdk-pixbuf; library.  It is
    used to represent images.  It contains information about the
    image's pixel data, its color space, bits per sample, width and
    height, and the rowstride or number of bytes between rows.
  </para></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-colorspace">gdk_pixbuf_get_colorspace ()</title>
<programlisting><link linkend="GdkColorspace">GdkColorspace</link> gdk_pixbuf_get_colorspace     (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries the color space of a pixbuf.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Color space.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-n-channels">gdk_pixbuf_get_n_channels ()</title>
<programlisting>int         gdk_pixbuf_get_n_channels       (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries the number of channels of a pixbuf.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Number of channels.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-has-alpha">gdk_pixbuf_get_has_alpha ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gdk_pixbuf_get_has_alpha        (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries whether a pixbuf has an alpha channel (opacity information).</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <literal>TRUE</literal> if it has an alpha channel, <literal>FALSE</literal> otherwise.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-bits-per-sample">gdk_pixbuf_get_bits_per_sample ()</title>
<programlisting>int         gdk_pixbuf_get_bits_per_sample  (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries the number of bits per color sample in a pixbuf.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Number of bits per color sample.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-pixels">gdk_pixbuf_get_pixels ()</title>
<programlisting><link linkend="guchar">guchar</link>*     gdk_pixbuf_get_pixels           (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries a pointer to the pixel data of a pixbuf.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A pointer to the pixbuf's pixel data.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-width">gdk_pixbuf_get_width ()</title>
<programlisting>int         gdk_pixbuf_get_width            (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries the width of a pixbuf.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Width in pixels.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-height">gdk_pixbuf_get_height ()</title>
<programlisting>int         gdk_pixbuf_get_height           (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries the height of a pixbuf.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Height in pixels.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-rowstride">gdk_pixbuf_get_rowstride ()</title>
<programlisting>int         gdk_pixbuf_get_rowstride        (const <link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf);</programlisting>
<para>
Queries the rowstride of a pixbuf, which is the number of bytes between rows.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> A pixbuf.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Number of bytes between rows.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-pixbuf-get-option">gdk_pixbuf_get_option ()</title>
<programlisting>G_CONST_RETURN <link linkend="gchar">gchar</link>* gdk_pixbuf_get_option (<link linkend="GdkPixbuf">GdkPixbuf</link> *pixbuf,
                                             const <link linkend="gchar">gchar</link> *key);</programlisting>
<para>
Looks up <parameter>key</parameter> in the list of options that may have been attached to the
<parameter>pixbuf</parameter> when it was loaded.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pixbuf</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkPixbuf">GdkPixbuf</link>
</entry></row>
<row><entry align="right"><parameter>key</parameter>&nbsp;:</entry>
<entry> a nul-terminated string.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the value associated with <parameter>key</parameter>. This is a nul-terminated 
string that should not be freed or <literal>NULL</literal> if <parameter>key</parameter> was not found.
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>
