Class PixbufAnimation
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
PixbufNonAnim,PixbufSimpleAnim
The GdkPixBuf library provides a simple mechanism to load and represent animations. An animation is conceptually a series of frames to be displayed over time.
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 GdkPixbuf what should
be displayed at a given point in time.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPixbufAnimation.Builder<B extends PixbufAnimation.Builder<B>>Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static classDeprecated.Use a different image loading library for animatable assetsNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new PixbufAnimation.PixbufAnimation(MemorySegment address) Deprecated.Create a PixbufAnimation proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected PixbufAnimationasParent()Deprecated.Returns this instance as if it were its parent type.static PixbufAnimation.Builder<? extends PixbufAnimation.Builder> builder()Deprecated.APixbufAnimation.Builderobject constructs aPixbufAnimationwith the specified properties.static PixbufAnimationDeprecated.Use a different image loading library for animatable assetsstatic PixbufAnimationfromFileUtf8(String filename) Deprecated.Use a different image loading library for animatable assetsstatic PixbufAnimationfromResource(String resourcePath) Deprecated.Use a different image loading library for animatable assetsstatic PixbufAnimationfromStream(InputStream stream, @Nullable Cancellable cancellable) Deprecated.Use a different image loading library for animatable assetsstatic PixbufAnimationfromStreamFinish(AsyncResult asyncResult) Deprecated.Use a different image loading library for animatable assetsintDeprecated.Use a different image loading library for animatable assetsDeprecated.Use a different image loading library for animatable assetsstatic MemoryLayoutDeprecated.The memory layout of the native struct.protected voidgetSize(MemorySegment width, MemorySegment height) Deprecated.fillswidthandheightwith the frame size of the animation.Deprecated.Use a different image loading library for animatable assetsstatic @Nullable TypegetType()Deprecated.Get the GType of the PixbufAnimation classintgetWidth()Deprecated.Use a different image loading library for animatable assetsbooleanDeprecated.Use a different image loading library for animatable assetsstatic voidnewFromStreamAsync(InputStream stream, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Deprecated.Use a different image loading library for animatable assetsref()Deprecated.Use g_object_ref().voidunref()Deprecated.Use g_object_unref().Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
PixbufAnimation
Deprecated.Create a PixbufAnimation proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
PixbufAnimation
public PixbufAnimation()Deprecated.Creates a new PixbufAnimation.
-
-
Method Details
-
getType
Deprecated.Get the GType of the PixbufAnimation class- Returns:
- the GType
-
getMemoryLayout
Deprecated.The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Deprecated.Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
fromFile
Deprecated.Use a different image loading library for animatable assetsCreates 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_ERRORandG_FILE_ERRORdomains.- Parameters:
filename- Name of file to load, in the GLib file name encoding- Returns:
- A newly-created animation
- Throws:
GErrorException- seeGError
-
fromResource
Deprecated.Use a different image loading library for animatable assetsCreates a new pixbuf animation by loading an image from an resource.The file format is detected automatically. If
NULLis returned, thenerrorwill be set.- Parameters:
resourcePath- the path of the resource file- Returns:
- A newly-created animation
- Throws:
GErrorException- seeGError- Since:
- 2.28
-
fromStream
@Deprecated public static PixbufAnimation fromStream(InputStream stream, @Nullable Cancellable cancellable) throws GErrorException Deprecated.Use a different image loading library for animatable assetsCreates a new animation by loading it from an input stream.The file format is detected automatically.
If
NULLis returned, thenerrorwill be set.The
cancellablecan be used to abort the operation from another thread. If the operation was cancelled, the errorG_IO_ERROR_CANCELLEDwill be returned. Other possible errors are in theGDK_PIXBUF_ERRORandG_IO_ERRORdomains.The stream is not closed.
- Parameters:
stream- aGInputStreamto load the pixbuf fromcancellable- optionalGCancellableobject- Returns:
- A newly-created animation
- Throws:
GErrorException- seeGError- Since:
- 2.28
-
fromStreamFinish
@Deprecated public static PixbufAnimation fromStreamFinish(AsyncResult asyncResult) throws GErrorException Deprecated.Use a different image loading library for animatable assetsFinishes an asynchronous pixbuf animation creation operation started withnewFromStreamAsync(org.gnome.gio.InputStream, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback).- Parameters:
asyncResult- aGAsyncResult- Returns:
- the newly created animation
- Throws:
GErrorException- seeGError- Since:
- 2.28
-
fromFileUtf8
Deprecated.Use a different image loading library for animatable assetsSame as gdk_pixbuf_animation_new_from_file()- Parameters:
filename- Name of file to load, in the GLib file name encoding- Returns:
- A newly-created animation with a reference count of 1, or
NULLif 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. - Throws:
GErrorException- seeGError
-
newFromStreamAsync
@Deprecated public static void newFromStreamAsync(InputStream stream, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Deprecated.Use a different image loading library for animatable assetsCreates a new animation by asynchronously loading an image from an input stream.For more details see gdk_pixbuf_new_from_stream(), which is the synchronous version of this function.
When the operation is finished,
callbackwill be called in the main thread. You can then call gdk_pixbuf_animation_new_from_stream_finish() to get the result of the operation.- Parameters:
stream- aGInputStreamfrom which to load the animationcancellable- optionalGCancellableobjectcallback- aGAsyncReadyCallbackto call when the pixbuf is loaded- Since:
- 2.28
-
getHeight
Deprecated.Use a different image loading library for animatable assetsQueries the height of the bounding box of a pixbuf animation.- Returns:
- Height of the bounding box of the animation.
-
getIter
Deprecated.Use a different image loading library for animatable assetsGet an iterator for displaying an animation.The iterator provides the frames that should be displayed at a given time.
startTimewould normally come from g_get_current_time(), and marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned by gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a timeout (with g_timeout_add()) or by some other mechanism ensure that you'll update the image after gdk_pixbuf_animation_iter_get_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
startTimeisNULL, the result of g_get_current_time() will be used automatically.To update the image (i.e. possibly change the result of gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation), call gdk_pixbuf_animation_iter_advance().
If you're using
GdkPixbufLoader, in addition to updating the image after the delay time, you should also update it whenever you receive the area_updated signal and gdk_pixbuf_animation_iter_on_currently_loading_frame() returnsTRUE. 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".
- Parameters:
startTime- time when the animation starts playing- Returns:
- an iterator to move over the animation
-
getStaticImage
Deprecated.Use a different image loading library for animatable assetsRetrieves a static image for the animation.If an animation is really just a plain image (has only one frame), this function returns that image.
If the animation is an animation, this function returns a reasonable image to use as a static unanimated image, which might be the first frame, or something more sophisticated depending on the file format.
If an animation hasn't loaded any frames yet, this function will return
NULL.- Returns:
- unanimated image representing the animation
-
getWidth
Deprecated.Use a different image loading library for animatable assetsQueries the width of the bounding box of a pixbuf animation.- Returns:
- Width of the bounding box of the animation.
-
isStaticImage
Deprecated.Use a different image loading library for animatable assetsChecks whether the animation is a static image.If you load a file with gdk_pixbuf_animation_new_from_file() and it turns out to be a plain, unanimated image, then this function will return
TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve the image.- Returns:
TRUEif the "animation" was really just an image
-
ref
Deprecated.Use g_object_ref().Adds a reference to an animation. -
unref
Deprecated.Use g_object_unref().Removes a reference from an animation. -
getSize
Deprecated.fillswidthandheightwith the frame size of the animation. -
builder
Deprecated.APixbufAnimation.Builderobject constructs aPixbufAnimationwith the specified properties. Use the variousset...()methods to set properties, and finish construction withPixbufAnimation.Builder.build().- Returns:
- the builder object
-