gi-gdkpixbuf-2.0.31: GdkPixbuf bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.GdkPixbuf.Objects.PixbufAnimation

Description

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.

Synopsis

Exported types

newtype PixbufAnimation Source #

Memory-managed wrapper type.

Constructors

PixbufAnimation (ManagedPtr PixbufAnimation) 

Instances

Instances details
Eq PixbufAnimation Source # 
Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

GObject PixbufAnimation Source # 
Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

ManagedPtrNewtype PixbufAnimation Source # 
Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

TypedObject PixbufAnimation Source # 
Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

Methods

glibType :: IO GType

HasParentTypes PixbufAnimation Source # 
Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

IsGValue (Maybe PixbufAnimation) Source #

Convert PixbufAnimation to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe PixbufAnimation -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe PixbufAnimation)

type ParentTypes PixbufAnimation Source # 
Instance details

Defined in GI.GdkPixbuf.Objects.PixbufAnimation

type ParentTypes PixbufAnimation = '[Object]

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

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.

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 NULL, 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

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.

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

Checks whether the animation is a static 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 (Maybe PixbufAnimation)

Returns: A newly-created animation (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 (Maybe PixbufAnimation)

Returns: A newly-created animation (Can throw GError)

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.

Since: 2.28

newFromStream

pixbufAnimationNewFromStream Source #

Arguments

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

stream: a GInputStream to load the pixbuf from

-> Maybe b

cancellable: optional GCancellable object

-> m (Maybe PixbufAnimation)

Returns: A newly-created animation (Can throw GError)

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.

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

-> Maybe AsyncReadyCallback

callback: a GAsyncReadyCallback 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 (Maybe PixbufAnimation)

Returns: the newly created animation (Can throw GError)

Finishes an asynchronous pixbuf animation creation operation started with [funcgdkPixbuf.PixbufAnimation.new_from_stream_async].

Since: 2.28