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.
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 exceptions are in the Gdk::PixbufError and GLib::FileError?.
- filename: Name of file to load.
- Returns: A newly-created Gdk::PixbufAnimation, or nil 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.
- Returns: self
Queries the width of the bounding box of a pixbuf animation.
- Returns: Width of the bounding box of the animation.
Queries the height of the bounding box of a pixbuf animation.
- Returns : Height of the bounding box of the animation.
get_iter(start_time_sec = nil, start_time_usec = nil)
- Get an iterator for displaying an animation. The iterator provides the frames that should be displayed at a given time. start_time_src and start_time_usec would normally come from GLib.current_time, and marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned by Gdk::PixbufAnimationIter#pixbuf. Then, you should install a timeout (with GLib.timeout_add) or by some other mechanism ensure that you'll update the image after Gdk::PixbufAnimationIter#delay_time milliseconds. Each time the image is updated, you should reinstall the timeout with the new, possibly-changed delay time. As a shortcut, if both of start_time_sec and start_time_usec are nil, the result of GLib.current_time will be used automatically. To update the image (i.e. possibly change the result of Gdk::PixbufAnimationIter#pixbuf to a new frame of the animation), call Gdk::PixbufAnimationIter#advance. If you're using Gdk::PixbufLoader, in addition to updating the image after the delay time, you should also update it whenever you receive the area_updated signal and Gdk::PixbufAnimationIter#on_currently_loading_frame? returns true. 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."
If you load a file with Gdk::PixbufAnimation.new and it turns out to be a plain, unanimated image, then this method will return true. Use Gdk::PixbufAnimation#static_image to retrieve the image.
- Returns: true if the "animation" was really just an image
If an 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 nil.
- Returns: unanimated image(Gdk::Pixbuf) representing the animation