Next: , Previous: Utilities, Up: Top


34 Animations

Animated images.

34.1 Overview

The gdk-pixbuf 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 gdk-pixbuf what should be displayed at a given point in time.

34.2 Usage

— Class: <gdk-pixbuf-animation>

Derives from <gobject>.

This class defines no direct slots.

— Class: <gdk-pixbuf-animation-iter>

Derives from <gobject>.

This class defines no direct slots.

— Class: <gdk-pixbuf-simple-anim>

Derives from <gdk-pixbuf-animation>.

This class defines no direct slots.

— Function: gdk-pixbuf-animation-new-from-file (filename mchars) ⇒  (ret <gdk-pixbuf-animation>)

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 <gdk-pixbuf-error> and <g-file-error> domains.

filename
Name of file to load, in the GLib file name encoding
error
return location for error
ret
A newly-created animation with a reference count of 1, or ‘#f’ 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.
— Function: gdk-pixbuf-animation-get-width (self <gdk-pixbuf-animation>) ⇒  (ret int)
— Method: get-width

Queries the width of the bounding box of a pixbuf animation.

animation
An animation.
ret
Width of the bounding box of the animation.
— Function: gdk-pixbuf-animation-get-height (self <gdk-pixbuf-animation>) ⇒  (ret int)
— Method: get-height

Queries the height of the bounding box of a pixbuf animation.

animation
An animation.
ret
Height of the bounding box of the animation.
— Function: gdk-pixbuf-simple-anim-new (width int) (height int) (rate float) ⇒  (ret <gdk-pixbuf-simple-anim>)

Creates a new, empty animation.

width
the width of the animation
height
the height of the animation
rate
the speed of the animation, in frames per second
ret
a newly allocated <gdk-pixbuf-simple-anim>

Since 2.8

— Function: gdk-pixbuf-simple-anim-add-frame (self <gdk-pixbuf-simple-anim>) (pixbuf <gdk-pixbuf>)
— Method: add-frame

Adds a new frame to animation. The pixbuf must have the dimensions specified when the animation was constructed.

animation
a <gdk-pixbuf-simple-anim>
pixbuf
the pixbuf to add

Since 2.8