File: class-gdkpixbufanimation.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (62 lines) | stat: -rw-r--r-- 14,631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.gdk.PixbufAnimation</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" 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="previous" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><link rel="next" href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"></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.PixbufAnimation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gdkpixbuf.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-gdkpixbufanimationiter.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gdkpixbufanimation"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.gdk.PixbufAnimation</h2><p>gtk.gdk.PixbufAnimation &#8212; an object holding an animation</p></div><div class="refsect1" lang="en"><a name="id2990948"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.gdk.PixbufAnimation</span></span>(<span class="ooclass"><span class="classname"><a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gdkpixbufanimation.html#constructor-gdkpixbufanimation" title="Constructor">gtk.gdk.PixbufAnimation</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>filename</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-width" title="gtk.gdk.PixbufAnimation.get_width">get_width</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-height" title="gtk.gdk.PixbufAnimation.get_height">get_height</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--is-static-image" title="gtk.gdk.PixbufAnimation.is_static_image">is_static_image</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-static-image" title="gtk.gdk.PixbufAnimation.get_static_image">get_static_image</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-iter" title="gtk.gdk.PixbufAnimation.get_iter">get_iter</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>start_time</tt></b></span><span class="initializer">=0.0</span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id2970597"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
  +-- <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation">gtk.gdk.PixbufAnimation</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3031534"></a><h2>Description</h2><p>A <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a> 
is an object that holds an animation. An animation is conceptually a series
of frames to be displayed over time. Each frame is the same size. The
animation may not be represented as a series of frames internally; for
example, it may be stored as a sprite and instructions for moving the sprite
around a background. To display an animation you don't need to understand
its representation, you just ask a <a href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"><tt class="classname">gtk.gdk.PixbufAnimationIter</tt></a> 
for the next frame that should be displayed at a given point in time.</p></div><div class="refsect1" lang="en"><a name="constructor-gdkpixbufanimation"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.gdk.PixbufAnimation</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>filename</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>filename</tt></b>:</span></td><td>the name of the file to
load.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a>
	object.</td></tr></tbody></table><p>Creates a new <a href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"><tt class="classname">gtk.gdk.PixbufAnimation</tt></a> 
