Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gdk::PixbufAnimationIter Class Reference

A GdkPixbufAnimationIter C++ wrapper class. More...

`#include <inti/gdk-pixbuf/pixbuf-animation.h>`

Inheritance diagram for Inti::Gdk::PixbufAnimationIter:

List of all members.

## Public Member Functions

Constructors

- virtual ~PixbufAnimationIter ()
    Destructor.

Accessors

- GdkPixbufAnimationIter * gdk_pixbuf_animation_iter () const
    Get a pointer to the GdkPixbufAnimationIter structure.
- operator GdkPixbufAnimationIter * () const
    Conversion operator; safely converts a PixbufAnimationIter to a GdkPixbufAnimationIter pointer.
- int get_delay_time () const
    Gets the number of milliseconds the current pixbuf should be displayed, or -1 if the current pixbuf should be displayed forever.
- Pixbuf * get_pixbuf () const
    Gets the current pixbuf which should be displayed; the pixbuf will be the same size as the animation itself (Gdk::PixbufAnimation::get_width(), Gdk::PixbufAnimation::get_height()).
- bool on_currently_loading_frame () const
    Used to determine how to respond to the area_updated signal on PixbufLoader when loading an animation.

Methods

- bool advance (const GTimeVal *current_time=0)
    Possibly advances an animation to a new frame.

## Protected Member Functions

Constructors

- PixbufAnimationIter (GdkPixbufAnimationIter *iter, bool reference=true)
    Construct a new PixbufAnimationIter from an existing GdkPixbufAnimationIter.

## Detailed Description

A GdkPixbufAnimationIter C++ wrapper class.

PixbufAnimationIter provides the necessary functionality to display an animation by providing the frames that should be displayed at a given time.

## Constructor & Destructor Documentation

Inti::Gdk::PixbufAnimationIter::PixbufAnimationIter | ( | GdkPixbufAnimationIter * | iter,
|  | bool | reference = true
| ) | `[explicit, protected]`

Construct a new PixbufAnimationIter from an existing GdkPixbufAnimationIter.

Parameters:

  iter | A pointer to a GdkPixbufAnimationIter.
  reference | Set false if the initial reference count is floating, set true if it's not.

The iter can be a newly created GdkPixbufAnimationIter or an existing GdkPixbufAnimationIter. (see G::Object::Object).

## Member Function Documentation

bool Inti::Gdk::PixbufAnimationIter::advance | ( | const GTimeVal * | current_time = 0 | ) |

Possibly advances an animation to a new frame.

Chooses the frame based on the start time passed to Gdk::PixbufAnimation::get_iter().

Parameters:

  current_time | The current time, or null to automatically use the result of g_get_current_time().

Returns:
  true if the image may need updating.

The current_time would normally come from g_get_current_time(), and must be greater than or equal to the time passed to Gdk::PixbufAnimation::get_iter(), and must increase or remain unchanged each time get_pixbuf() is called. That is, you can't go backward in time; animations only play forward. As a shortcut, pass null for the current time and g_get_current_time() will be invoked on your behalf. So you only need to explicitly pass current_time if you're doing something odd like playing the animation at double speed.

If this method returns false, there's no need to update the animation display, assuming the display had been rendered prior to advancing; if true, you need to call get_pixbuf() and update the display with the new pixbuf.

int Inti::Gdk::PixbufAnimationIter::get_delay_time | ( |  | ) | const

Gets the number of milliseconds the current pixbuf should be displayed, or -1 if the current pixbuf should be displayed forever.

Returns:
  The delay time in milliseconds (thousandths of a second).

g_timeout_add() conveniently takes a timeout in milliseconds, so you can use a timeout to schedule the next update.

Pixbuf* Inti::Gdk::PixbufAnimationIter::get_pixbuf | ( |  | ) | const

Gets the current pixbuf which should be displayed; the pixbuf will be the same size as the animation itself (Gdk::PixbufAnimation::get_width(), Gdk::PixbufAnimation::get_height()).

Returns:
  The pixbuf to be displayed.

This pixbuf should be displayed for Gdk::PixbufAnimation::get_delay_time() 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 advance(). Copy the pixbuf to keep it (don't just add a reference), as it may get recycled as you advance the iterator.

bool Inti::Gdk::PixbufAnimationIter::on_currently_loading_frame | ( |  | ) | const

Used to determine how to respond to the area_updated signal on PixbufLoader when loading an animation.

Returns:
  true if the frame we're on is partially loaded, or the last frame.

The area_updated signal 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.

The documentation for this class was generated from the following file:

- pixbuf-animation.h

Main Page - Footer