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 |
The GdkPixbufLoader struct contains only private fields.
Synopsis
- newtype PixbufLoader = PixbufLoader (ManagedPtr PixbufLoader)
- class (GObject o, IsDescendantOf PixbufLoader o) => IsPixbufLoader o
- toPixbufLoader :: (MonadIO m, IsPixbufLoader o) => o -> m PixbufLoader
- noPixbufLoader :: Maybe PixbufLoader
- pixbufLoaderClose :: (HasCallStack, MonadIO m, IsPixbufLoader a) => a -> m ()
- pixbufLoaderGetAnimation :: (HasCallStack, MonadIO m, IsPixbufLoader a) => a -> m PixbufAnimation
- pixbufLoaderGetFormat :: (HasCallStack, MonadIO m, IsPixbufLoader a) => a -> m (Maybe PixbufFormat)
- pixbufLoaderGetPixbuf :: (HasCallStack, MonadIO m, IsPixbufLoader a) => a -> m (Maybe Pixbuf)
- pixbufLoaderNew :: (HasCallStack, MonadIO m) => m PixbufLoader
- pixbufLoaderNewWithMimeType :: (HasCallStack, MonadIO m) => Text -> m PixbufLoader
- pixbufLoaderNewWithType :: (HasCallStack, MonadIO m) => Text -> m PixbufLoader
- pixbufLoaderSetSize :: (HasCallStack, MonadIO m, IsPixbufLoader a) => a -> Int32 -> Int32 -> m ()
- pixbufLoaderWrite :: (HasCallStack, MonadIO m, IsPixbufLoader a) => a -> ByteString -> m ()
- pixbufLoaderWriteBytes :: (HasCallStack, MonadIO m, IsPixbufLoader a) => a -> Bytes -> m ()
- type C_PixbufLoaderAreaPreparedCallback = Ptr () -> Ptr () -> IO ()
- type PixbufLoaderAreaPreparedCallback = IO ()
- afterPixbufLoaderAreaPrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaPreparedCallback -> m SignalHandlerId
- genClosure_PixbufLoaderAreaPrepared :: MonadIO m => PixbufLoaderAreaPreparedCallback -> m (GClosure C_PixbufLoaderAreaPreparedCallback)
- mk_PixbufLoaderAreaPreparedCallback :: C_PixbufLoaderAreaPreparedCallback -> IO (FunPtr C_PixbufLoaderAreaPreparedCallback)
- noPixbufLoaderAreaPreparedCallback :: Maybe PixbufLoaderAreaPreparedCallback
- onPixbufLoaderAreaPrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaPreparedCallback -> m SignalHandlerId
- wrap_PixbufLoaderAreaPreparedCallback :: PixbufLoaderAreaPreparedCallback -> C_PixbufLoaderAreaPreparedCallback
- type C_PixbufLoaderAreaUpdatedCallback = Ptr () -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr () -> IO ()
- type PixbufLoaderAreaUpdatedCallback = Int32 -> Int32 -> Int32 -> Int32 -> IO ()
- afterPixbufLoaderAreaUpdated :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaUpdatedCallback -> m SignalHandlerId
- genClosure_PixbufLoaderAreaUpdated :: MonadIO m => PixbufLoaderAreaUpdatedCallback -> m (GClosure C_PixbufLoaderAreaUpdatedCallback)
- mk_PixbufLoaderAreaUpdatedCallback :: C_PixbufLoaderAreaUpdatedCallback -> IO (FunPtr C_PixbufLoaderAreaUpdatedCallback)
- noPixbufLoaderAreaUpdatedCallback :: Maybe PixbufLoaderAreaUpdatedCallback
- onPixbufLoaderAreaUpdated :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaUpdatedCallback -> m SignalHandlerId
- wrap_PixbufLoaderAreaUpdatedCallback :: PixbufLoaderAreaUpdatedCallback -> C_PixbufLoaderAreaUpdatedCallback
- type C_PixbufLoaderClosedCallback = Ptr () -> Ptr () -> IO ()
- type PixbufLoaderClosedCallback = IO ()
- afterPixbufLoaderClosed :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderClosedCallback -> m SignalHandlerId
- genClosure_PixbufLoaderClosed :: MonadIO m => PixbufLoaderClosedCallback -> m (GClosure C_PixbufLoaderClosedCallback)
- mk_PixbufLoaderClosedCallback :: C_PixbufLoaderClosedCallback -> IO (FunPtr C_PixbufLoaderClosedCallback)
- noPixbufLoaderClosedCallback :: Maybe PixbufLoaderClosedCallback
- onPixbufLoaderClosed :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderClosedCallback -> m SignalHandlerId
- wrap_PixbufLoaderClosedCallback :: PixbufLoaderClosedCallback -> C_PixbufLoaderClosedCallback
- type C_PixbufLoaderSizePreparedCallback = Ptr () -> Int32 -> Int32 -> Ptr () -> IO ()
- type PixbufLoaderSizePreparedCallback = Int32 -> Int32 -> IO ()
- afterPixbufLoaderSizePrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderSizePreparedCallback -> m SignalHandlerId
- genClosure_PixbufLoaderSizePrepared :: MonadIO m => PixbufLoaderSizePreparedCallback -> m (GClosure C_PixbufLoaderSizePreparedCallback)
- mk_PixbufLoaderSizePreparedCallback :: C_PixbufLoaderSizePreparedCallback -> IO (FunPtr C_PixbufLoaderSizePreparedCallback)
- noPixbufLoaderSizePreparedCallback :: Maybe PixbufLoaderSizePreparedCallback
- onPixbufLoaderSizePrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderSizePreparedCallback -> m SignalHandlerId
- wrap_PixbufLoaderSizePreparedCallback :: PixbufLoaderSizePreparedCallback -> C_PixbufLoaderSizePreparedCallback
Exported types
newtype PixbufLoader Source #
Memory-managed wrapper type.
Instances
Eq PixbufLoader Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufLoader (==) :: PixbufLoader -> PixbufLoader -> Bool # (/=) :: PixbufLoader -> PixbufLoader -> Bool # | |
IsGValue PixbufLoader Source # | Convert |
Defined in GI.GdkPixbuf.Objects.PixbufLoader toGValue :: PixbufLoader -> IO GValue # fromGValue :: GValue -> IO PixbufLoader # | |
GObject PixbufLoader Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufLoader gobjectType :: IO GType # | |
HasParentTypes PixbufLoader Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufLoader | |
type ParentTypes PixbufLoader Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufLoader |
class (GObject o, IsDescendantOf PixbufLoader o) => IsPixbufLoader o Source #
Type class for types which can be safely cast to PixbufLoader
, for instance with toPixbufLoader
.
Instances
(GObject o, IsDescendantOf PixbufLoader o) => IsPixbufLoader o Source # | |
Defined in GI.GdkPixbuf.Objects.PixbufLoader |
toPixbufLoader :: (MonadIO m, IsPixbufLoader o) => o -> m PixbufLoader Source #
Cast to PixbufLoader
, for types for which this is known to be safe. For general casts, use castTo
.
noPixbufLoader :: Maybe PixbufLoader Source #
A convenience alias for Nothing
:: Maybe
PixbufLoader
.
Methods
Overloaded methods
close
:: (HasCallStack, MonadIO m, IsPixbufLoader a) | |
=> a |
|
-> m () | (Can throw |
Informs a pixbuf loader that no further writes with
pixbufLoaderWrite
will occur, so that it can free its
internal loading structures. Also, tries to parse any data that
hasn't yet been parsed; if the remaining data is partial or
corrupt, an error will be returned. If False
is returned, error
will be set to an error from the GDK_PIXBUF_ERROR
or G_FILE_ERROR
domains. If you're just cancelling a load rather than expecting it
to be finished, passing Nothing
for error
to ignore it is
reasonable.
Remember that this does not unref the loader, so if you plan not to
use it anymore, please objectUnref
it.
getAnimation
pixbufLoaderGetAnimation Source #
:: (HasCallStack, MonadIO m, IsPixbufLoader a) | |
=> a |
|
-> m PixbufAnimation | Returns: The |
Queries the PixbufAnimation
that a pixbuf loader is currently creating.
In general it only makes sense to call this function after the "area-prepared"
signal has been emitted by the loader. If the loader doesn't have enough
bytes yet (hasn't emitted the "area-prepared" signal) this function will
return Nothing
.
getFormat
pixbufLoaderGetFormat Source #
:: (HasCallStack, MonadIO m, IsPixbufLoader a) | |
=> a |
|
-> m (Maybe PixbufFormat) | Returns: A |
Obtains the available information about the format of the currently loading image file.
Since: 2.2
getPixbuf
pixbufLoaderGetPixbuf Source #
:: (HasCallStack, MonadIO m, IsPixbufLoader a) | |
=> a |
|
-> m (Maybe Pixbuf) | Returns: The |
Queries the Pixbuf
that a pixbuf loader is currently creating.
In general it only makes sense to call this function after the
"area-prepared" signal has been emitted by the loader; this means
that enough data has been read to know the size of the image that
will be allocated. If the loader has not received enough data via
pixbufLoaderWrite
, then this function returns Nothing
. The
returned pixbuf will be the same in all future calls to the loader,
so simply calling objectRef
should be sufficient to continue
using it. Additionally, if the loader is an animation, it will
return the "static image" of the animation
(see pixbufAnimationGetStaticImage
).
new
:: (HasCallStack, MonadIO m) | |
=> m PixbufLoader | Returns: A newly-created pixbuf loader. |
Creates a new pixbuf loader object.
newWithMimeType
pixbufLoaderNewWithMimeType Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m PixbufLoader | Returns: A newly-created pixbuf loader. (Can throw |
Creates a new pixbuf loader object that always attempts to parse
image data as if it were an image of mime type mimeType
, instead of
identifying the type automatically. Useful if you want an error if
the image isn't the expected mime type, for loading image formats
that can't be reliably identified by looking at the data, or if
the user manually forces a specific mime type.
The list of supported mime types depends on what image loaders
are installed, but typically "image/png", "image/jpeg", "image/gif",
"image/tiff" and "image/x-xpixmap" are among the supported mime types.
To obtain the full list of supported mime types, call
pixbufFormatGetMimeTypes
on each of the PixbufFormat
structs returned by pixbufGetFormats
.
Since: 2.4
newWithType
pixbufLoaderNewWithType Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m PixbufLoader | Returns: A newly-created pixbuf loader. (Can throw |
Creates a new pixbuf loader object that always attempts to parse
image data as if it were an image of type imageType
, instead of
identifying the type automatically. Useful if you want an error if
the image isn't the expected type, for loading image formats
that can't be reliably identified by looking at the data, or if
the user manually forces a specific type.
The list of supported image formats depends on what image loaders
are installed, but typically "png", "jpeg", "gif", "tiff" and
"xpm" are among the supported formats. To obtain the full list of
supported image formats, call pixbufFormatGetName
on each
of the PixbufFormat
structs returned by pixbufGetFormats
.
setSize
:: (HasCallStack, MonadIO m, IsPixbufLoader a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Causes the image to be scaled while it is loaded. The desired
image size can be determined relative to the original size of
the image by calling pixbufLoaderSetSize
from a
signal handler for the sizePrepared signal.
Attempts to set the desired image size are ignored after the emission of the sizePrepared signal.
Since: 2.2
write
:: (HasCallStack, MonadIO m, IsPixbufLoader a) | |
=> a |
|
-> ByteString |
|
-> m () | (Can throw |
This will cause a pixbuf loader to parse the next count
bytes of
an image. It will return True
if the data was loaded successfully,
and False
if an error occurred. In the latter case, the loader
will be closed, and will not accept further writes. If False
is
returned, error
will be set to an error from the GDK_PIXBUF_ERROR
or G_FILE_ERROR
domains.
writeBytes
pixbufLoaderWriteBytes Source #
:: (HasCallStack, MonadIO m, IsPixbufLoader a) | |
=> a |
|
-> Bytes |
|
-> m () | (Can throw |
This will cause a pixbuf loader to parse a buffer inside a Bytes
for an image. It will return True
if the data was loaded successfully,
and False
if an error occurred. In the latter case, the loader
will be closed, and will not accept further writes. If False
is
returned, error
will be set to an error from the GDK_PIXBUF_ERROR
or G_FILE_ERROR
domains.
See also: pixbufLoaderWrite
Since: 2.30
Signals
areaPrepared
type C_PixbufLoaderAreaPreparedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type PixbufLoaderAreaPreparedCallback = IO () Source #
This signal is emitted when the pixbuf loader has allocated the
pixbuf in the desired size. After this signal is emitted,
applications can call pixbufLoaderGetPixbuf
to fetch
the partially-loaded pixbuf.
afterPixbufLoaderAreaPrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaPreparedCallback -> m SignalHandlerId Source #
Connect a signal handler for the areaPrepared signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
pixbufLoader #areaPrepared callback
genClosure_PixbufLoaderAreaPrepared :: MonadIO m => PixbufLoaderAreaPreparedCallback -> m (GClosure C_PixbufLoaderAreaPreparedCallback) Source #
Wrap the callback into a GClosure
.
mk_PixbufLoaderAreaPreparedCallback :: C_PixbufLoaderAreaPreparedCallback -> IO (FunPtr C_PixbufLoaderAreaPreparedCallback) Source #
Generate a function pointer callable from C code, from a C_PixbufLoaderAreaPreparedCallback
.
noPixbufLoaderAreaPreparedCallback :: Maybe PixbufLoaderAreaPreparedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
PixbufLoaderAreaPreparedCallback
onPixbufLoaderAreaPrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaPreparedCallback -> m SignalHandlerId Source #
Connect a signal handler for the areaPrepared signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
pixbufLoader #areaPrepared callback
wrap_PixbufLoaderAreaPreparedCallback :: PixbufLoaderAreaPreparedCallback -> C_PixbufLoaderAreaPreparedCallback Source #
areaUpdated
type C_PixbufLoaderAreaUpdatedCallback = Ptr () -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type PixbufLoaderAreaUpdatedCallback Source #
= Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> IO () |
This signal is emitted when a significant area of the image being loaded has been updated. Normally it means that a complete scanline has been read in, but it could be a different area as well. Applications can use this signal to know when to repaint areas of an image that is being loaded.
afterPixbufLoaderAreaUpdated :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaUpdatedCallback -> m SignalHandlerId Source #
Connect a signal handler for the areaUpdated signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
pixbufLoader #areaUpdated callback
genClosure_PixbufLoaderAreaUpdated :: MonadIO m => PixbufLoaderAreaUpdatedCallback -> m (GClosure C_PixbufLoaderAreaUpdatedCallback) Source #
Wrap the callback into a GClosure
.
mk_PixbufLoaderAreaUpdatedCallback :: C_PixbufLoaderAreaUpdatedCallback -> IO (FunPtr C_PixbufLoaderAreaUpdatedCallback) Source #
Generate a function pointer callable from C code, from a C_PixbufLoaderAreaUpdatedCallback
.
noPixbufLoaderAreaUpdatedCallback :: Maybe PixbufLoaderAreaUpdatedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
PixbufLoaderAreaUpdatedCallback
onPixbufLoaderAreaUpdated :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaUpdatedCallback -> m SignalHandlerId Source #
Connect a signal handler for the areaUpdated signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
pixbufLoader #areaUpdated callback
wrap_PixbufLoaderAreaUpdatedCallback :: PixbufLoaderAreaUpdatedCallback -> C_PixbufLoaderAreaUpdatedCallback Source #
Wrap a PixbufLoaderAreaUpdatedCallback
into a C_PixbufLoaderAreaUpdatedCallback
.
closed
type C_PixbufLoaderClosedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type PixbufLoaderClosedCallback = IO () Source #
This signal is emitted when pixbufLoaderClose
is called.
It can be used by different parts of an application to receive
notification when an image loader is closed by the code that
drives it.
afterPixbufLoaderClosed :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderClosedCallback -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
pixbufLoader #closed callback
genClosure_PixbufLoaderClosed :: MonadIO m => PixbufLoaderClosedCallback -> m (GClosure C_PixbufLoaderClosedCallback) Source #
Wrap the callback into a GClosure
.
mk_PixbufLoaderClosedCallback :: C_PixbufLoaderClosedCallback -> IO (FunPtr C_PixbufLoaderClosedCallback) Source #
Generate a function pointer callable from C code, from a C_PixbufLoaderClosedCallback
.
noPixbufLoaderClosedCallback :: Maybe PixbufLoaderClosedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
PixbufLoaderClosedCallback
onPixbufLoaderClosed :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderClosedCallback -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
pixbufLoader #closed callback
wrap_PixbufLoaderClosedCallback :: PixbufLoaderClosedCallback -> C_PixbufLoaderClosedCallback Source #
Wrap a PixbufLoaderClosedCallback
into a C_PixbufLoaderClosedCallback
.
sizePrepared
type C_PixbufLoaderSizePreparedCallback = Ptr () -> Int32 -> Int32 -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type PixbufLoaderSizePreparedCallback Source #
= Int32 |
|
-> Int32 |
|
-> IO () |
This signal is emitted when the pixbuf loader has been fed the
initial amount of data that is required to figure out the size
of the image that it will create. Applications can call
pixbufLoaderSetSize
in response to this signal to set
the desired size to which the image should be scaled.
afterPixbufLoaderSizePrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderSizePreparedCallback -> m SignalHandlerId Source #
Connect a signal handler for the sizePrepared signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
pixbufLoader #sizePrepared callback
genClosure_PixbufLoaderSizePrepared :: MonadIO m => PixbufLoaderSizePreparedCallback -> m (GClosure C_PixbufLoaderSizePreparedCallback) Source #
Wrap the callback into a GClosure
.
mk_PixbufLoaderSizePreparedCallback :: C_PixbufLoaderSizePreparedCallback -> IO (FunPtr C_PixbufLoaderSizePreparedCallback) Source #
Generate a function pointer callable from C code, from a C_PixbufLoaderSizePreparedCallback
.
noPixbufLoaderSizePreparedCallback :: Maybe PixbufLoaderSizePreparedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
PixbufLoaderSizePreparedCallback
onPixbufLoaderSizePrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderSizePreparedCallback -> m SignalHandlerId Source #
Connect a signal handler for the sizePrepared signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
pixbufLoader #sizePrepared callback