by loading it from a file. The file format is detected automatically. If the
file's format does not support multi-frame images, then an animation with a
single frame will be created.</p><p>This constructor raises the GError exception if any of several
error conditions occurred: the file could not be opened, there was no loader
for the file's format, there was not enough memory to allocate the image
buffer, or the image file contained invalid data.</p></div><div class="refsect1" lang="en"><a name="id3027903"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gdkpixbufanimation--get-width"></a><h3>gtk.gdk.PixbufAnimation.get_width</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_width</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the width of the bounding box of the
animation.</td></tr></tbody></table><p>The <tt class="methodname">get_width</tt>() method returns the
width of the bounding box of a pixbuf animation.</p></div><div class="refsect2" lang="en"><a name="method-gdkpixbufanimation--get-height"></a><h3>gtk.gdk.PixbufAnimation.get_height</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_height</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the height of the bounding box of the
animation.</td></tr></tbody></table><p>The <tt class="methodname">get_height</tt>() method returns the
height of the bounding box of a pixbuf animation.</p></div><div class="refsect2" lang="en"><a name="method-gdkpixbufanimation--is-static-image"></a><h3>gtk.gdk.PixbufAnimation.is_static_image</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">is_static_image</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the "animation" was
really just an image</td></tr></tbody></table><p>The <tt class="methodname">is_static_image</tt>() method returns
TRUE if you load a file containing a plain, unanimated image. Use the <a href="class-gdkpixbufanimation.html#method-gdkpixbufanimation--get-static-image" title="gtk.gdk.PixbufAnimation.get_static_image"><tt class="methodname">get_static_image</tt>()</a> 
method to retrieve the image.</p></div><div class="refsect2" lang="en"><a name="method-gdkpixbufanimation--get-static-image"></a><h3>gtk.gdk.PixbufAnimation.get_static_image</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_static_image</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the unanimated image representing the
animation</td></tr></tbody></table><p>The <tt class="methodname">get_static_image</tt>() method returns a
<a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a>
that represents a static image of the animation. If the animation is really
just a plain image (has only one frame), this method returns that image. If
the animation is an animation, this method returns a reasonable thing to
display as a static unanimated image, which might be the first frame, or
something more sophisticated. If an animation hasn't loaded any frames yet,
this method will return <tt class="literal">None</tt>.</p></div><div class="refsect2" lang="en"><a name="method-gdkpixbufanimation--get-iter"></a><h3>gtk.gdk.PixbufAnimation.get_iter</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_iter</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>start_time</tt></b></span><span class="initializer">=0.0</span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>start_time</tt></b>:</span></td><td>the time when the animation starts
playing</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a <a href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"><tt class="classname">gtk.gdk.PixbufAnimationIter</tt></a> 
object</td></tr></tbody></table><p>The <tt class="methodname">get_iter</tt>() method returns a <a href="class-gdkpixbufanimationiter.html" title="gtk.gdk.PixbufAnimationIter"><tt class="classname">gtk.gdk.PixbufAnimationIter</tt></a> 
that is used to access the frames of the animation. The iterator provides
the frames that should be displayed at specific times.
<i class="parameter"><tt>start_time</tt></i> is the start time specified as a float as
output from the Python time.time() function.
<i class="parameter"><tt>start_time</tt></i> marks the beginning of the animation
playback. After creating an iterator, you should immediately display the
pixbuf returned by the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-pixbuf" title="gtk.gdk.PixbufAnimationIter.get_pixbuf"><tt class="methodname">gtk.gdk.PixbufAnimationIter.get_pixbuf</tt>()</a> 
method. Then, you should install a timeout (with the <a href="gobject-functions.html#function-gobject--timeout-add" title="gobject.timeout_add"><tt class="methodname">gobject.timeout_add</tt>()</a>() 
function) or by some other mechanism ensure that you'll update the image
after the number of  milliseconds specified by the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-delay-time" title="gtk.gdk.PixbufAnimationIter.get_delay_time"><tt class="methodname">gtk.gdk.PixbufAnimationIter.get_delay_time</tt>()</a> 
method. Each time the image is updated, you should reinstall the timeout
with the new, possibly-changed delay time. As a shortcut, if
<i class="parameter"><tt>start_time</tt></i> is 0.0 (the default), the current time
will be used.</p><p>To update the image (i.e. possibly change the result of the
<a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--get-pixbuf" title="gtk.gdk.PixbufAnimationIter.get_pixbuf"><tt class="methodname">gtk.gdk.PixbufAnimationIter.get_pixbuf</tt>()</a> 
method to a new frame of the animation), call the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--advance" title="gtk.gdk.PixbufAnimationIter.advance"><tt class="methodname">gtk.gdk.PixbufAnimationIter.advance</tt>()</a> 
method.</p><p>If you're using a <a href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><tt class="classname">gtk.gdk.PixbufLoader</tt></a>, 
in addition to updating the image after the delay time, you should also
update it whenever you receive the "area_updated" signal and the <a href="class-gdkpixbufanimationiter.html#method-gdkpixbufanimationiter--on-currently-loading-frame" title="gtk.gdk.PixbufAnimationIter.on_currently_loading_frame"><tt class="methodname">gtk.gdk.PixbufAnimationIter.on_currently_loading_frame</tt>()</a> 
method returns <tt class="literal">TRUE</tt>. In this case, the frame currently
being fed into the loader has received new data, so needs to be refreshed.
The delay time for a frame may also be modified after an "area_updated"
signal, for example if the delay time for a frame is encoded in the data
after the frame itself. So your timeout should be reinstalled after any
area_updated signal. A delay time of -1 is possible, indicating
"infinite."</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gdkpixbuf.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gdk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gdkpixbufanimationiter.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.gdk.Pixbuf</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.gdk.PixbufAnimationIter</td></tr></table></div></body></html>