1
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.gdk.PixbufLoader</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gdk-class-reference.html" title="The gtk.gdk Class Reference"><link rel="prev" href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"><link rel="next" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.gdk.PixbufLoader</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gdkpixbufanimationiter.html">Prev</a> </td><th width="60%" align="center">The gtk.gdk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gdkpixmap.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gdkpixbufloader"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.gdk.PixbufLoader</h2><p>gtk.gdk.PixbufLoader — an object providing application-driven progressive image
2
loading</p></div><div class="refsect1" lang="en"><a name="id3270110"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.gdk.PixbufLoader</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
2
loading</p></div><div class="refsect1" lang="en"><a name="id3352027"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.gdk.PixbufLoader</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
3
3
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#constructor-gdkpixbufloader" title="Constructor">gtk.gdk.PixbufLoader</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image_type</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#method-gdkpixbufloader--write" title="gtk.gdk.PixbufLoader.write">write</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buf</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>count</code></strong></span><span class="initializer">=-1</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#method-gdkpixbufloader--get-pixbuf" title="gtk.gdk.PixbufLoader.get_pixbuf">get_pixbuf</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#method-gdkpixbufloader--get-animation" title="gtk.gdk.PixbufLoader.get_animation">get_animation</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#method-gdkpixbufloader--close" title="gtk.gdk.PixbufLoader.close">close</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#method-gdkpixbufloader--set-size" title="gtk.gdk.PixbufLoader.set_size">set_size</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#method-gdkpixbufloader--get-format" title="gtk.gdk.PixbufLoader.get_format">get_format</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><pre class="programlisting">
4
4
<span class="bold"><strong>Functions</strong></span>
6
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#function-gdk--pixbuf-loader-new-with-mime-type" title="gtk.gdk.pixbuf_loader_new_with_mime_type">gtk.gdk.pixbuf_loader_new_with_mime_type</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>mime_type</code></strong></span></span>)</code></pre></div><div class="refsect1" lang="en"><a name="id3270364"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
6
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbufloader.html#function-gdk--pixbuf-loader-new-with-mime-type" title="gtk.gdk.pixbuf_loader_new_with_mime_type">gtk.gdk.pixbuf_loader_new_with_mime_type</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>mime_type</code></strong></span></span>)</code></pre></div><div class="refsect1" lang="en"><a name="id3352281"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
7
7
+-- <a class="link" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader">gtk.gdk.PixbufLoader</a>
8
</pre></div><div class="refsect1" lang="en"><a name="id3270390"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--area-prepared" title='The "area-prepared" gtk.gdk.PixbufLoader Signal'>area-prepared</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--area-updated" title='The "area-updated" gtk.gdk.PixbufLoader Signal'>area-updated</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>x</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>y</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>width</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>height</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--closed" title='The "closed" gtk.gdk.PixbufLoader Signal'>closed</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--size-prepared" title='The "size-prepared" gtk.gdk.PixbufLoader Signal'>size-prepared</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>width</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>height</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3270714"></a><h2>Description</h2><p>A <a class="link" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>
8
</pre></div><div class="refsect1" lang="en"><a name="id3352306"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--area-prepared" title='The "area-prepared" gtk.gdk.PixbufLoader Signal'>area-prepared</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--area-updated" title='The "area-updated" gtk.gdk.PixbufLoader Signal'>area-updated</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>x</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>y</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>width</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>height</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--closed" title='The "closed" gtk.gdk.PixbufLoader Signal'>closed</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gdkpixbufloader.html#signal-gdkpixbufloader--size-prepared" title='The "size-prepared" gtk.gdk.PixbufLoader Signal'>size-prepared</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>width</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>height</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3352631"></a><h2>Description</h2><p>A <a class="link" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>
9
9
provides a way for applications to drive the process of loading an image, by
10
10
letting them send the image data directly to the loader instead of having
11
11
the loader read the data from a file. Applications can use this instead of
27
27
updated. This way you can update a partially completed image. Note that you
28
28
do not know anything about the completeness of an image from the area
29
29
updated. For example, in an interlaced image, you need to make several
30
passes before the image is done loading.</p><div class="refsect2" lang="en"><a name="id3270808"></a><h3>Loading an Animation</h3><p>Loading an animation is almost as easy as loading an image. Once
30
passes before the image is done loading.</p><div class="refsect2" lang="en"><a name="id3352725"></a><h3>Loading an Animation</h3><p>Loading an animation is almost as easy as loading an image. Once
31
31
the first "area-prepared" signal has been emitted, you can call the <a class="link" href="class-gdkpixbufloader.html#method-gdkpixbufloader--get-animation" title="gtk.gdk.PixbufLoader.get_animation"><code class="methodname">get_animation</code>()</a>
32
32
method to get the <a class="link" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><code class="classname">gtk.gdk.PixbufAnimation</code></a>
33
33
object and the <a class="link" href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-iter" title="gtk.gdk.PixbufAnimation.get_iter"><code class="methodname">gtk.gdk.PixbufAnimation.get_iter</code>()</a>
43
43
isn't the expected type, for loading image formats that can't be reliably
44
44
identified by looking at the data, or if the user manually forces a specific
45
45
type.</p><p>This constructor raises the GError exception if an error occurs
46
trying to load the module for <em class="parameter"><code>image_type</code></em>.</p></div><div class="refsect1" lang="en"><a name="id3270993"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gdkpixbufloader--write"></a><h3>gtk.gdk.PixbufLoader.write</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">write</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buf</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>count</code></strong></span><span class="initializer">=-1</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>buf</code></strong> :</span></p></td><td>a string containing some portion of the image
46
trying to load the module for <em class="parameter"><code>image_type</code></em>.</p></div><div class="refsect1" lang="en"><a name="id3352909"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gdkpixbufloader--write"></a><h3>gtk.gdk.PixbufLoader.write</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">write</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buf</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>count</code></strong></span><span class="initializer">=-1</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>buf</code></strong> :</span></p></td><td>a string containing some portion of the image
47
47
data.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>count</code></strong> :</span></p></td><td>the length of <em class="parameter"><code>buf</code></em> in
48
48
bytes.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the write was
49
49
successful.</td></tr></tbody></table><p>The <code class="methodname">write</code>() method causes the pixbuf
94
94
information or <code class="literal">None</code></td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">get_format</code>() method returns the
95
95
available information about the format of the currently loading image
96
96
file. This method returns None if their is no information available
97
e.g. before the image has started loading.</p></div></div><div class="refsect1" lang="en"><a name="id3026780"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-gdk--pixbuf-loader-new-with-mime-type"></a><h3>gtk.gdk.pixbuf_loader_new_with_mime_type</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_loader_new_with_mime_type</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>mime_type</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>mime_type</code></strong> :</span></p></td><td> the mime type to be loaded</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>
97
e.g. before the image has started loading.</p></div></div><div class="refsect1" lang="en"><a name="id3046224"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-gdk--pixbuf-loader-new-with-mime-type"></a><h3>gtk.gdk.pixbuf_loader_new_with_mime_type</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_loader_new_with_mime_type</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>mime_type</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>mime_type</code></strong> :</span></p></td><td> the mime type to be loaded</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>
98
98
object.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.4 and above.</p></div><p>The
99
99
<code class="function">gtk.gdk.pixbuf_loader_new_with_mime_type</code>() function
100
100
creates a new pixbuf loader object that always attempts to parse image data
104
104
mime type, for loading image formats that can't be reliably identified by
105
105
looking at the data, or if the user manually forces a specific mime
106
106
type.</p><p>This function raises the GError exception if an error occurs
107
during the loading of the mime type image module.</p></div></div><div class="refsect1" lang="en"><a name="id3026905"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gdkpixbufloader--area-prepared"></a><h3>The "area-prepared" gtk.gdk.PixbufLoader Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>pixbufloader</code></em> :</span></p></td><td>the pixbufloader that received the
107
during the loading of the mime type image module.</p></div></div><div class="refsect1" lang="en"><a name="id3046349"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gdkpixbufloader--area-prepared"></a><h3>The "area-prepared" gtk.gdk.PixbufLoader Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbufloader</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>pixbufloader</code></em> :</span></p></td><td>the pixbufloader that received the
108
108
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
109
109
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
110
110
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if