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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gdkpixbufanimation">
<refnamediv>
<refname>gtk.gdk.PixbufAnimation</refname>
<refpurpose>an object holding an animation</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gtk.gdk.PixbufAnimation</classname></ooclass>
<ooclass><classname><link
linkend="class-gobject">gobject.GObject</link></classname></ooclass>
<constructorsynopsis language="python">
<methodname><link
linkend="constructor-gdkpixbufanimation">gtk.gdk.PixbufAnimation</link></methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
</constructorsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbufanimation--get-width">get_width</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbufanimation--get-height">get_height</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbufanimation--is-static-image">is_static_image</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbufanimation--get-static-image">get_static_image</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbufanimation--get-iter">get_iter</link></methodname>
<methodparam><parameter role="keyword">start_time</parameter>
<initializer>0.0</initializer></methodparam>
</methodsynopsis>
</classsynopsis>
</refsect1>
<refsect1>
<title>Ancestry</title>
<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
+-- <link linkend="class-gdkpixbufanimation">gtk.gdk.PixbufAnimation</link>
</synopsis>
</refsect1>
<refsect1>
<title>Description</title>
<para>A <link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link>
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 <link
linkend="class-gdkpixbufanimationiter"><classname>gtk.gdk.PixbufAnimationIter</classname></link>
for the next frame that should be displayed at a given point in time.</para>
</refsect1>
<refsect1 id="constructor-gdkpixbufanimation">
<title>Constructor</title>
<programlisting><constructorsynopsis language="python">
<methodname>gtk.gdk.PixbufAnimation</methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
</constructorsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">filename</parameter> :</term>
<listitem><simpara>the name of the file to
load.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link>
object.</simpara></listitem>
</varlistentry>
</variablelist>
<para>Creates a new <link
linkend="class-gdkpixbufanimation"><classname>gtk.gdk.PixbufAnimation</classname></link>
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.</para>
<para>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.</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gdkpixbufanimation--get-width">
<title>gtk.gdk.PixbufAnimation.get_width</title>
<programlisting><methodsynopsis language="python">
<methodname>get_width</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the width of the bounding box of the
animation.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_width</methodname>() method returns the
width of the bounding box of a pixbuf animation.</para>
</refsect2>
<refsect2 id="method-gdkpixbufanimation--get-height">
<title>gtk.gdk.PixbufAnimation.get_height</title>
<programlisting><methodsynopsis language="python">
<methodname>get_height</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the height of the bounding box of the
animation.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_height</methodname>() method returns the
height of the bounding box of a pixbuf animation.</para>
</refsect2>
<refsect2 id="method-gdkpixbufanimation--is-static-image">
<title>gtk.gdk.PixbufAnimation.is_static_image</title>
<programlisting><methodsynopsis language="python">
<methodname>is_static_image</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara><literal>True</literal> if the "animation" was
really just an image</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>is_static_image</methodname>() method returns
True if you load a file containing a plain, unanimated image. Use the <link
linkend="method-gdkpixbufanimation--get-static-image"><methodname>get_static_image</methodname>()</link>
method to retrieve the image.</para>
</refsect2>
<refsect2 id="method-gdkpixbufanimation--get-static-image">
<title>gtk.gdk.PixbufAnimation.get_static_image</title>
<programlisting><methodsynopsis language="python">
<methodname>get_static_image</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the unanimated image representing the
animation</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_static_image</methodname>() method returns a
<link linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
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 <literal>None</literal>.</para>
</refsect2>
<refsect2 id="method-gdkpixbufanimation--get-iter">
<title>gtk.gdk.PixbufAnimation.get_iter</title>
<programlisting><methodsynopsis language="python">
<methodname>get_iter</methodname>
<methodparam><parameter role="keyword">start_time</parameter>
<initializer>0.0</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter
role="keyword">start_time</parameter> :</term>
<listitem><simpara>the time when the animation starts
playing</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixbufanimationiter"><classname>gtk.gdk.PixbufAnimationIter</classname></link>
object</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_iter</methodname>() method returns a <link
linkend="class-gdkpixbufanimationiter"><classname>gtk.gdk.PixbufAnimationIter</classname></link>
that is used to access the frames of the animation. The iterator provides
the frames that should be displayed at specific times.
<parameter>start_time</parameter> is the start time specified as a float as
output from the Python time.time() function.
<parameter>start_time</parameter> marks the beginning of the animation
playback. After creating an iterator, you should immediately display the
pixbuf returned by the <link
linkend="method-gdkpixbufanimationiter--get-pixbuf"><methodname>gtk.gdk.PixbufAnimationIter.get_pixbuf</methodname>()</link>
method. Then, you should install a timeout (with the <link
linkend="function-gobject--timeout-add"><methodname>gobject.timeout_add</methodname>()</link>()
function) or by some other mechanism ensure that you'll update the image
after the number of milliseconds specified by the <link
linkend="method-gdkpixbufanimationiter--get-delay-time"><methodname>gtk.gdk.PixbufAnimationIter.get_delay_time</methodname>()</link>
method. Each time the image is updated, you should reinstall the timeout
with the new, possibly-changed delay time. As a shortcut, if
<parameter>start_time</parameter> is 0.0 (the default), the current time
will be used.</para>
<para>To update the image (i.e. possibly change the result of the
<link
linkend="method-gdkpixbufanimationiter--get-pixbuf"><methodname>gtk.gdk.PixbufAnimationIter.get_pixbuf</methodname>()</link>
method to a new frame of the animation), call the <link
linkend="method-gdkpixbufanimationiter--advance"><methodname>gtk.gdk.PixbufAnimationIter.advance</methodname>()</link>
method.</para>
<para>If you're using a <link
linkend="class-gdkpixbufloader"><classname>gtk.gdk.PixbufLoader</classname></link>,
in addition to updating the image after the delay time, you should also
update it whenever you receive the "area_updated" signal and the <link
linkend="method-gdkpixbufanimationiter--on-currently-loading-frame"><methodname>gtk.gdk.PixbufAnimationIter.on_currently_loading_frame</methodname>()</link>
method returns <literal>True</literal>. 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."</para>
</refsect2>
</refsect1>
</refentry>
|