Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: PixbufAnimationCtors

[213:14] static extends: object

Alternate constructors for PixbufAnimation. Usage: PixbufAnimationCtors.<name>(...). The primary constructor lives directly on PixbufAnimation.

Methods

  • newFromResource (string resource_path)

    Creates a new pixbuf animation by loading an image from an resource. The file format is detected automatically. If NULL is returned, then @error will be set.

    • @p resource_path is the path of the resource file.
    • @r A new PixbufAnimation.
  • newFromStream (object stream, object cancellable)

    Creates a new animation by loading it from an input stream. The file format is detected automatically. If NULL is returned, then @error will be set. The @cancellable can be used to abort the operation from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. Other possible errors are in the GDK_PIXBUF_ERROR and G_IO_ERROR domains. The stream is not closed.

    • @p stream is a GInputStream to load the pixbuf from.
    • @p cancellable is optional GCancellable object.
    • @r A new PixbufAnimation.
  • newFromStreamFinish (object async_result)

    Finishes an asynchronous pixbuf animation creation operation started with [func@GdkPixbuf.PixbufAnimation.new_from_stream_async].

    • @p async_result is a #GAsyncResult.
    • @r A new PixbufAnimation.

class: PixbufAnimation

[19:7] extends: object

An opaque object representing an animation. 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.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • PixbufAnimation (filename = null)

    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.

    • @p filename is Name of file to load, in the GLib file name encoding.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • get_height ()

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

  • get_iter (start_time)

    Get an iterator for displaying an animation. The iterator provides the frames that should be displayed at a given time. @start_time would 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 @start_time is NULL, 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() 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".

    • @p start_time is time when the animation starts playing.
  • get_static_image ()

    Retrieves 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.

  • get_width ()

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

  • is_static_image ()

    Checks 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.

  • ref ()

    Adds a reference to an animation.

  • unref ()

    Removes a reference from an animation.

    • @r None.