org.gnu.gdk
Class PixbufAnimation

java.lang.Object
  extended by org.gnu.glib.Struct
      extended by org.gnu.glib.GObject
          extended by org.gnu.gdk.PixbufAnimation

public class PixbufAnimation
extends GObject

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 this class what should be displayed at a given point in time.


Constructor Summary
PixbufAnimation(org.gnu.glib.Handle handle)
          Create a new pixbuf from a handle to a native resource.
PixbufAnimation(java.lang.String filename)
          Construct a new Pixbuf animation by loading it from a file.
 
Method Summary
 PixbufAnimationIter getIter(long startSec, long startUsec)
          Get an iterator for displaying an animation.
 Pixbuf getStaticImage()
          If an animation is really just a plain image (has only one frame), this method returns that image.
 int height()
          Return the height of the bounding box of a pixbuf animation.
 boolean isStaticImage()
          If this animation was loaded from a that turns out to be a plain unaminated image then this method will return true.
 int width()
          Return the width of the bounding box of a pixbuf animation.
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify
 
Methods inherited from class org.gnu.glib.Struct
equals, getHandle, getNullHandle, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PixbufAnimation

public PixbufAnimation(java.lang.String filename)
                throws JGException
Construct a new Pixbuf animation by loading it from a file. The file format is detected automatically. If the files format does not support multi-frame images then an animation with a single frame will be created.

Parameters:
filename - The name of the image file.
Throws:
JGException

PixbufAnimation

public PixbufAnimation(org.gnu.glib.Handle handle)
Create a new pixbuf from a handle to a native resource. For internal use.

Parameters:
handle - The handle to the native resoufce
Method Detail

width

public int width()
Return the width of the bounding box of a pixbuf animation.

Returns:
The width

height

public int height()
Return the height of the bounding box of a pixbuf animation.

Returns:
The height

getIter

public PixbufAnimationIter getIter(long startSec,
                                   long startUsec)
Get an iterator for displaying an animation. The iterator provides the frames that should be displayed at a given time.

The start time marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned by the getPixbuf() method of PixbufAnimationIter. Then, you should install a timeout by some mechanism to ensure that you'll update the image after the delay time. Each time the image is updated, you should reinstall the timeout with the new, possibly-changed delay time.

Parameters:
startSec -
startUsec -

isStaticImage

public boolean isStaticImage()
If this animation was loaded from a that turns out to be a plain unaminated image then this method will return true.


getStaticImage

public Pixbuf getStaticImage()
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 NULL.