Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
An opaque struct representing an animation.
Synopsis
- newtype PixbufAnimation = PixbufAnimation (ManagedPtr PixbufAnimation)
- class (GObject o, IsDescendantOf PixbufAnimation o) => IsPixbufAnimation o
- toPixbufAnimation :: (MonadIO m, IsPixbufAnimation o) => o -> m PixbufAnimation
- noPixbufAnimation :: Maybe PixbufAnimation
- pixbufAnimationGetHeight :: (HasCallStack, MonadIO m, IsPixbufAnimation a) => a -> m Int32
- pixbufAnimationGetIter :: (HasCallStack, MonadIO m, IsPixbufAnimation a) => a -> Maybe TimeVal -> m PixbufAnimationIter
- pixbufAnimationGetStaticImage :: (HasCallStack, MonadIO m, IsPixbufAnimation a) => a -> m Pixbuf
- pixbufAnimationGetWidth :: (HasCallStack, MonadIO m, IsPixbufAnimation a) => a -> m Int32
- pixbufAnimationIsStaticImage :: (HasCallStack, MonadIO m, IsPixbufAnimation a) => a -> m Bool
- pixbufAnimationNewFromFile :: (HasCallStack, MonadIO m) => [Char] -> m PixbufAnimation
- pixbufAnimationNewFromResource :: (HasCallStack, MonadIO m) => Text -> m PixbufAnimation
- pixbufAnimationNewFromStream :: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) => a -> Maybe b -> m PixbufAnimation
- pixbufAnimationNewFromStreamAsync :: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- pixbufAnimationNewFromStreamFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m PixbufAnimation
Exported types
newtype PixbufAnimation Source #
Memory-managed wrapper type.
Instances
Eq PixbufAnimation Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufAnimation (==) :: PixbufAnimation -> PixbufAnimation -> Bool # (/=) :: PixbufAnimation -> PixbufAnimation -> Bool # | |
IsGValue PixbufAnimation Source # | Convert |
Defined in GI.GdkPixbuf.Objects.PixbufAnimation toGValue :: PixbufAnimation -> IO GValue # fromGValue :: GValue -> IO PixbufAnimation # | |
GObject PixbufAnimation Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufAnimation gobjectType :: IO GType # | |
HasParentTypes PixbufAnimation Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufAnimation | |
type ParentTypes PixbufAnimation Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufAnimation |
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
(GObject o, IsDescendantOf PixbufAnimation o) => IsPixbufAnimation o Source # | |
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
.
noPixbufAnimation :: Maybe PixbufAnimation Source #
A convenience alias for Nothing
:: Maybe
PixbufAnimation
.
Methods
Overloaded methods
getHeight
pixbufAnimationGetHeight Source #
:: (HasCallStack, MonadIO m, IsPixbufAnimation a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPixbufAnimation a) | |
=> a |
|
-> Maybe TimeVal |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPixbufAnimation a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPixbufAnimation a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPixbufAnimation a) | |
=> a |
|
-> m Bool | Returns: |
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 #
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> m PixbufAnimation | Returns: A newly-created animation with a reference count of 1, or |
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 #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m PixbufAnimation | Returns: A newly-created animation, or |
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 #
:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m PixbufAnimation | Returns: A newly-created pixbuf, or |
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 #
:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m PixbufAnimation | Returns: a |
Finishes an asynchronous pixbuf animation creation operation started with
pixbufAnimationNewFromStreamAsync
.
Since: 2.28