PixbufAnimationProtocol
public protocol PixbufAnimationProtocol : ObjectProtocol
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.
The PixbufAnimationProtocol protocol exposes the methods and properties of an underlying GdkPixbufAnimation instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see PixbufAnimation.
Alternatively, use PixbufAnimationRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GdkPixbufAnimationinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
pixbuf_animation_ptrDefault implementationTyped pointer to the underlying
GdkPixbufAnimationinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkPixbufAnimationinstance.Declaration
Swift
var pixbuf_animation_ptr: UnsafeMutablePointer<GdkPixbufAnimation>! { get } -
Required Initialiser for types conforming to
PixbufAnimationProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
getHeight()Extension methodQueries the height of the bounding box of a pixbuf animation.
Declaration
Swift
@inlinable func getHeight() -> Int -
getIter(startTime:Extension method) Get an iterator for displaying an animation.
The iterator provides the frames that should be displayed at a given time.
start_timewould normally come fromg_get_current_time(), and marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned bygdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a timeout (withg_timeout_add()) or by some other mechanism ensure that you’ll update the image aftergdk_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_timeisNULL, the result ofg_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), callgdk_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 andgdk_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”.
Declaration
Swift
@inlinable func getIter(startTime: GLib.TimeValRef? = nil) -> GdkPixBuf.PixbufAnimationIterRef! -
getIter(startTime:Extension method) Get an iterator for displaying an animation.
The iterator provides the frames that should be displayed at a given time.
start_timewould normally come fromg_get_current_time(), and marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned bygdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a timeout (withg_timeout_add()) or by some other mechanism ensure that you’ll update the image aftergdk_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_timeisNULL, the result ofg_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), callgdk_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 andgdk_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”.
Declaration
Swift
@inlinable func getIter<GLibTimeValT>(startTime: GLibTimeValT?) -> GdkPixBuf.PixbufAnimationIterRef! where GLibTimeValT : TimeValProtocol -
getStaticImage()Extension methodRetrieves 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.Declaration
Swift
@inlinable func getStaticImage() -> GdkPixBuf.PixbufRef! -
getWidth()Extension methodQueries the width of the bounding box of a pixbuf animation.
Declaration
Swift
@inlinable func getWidth() -> Int -
ref()Extension methodAdds a reference to an animation.
ref is deprecated: Use g_object_ref().
Declaration
Swift
@available(*, deprecated) @discardableResult @inlinable func ref() -> GdkPixBuf.PixbufAnimationRef! -
unref()Extension methodRemoves a reference from an animation.
unref is deprecated: Use g_object_unref().
Declaration
Swift
@available(*, deprecated) @inlinable func unref() -
heightExtension methodQueries the height of the bounding box of a pixbuf animation.
Declaration
Swift
@inlinable var height: Int { get } -
isStaticImageExtension methodChecks 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 returnTRUE. Usegdk_pixbuf_animation_get_static_image()to retrieve the image.Declaration
Swift
@inlinable var isStaticImage: Bool { get } -
staticImageExtension methodRetrieves 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.Declaration
Swift
@inlinable var staticImage: GdkPixBuf.PixbufRef! { get } -
widthExtension methodQueries the width of the bounding box of a pixbuf animation.
Declaration
Swift
@inlinable var width: Int { get } -
parentInstanceExtension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GObject { get }
View on GitHub
Install in Dash
PixbufAnimationProtocol Protocol Reference