gi-gdkpixbuf-2.0.24: GdkPixbuf bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GdkPixbuf.Objects.PixbufAnimation

Description

An opaque struct representing an animation.

Synopsis

Exported types

class (GObject o, IsDescendantOf PixbufAnimation o) => IsPixbufAnimation o Source #

Type class for types which can be safely cast to PixbufAnimation, for instance with toPixbufAnimation.

Instances

Instances details
(GObject o, IsDescendantOf PixbufAnimation o) => IsPixbufAnimation o Source # 
Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

toPixbufAnimation :: (MonadIO m, IsPixbufAnimation o) => o -> m PixbufAnimation Source #

Cast to PixbufAnimation, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

getHeight

pixbufAnimationGetHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbufAnimation a) 
=> a

animation: An animation.

-> m Int32

Returns: Height of the bounding box of the animation.

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

getIter

pixbufAnimationGetIter Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbufAnimation a) 
=> a

animation: a PixbufAnimation

-> Maybe TimeVal

startTime: time when the animation starts playing

-> m PixbufAnimationIter

Returns: an iterator to move over the animation

Get an iterator for displaying an animation. The iterator provides the frames that should be displayed at a given time. It should be freed after use with objectUnref.

startTime would normally come from getCurrentTime, and marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned by pixbufAnimationIterGetPixbuf. Then, you should install a timeout (with g_timeout_add()) or by some other mechanism ensure that you'll update the image after pixbufAnimationIterGetDelayTime milliseconds. Each time the image is updated, you should reinstall the timeout with the new, possibly-changed delay time.

As a shortcut, if startTime is Nothing, the result of getCurrentTime will be used automatically.

To update the image (i.e. possibly change the result of pixbufAnimationIterGetPixbuf to a new frame of the animation), call pixbufAnimationIterAdvance.

If you're using PixbufLoader, in addition to updating the image after the delay time, you should also update it whenever you receive the area_updated signal and pixbufAnimationIterOnCurrentlyLoadingFrame 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."

getStaticImage

pixbufAnimationGetStaticImage Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbufAnimation a) 
=> a

animation: a PixbufAnimation

-> m Pixbuf

Returns: unanimated image representing 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 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 function will return Nothing.

getWidth

pixbufAnimationGetWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbufAnimation a) 
=> a

animation: An animation.

-> m Int32

Returns: Width of the bounding box of the animation.

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

isStaticImage

pixbufAnimationIsStaticImage Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbufAnimation a) 
=> a

animation: a PixbufAnimation

-> m Bool

Returns: True if the "animation" was really just an image

If you load a file with pixbufAnimationNewFromFile and it turns out to be a plain, unanimated image, then this function will return True. Use pixbufAnimationGetStaticImage to retrieve the image.

newFromFile

pixbufAnimationNewFromFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

filename: Name of file to load, in the GLib file name encoding

-> m PixbufAnimation

Returns: A newly-created animation with a reference count of 1, or Nothing 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. (Can throw GError)

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.

newFromResource

pixbufAnimationNewFromResource Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

resourcePath: the path of the resource file

-> m PixbufAnimation

Returns: A newly-created animation, or Nothing if any of several error conditions occurred: the file could not be opened, the image format is not supported, there was not enough memory to allocate the image buffer, the stream contained invalid data, or the operation was cancelled. (Can throw GError)

Creates a new pixbuf animation by loading an image from an resource.

The file format is detected automatically. If Nothing is returned, then error will be set.

Since: 2.28

newFromStream

pixbufAnimationNewFromStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) 
=> a

stream: a InputStream to load the pixbuf from

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore

-> m PixbufAnimation

Returns: A newly-created pixbuf, or Nothing if any of several error conditions occurred: the file could not be opened, the image format is not supported, there was not enough memory to allocate the image buffer, the stream contained invalid data, or the operation was cancelled. (Can throw GError)

Creates a new animation by loading it from an input stream.

The file format is detected automatically. If Nothing 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 IOErrorEnumCancelled will be returned. Other possible errors are in the GDK_PIXBUF_ERROR and G_IO_ERROR domains.

The stream is not closed.

Since: 2.28

newFromStreamAsync

pixbufAnimationNewFromStreamAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) 
=> a

stream: a InputStream from which to load the animation

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback to call when the pixbuf is loaded

-> m () 

Creates a new animation by asynchronously loading an image from an input stream.

For more details see pixbufNewFromStream, which is the synchronous version of this function.

When the operation is finished, callback will be called in the main thread. You can then call pixbufAnimationNewFromStreamFinish to get the result of the operation.

Since: 2.28

newFromStreamFinish

pixbufAnimationNewFromStreamFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsAsyncResult a) 
=> a

asyncResult: a AsyncResult

-> m PixbufAnimation

Returns: a PixbufAnimation or Nothing on error. Free the returned object with objectUnref. (Can throw GError)

Finishes an asynchronous pixbuf animation creation operation started with pixbufAnimationNewFromStreamAsync.

Since: 2.28