File: //usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-animation.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Animations</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="The gdk-pixbuf Library">
<link rel="up" href="rn01.html" title="API Reference">
<link rel="prev" href="gdk-pixbuf-util.html" title="Utilities">
<link rel="next" href="GdkPixbufLoader.html" title="GdkPixbufLoader">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="rn01.html" title="API Reference">
<link rel="reference" href="rn02.html" title="Tools Reference">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="appendix" href="apa.html" title="Appendix A. Porting applications from Imlib to gdk-pixbuf">
<link rel="appendix" href="license.html" title="Appendix B. License">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-util.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">The <span class="application">gdk-pixbuf</span> Library</th>
<td><a accesskey="n" href="GdkPixbufLoader.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3119432" class="shortcut">Top</a>
 | 
<a href="#id3119902" class="shortcut">Description</a>
 | 
<a href="#id3119864" class="shortcut">Object Hierarchy</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-pixbuf-animation"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3119432"></a><span class="refentrytitle">Animations</span>
</h2>
<p>Animations — Animated images.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<a name="GdkPixbufAnimation"></a><a name="GdkPixbufAnimationIter"></a><pre class="synopsis">
#include <gdk-pixbuf/gdk-pixbuf.h>
<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation-struct">GdkPixbufAnimation</a>;
<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter-struct">GdkPixbufAnimationIter</a>;
<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a>* <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-new-from-file">gdk_pixbuf_animation_new_from_file</a>
(const char *filename,
<a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);
<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a>* <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-ref">gdk_pixbuf_animation_ref</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);
void <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-unref">gdk_pixbuf_animation_unref</a> (<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);
int <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-width">gdk_pixbuf_animation_get_width</a> (<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);
int <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-height">gdk_pixbuf_animation_get_height</a> (<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);
<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a>* <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-iter">gdk_pixbuf_animation_get_iter</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation,
const <a
href="../glib/glib-Date-and-Time-Functions.html#GTimeVal"
>GTimeVal</a> *start_time);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-is-static-image">gdk_pixbuf_animation_is_static_image</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-static-image">gdk_pixbuf_animation_get_static_image</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-advance">gdk_pixbuf_animation_iter_advance</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter,
const <a
href="../glib/glib-Date-and-Time-Functions.html#GTimeVal"
>GTimeVal</a> *current_time);
int <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-get-delay-time">gdk_pixbuf_animation_iter_get_delay_time</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-on-currently-loading-frame">gdk_pixbuf_animation_iter_on_currently_loading_frame</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter);
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-get-pixbuf">gdk_pixbuf_animation_iter_get_pixbuf</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter);
<a href="gdk-pixbuf-animation.html#GdkPixbufSimpleAnim">GdkPixbufSimpleAnim</a>;
<a href="gdk-pixbuf-animation.html#GdkPixbufSimpleAnim">GdkPixbufSimpleAnim</a>* <a href="gdk-pixbuf-animation.html#gdk-pixbuf-simple-anim-new">gdk_pixbuf_simple_anim_new</a>
(<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a
href="../glib/glib-Basic-Types.html#gfloat"
>gfloat</a> rate);
void <a href="gdk-pixbuf-animation.html#gdk-pixbuf-simple-anim-add-frame">gdk_pixbuf_simple_anim_add_frame</a>
(<a href="gdk-pixbuf-animation.html#GdkPixbufSimpleAnim">GdkPixbufSimpleAnim</a> *animation,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3119864"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
<a
href="../gobject/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
+----GdkPixbufAnimation
</pre>
<pre class="synopsis">
<a
href="../gobject/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
+----GdkPixbufAnimationIter
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3119902"></a><h2>Description</h2>
<p>
The <span class="application">gdk-pixbuf</span> library provides a simple mechanism to load and represent
animations. 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, however; you just
ask <span class="application">gdk-pixbuf</span> what should be displayed at a given point in time.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3119937"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3119947"></a><h3>
<a name="GdkPixbufAnimation-struct"></a>GdkPixbufAnimation</h3>
<a class="indexterm" name="id3119961"></a><pre class="programlisting">typedef struct _GdkPixbufAnimation GdkPixbufAnimation;</pre>
<p>
And opaque struct representing an animation.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3119977"></a><h3>
<a name="GdkPixbufAnimationIter-struct"></a>GdkPixbufAnimationIter</h3>
<a class="indexterm" name="id3119990"></a><pre class="programlisting">typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;</pre>
<p>
And opaque struct representing an iterator which points to a
certain position in an animation.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120008"></a><h3>
<a name="gdk-pixbuf-animation-new-from-file"></a>gdk_pixbuf_animation_new_from_file ()</h3>
<a class="indexterm" name="id3120022"></a><pre class="programlisting"><a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a>* gdk_pixbuf_animation_new_from_file
(const char *filename,
<a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);</pre>
<p>
Creates a new animation 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. Possible errors
are in the <a href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR:CAPS"><span class="type">GDK_PIXBUF_ERROR</span></a> and <a
href="../glib/glib-File-Utilities.html#G-FILE-ERROR:CAPS"
><span class="type">G_FILE_ERROR</span></a> domains.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em> :</span></td>
<td> Name of file to load, in the GLib file name encoding
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em> :</span></td>
<td> return location for error
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> A newly-created animation with a reference count of 1, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
if any of several error conditions ocurred: 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.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120140"></a><h3>
<a name="gdk-pixbuf-animation-ref"></a>gdk_pixbuf_animation_ref ()</h3>
<a class="indexterm" name="id3120156"></a><pre class="programlisting"><a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a>* gdk_pixbuf_animation_ref
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_pixbuf_animation_ref</code> is deprecated and should not be used in newly-written code. Use <a
href="../gobject/gobject-The-Base-Object-Type.html#g-object-ref"
><code class="function">g_object_ref()</code></a>.</p>
</div>
<p>
Adds a reference to an animation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> An animation.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The same as the <em class="parameter"><code>animation</code></em> argument.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120248"></a><h3>
<a name="gdk-pixbuf-animation-unref"></a>gdk_pixbuf_animation_unref ()</h3>
<a class="indexterm" name="id3120264"></a><pre class="programlisting">void gdk_pixbuf_animation_unref (<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_pixbuf_animation_unref</code> is deprecated and should not be used in newly-written code. Use <a
href="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"
><code class="function">g_object_unref()</code></a>.</p>
</div>
<p>
Removes a reference from an animation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> An animation.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120337"></a><h3>
<a name="gdk-pixbuf-animation-get-width"></a>gdk_pixbuf_animation_get_width ()</h3>
<a class="indexterm" name="id3120351"></a><pre class="programlisting">int gdk_pixbuf_animation_get_width (<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);</pre>
<p>
Queries the width of the bounding box of a pixbuf animation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> An animation.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> Width of the bounding box of the animation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120413"></a><h3>
<a name="gdk-pixbuf-animation-get-height"></a>gdk_pixbuf_animation_get_height ()</h3>
<a class="indexterm" name="id3120426"></a><pre class="programlisting">int gdk_pixbuf_animation_get_height (<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);</pre>
<p>
Queries the height of the bounding box of a pixbuf animation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> An animation.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> Height of the bounding box of the animation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120488"></a><h3>
<a name="gdk-pixbuf-animation-get-iter"></a>gdk_pixbuf_animation_get_iter ()</h3>
<a class="indexterm" name="id3120501"></a><pre class="programlisting"><a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a>* gdk_pixbuf_animation_get_iter
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation,
const <a
href="../glib/glib-Date-and-Time-Functions.html#GTimeVal"
>GTimeVal</a> *start_time);</pre>
<p>
Get an iterator for displaying an animation. The iterator provides
the frames that should be displayed at a given time.
It should be freed after use with <a
href="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"
><code class="function">g_object_unref()</code></a>.
</p>
<p>
<em class="parameter"><code>start_time</code></em> would normally come from <a
href="../glib/glib-Date-and-Time-Functions.html#g-get-current-time"
><code class="function">g_get_current_time()</code></a>, and
marks the beginning of animation playback. After creating an
iterator, you should immediately display the pixbuf returned by
<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-get-pixbuf"><code class="function">gdk_pixbuf_animation_iter_get_pixbuf()</code></a>. Then, you should install a
timeout (with <a
href="../glib/glib-The-Main-Event-Loop.html#g-timeout-add"
><code class="function">g_timeout_add()</code></a>) or by some other mechanism ensure
that you'll update the image after
<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-get-delay-time"><code class="function">gdk_pixbuf_animation_iter_get_delay_time()</code></a> milliseconds. Each time
the image is updated, you should reinstall the timeout with the new,
possibly-changed delay time.
</p>
<p>
As a shortcut, if <em class="parameter"><code>start_time</code></em> is <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>, the result of
<a
href="../glib/glib-Date-and-Time-Functions.html#g-get-current-time"
><code class="function">g_get_current_time()</code></a> will be used automatically.
</p>
<p>
To update the image (i.e. possibly change the result of
<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-get-pixbuf"><code class="function">gdk_pixbuf_animation_iter_get_pixbuf()</code></a> to a new frame of the animation),
call <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-advance"><code class="function">gdk_pixbuf_animation_iter_advance()</code></a>.
</p>
<p>
If you're using <a href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a>, in addition to updating the image
after the delay time, you should also update it whenever you
receive the area_updated signal and
<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-on-currently-loading-frame"><code class="function">gdk_pixbuf_animation_iter_on_currently_loading_frame()</code></a> returns
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>. 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.
</p>
<p>
A delay time of -1 is possible, indicating "infinite."</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-animation.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>start_time</code></em> :</span></td>
<td> time when the animation starts playing
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> an iterator to move over the animation
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120775"></a><h3>
<a name="gdk-pixbuf-animation-is-static-image"></a>gdk_pixbuf_animation_is_static_image ()</h3>
<a class="indexterm" name="id3120789"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_pixbuf_animation_is_static_image
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);</pre>
<p>
If you load a file with <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-new-from-file"><code class="function">gdk_pixbuf_animation_new_from_file()</code></a> and it turns
out to be a plain, unanimated image, then this function will return
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>. Use <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-static-image"><code class="function">gdk_pixbuf_animation_get_static_image()</code></a> to retrieve
the image.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-animation.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the "animation" was really just an image
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3120906"></a><h3>
<a name="gdk-pixbuf-animation-get-static-image"></a>gdk_pixbuf_animation_get_static_image ()</h3>
<a class="indexterm" name="id3120920"></a><pre class="programlisting"><a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* gdk_pixbuf_animation_get_static_image
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimation">GdkPixbufAnimation</a> *animation);</pre>
<p>
If an animation is really just a plain image (has only one frame),
this function returns that image. If the animation is an animation,
this function 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
function will return <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-animation.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> unanimated image representing the animation
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3121006"></a><h3>
<a name="gdk-pixbuf-animation-iter-advance"></a>gdk_pixbuf_animation_iter_advance ()</h3>
<a class="indexterm" name="id3121020"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_pixbuf_animation_iter_advance
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter,
const <a
href="../glib/glib-Date-and-Time-Functions.html#GTimeVal"
>GTimeVal</a> *current_time);</pre>
<p>
Possibly advances an animation to a new frame. Chooses the frame based
on the start time passed to <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-iter"><code class="function">gdk_pixbuf_animation_get_iter()</code></a>.
</p>
<p>
<em class="parameter"><code>current_time</code></em> would normally come from <a
href="../glib/glib-Date-and-Time-Functions.html#g-get-current-time"
><code class="function">g_get_current_time()</code></a>, and
must be greater than or equal to the time passed to
<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-iter"><code class="function">gdk_pixbuf_animation_get_iter()</code></a>, and must increase or remain
unchanged each time <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-get-pixbuf"><code class="function">gdk_pixbuf_animation_iter_get_pixbuf()</code></a> is
called. That is, you can't go backward in time; animations only
play forward.
</p>
<p>
As a shortcut, pass <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> for the current time and <a
href="../glib/glib-Date-and-Time-Functions.html#g-get-current-time"
><code class="function">g_get_current_time()</code></a>
will be invoked on your behalf. So you only need to explicitly pass
<em class="parameter"><code>current_time</code></em> if you're doing something odd like playing the animation
at double speed.
</p>
<p>
If this function returns <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a>, there's no need to update the animation
display, assuming the display had been rendered prior to advancing;
if <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, you need to call <code class="function">gdk_animation_iter_get_pixbuf()</code> and update the
display with the new pixbuf.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>iter</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter"><span class="type">GdkPixbufAnimationIter</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>current_time</code></em> :</span></td>
<td> current time
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the image may need updating
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3121254"></a><h3>
<a name="gdk-pixbuf-animation-iter-get-delay-time"></a>gdk_pixbuf_animation_iter_get_delay_time ()</h3>
<a class="indexterm" name="id3121267"></a><pre class="programlisting">int gdk_pixbuf_animation_iter_get_delay_time
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter);</pre>
<p>
Gets the number of milliseconds the current pixbuf should be displayed,
or -1 if the current pixbuf should be displayed forever. <a
href="../glib/glib-The-Main-Event-Loop.html#g-timeout-add"
><code class="function">g_timeout_add()</code></a>
conveniently takes a timeout in milliseconds, so you can use a timeout
to schedule the next update.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>iter</code></em> :</span></td>
<td> an animation iterator
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> delay time in milliseconds (thousandths of a second)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3121344"></a><h3>
<a name="gdk-pixbuf-animation-iter-on-currently-loading-frame"></a>gdk_pixbuf_animation_iter_on_currently_loading_frame ()</h3>
<a class="indexterm" name="id3121359"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_pixbuf_animation_iter_on_currently_loading_frame
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter);</pre>
<p>
Used to determine how to respond to the area_updated signal on
<a href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> when loading an animation. area_updated is emitted
for an area of the frame currently streaming in to the loader. So if
you're on the currently loading frame, you need to redraw the screen for
the updated area.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>iter</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter"><span class="type">GdkPixbufAnimationIter</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the frame we're on is partially loaded, or the last frame
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3121454"></a><h3>
<a name="gdk-pixbuf-animation-iter-get-pixbuf"></a>gdk_pixbuf_animation_iter_get_pixbuf ()</h3>
<a class="indexterm" name="id3121467"></a><pre class="programlisting"><a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* gdk_pixbuf_animation_iter_get_pixbuf
(<a href="gdk-pixbuf-animation.html#GdkPixbufAnimationIter">GdkPixbufAnimationIter</a> *iter);</pre>
<p>
Gets the current pixbuf which should be displayed; the pixbuf will
be the same size as the animation itself
(<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-width"><code class="function">gdk_pixbuf_animation_get_width()</code></a>, <a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-get-height"><code class="function">gdk_pixbuf_animation_get_height()</code></a>).
This pixbuf should be displayed for
<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-get-delay-time"><code class="function">gdk_pixbuf_animation_iter_get_delay_time()</code></a> milliseconds. The caller
of this function does not own a reference to the returned pixbuf;
the returned pixbuf will become invalid when the iterator advances
to the next frame, which may happen anytime you call
<a href="gdk-pixbuf-animation.html#gdk-pixbuf-animation-iter-advance"><code class="function">gdk_pixbuf_animation_iter_advance()</code></a>. Copy the pixbuf to keep it
(don't just add a reference), as it may get recycled as you advance
the iterator.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>iter</code></em> :</span></td>
<td> an animation iterator
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the pixbuf to be displayed
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3121583"></a><h3>
<a name="GdkPixbufSimpleAnim"></a>GdkPixbufSimpleAnim</h3>
<a class="indexterm" name="id3121596"></a><pre class="programlisting">typedef struct _GdkPixbufSimpleAnim GdkPixbufSimpleAnim;</pre>
<p>
An
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3121612"></a><h3>
<a name="gdk-pixbuf-simple-anim-new"></a>gdk_pixbuf_simple_anim_new ()</h3>
<a class="indexterm" name="id3121628"></a><pre class="programlisting"><a href="gdk-pixbuf-animation.html#GdkPixbufSimpleAnim">GdkPixbufSimpleAnim</a>* gdk_pixbuf_simple_anim_new
(<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a
href="../glib/glib-Basic-Types.html#gfloat"
>gfloat</a> rate);</pre>
<p>
Creates a new, empty animation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> the width of the animation
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> the height of the animation
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rate</code></em> :</span></td>
<td> the speed of the animation, in frames per second
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a newly allocated <a href="gdk-pixbuf-animation.html#GdkPixbufSimpleAnim"><span class="type">GdkPixbufSimpleAnim</span></a>
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3121746"></a><h3>
<a name="gdk-pixbuf-simple-anim-add-frame"></a>gdk_pixbuf_simple_anim_add_frame ()</h3>
<a class="indexterm" name="id3121761"></a><pre class="programlisting">void gdk_pixbuf_simple_anim_add_frame
(<a href="gdk-pixbuf-animation.html#GdkPixbufSimpleAnim">GdkPixbufSimpleAnim</a> *animation,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf);</pre>
<p>
Adds a new frame to <em class="parameter"><code>animation</code></em>. The <em class="parameter"><code>pixbuf</code></em> must
have the dimensions specified when the animation
was constructed.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>animation</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-animation.html#GdkPixbufSimpleAnim"><span class="type">GdkPixbufSimpleAnim</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></td>
<td> the pixbuf to add
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.8
</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3121861"></a><h2>See Also</h2>
<p>
<a href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a>
</p>
</div>
</div>
</body>
</html>