gi-gdkpixbuf-2.0.12: GdkPixbuf bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.GdkPixbuf.Objects.PixbufLoader

Contents

Description

The GdkPixbufLoader struct contains only private fields.

Synopsis

Exported types

Methods

close

pixbufLoaderClose Source #

Arguments

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

loader: A pixbuf loader.

-> m ()

(Can throw GError)

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 #

Arguments

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

loader: A pixbuf loader

-> m PixbufAnimation

Returns: The PixbufAnimation that the loader is loading, or Nothing if not enough data has been read to determine the information.

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 #

Arguments

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

loader: A pixbuf loader.

-> m (Maybe PixbufFormat)

Returns: A PixbufFormat or Nothing. The return value is owned by GdkPixbuf and should not be freed.

Obtains the available information about the format of the currently loading image file.

Since: 2.2

getPixbuf

pixbufLoaderGetPixbuf Source #

Arguments

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

loader: A pixbuf loader.

-> m Pixbuf

Returns: The Pixbuf that the loader is creating, or Nothing if not enough data has been read to determine how to create the image buffer.

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

pixbufLoaderNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m PixbufLoader

Returns: A newly-created pixbuf loader.

Creates a new pixbuf loader object.

newWithMimeType

pixbufLoaderNewWithMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

mimeType: the mime type to be loaded

-> m PixbufLoader

Returns: A newly-created pixbuf loader. (Can throw GError)

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

imageType: name of the image format to be loaded with the image

-> m PixbufLoader

Returns: A newly-created pixbuf loader. (Can throw GError)

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

pixbufLoaderSetSize Source #

Arguments

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

loader: A pixbuf loader.

-> Int32

width: The desired width of the image being loaded.

-> Int32

height: The desired height of the image being loaded.

-> 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 ::size-prepared signal.

Attempts to set the desired image size are ignored after the emission of the ::size-prepared signal.

Since: 2.2

write

pixbufLoaderWrite Source #

Arguments

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

loader: A pixbuf loader.

-> ByteString

buf: Pointer to image data.

-> m ()

(Can throw GError)

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 #

Arguments

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

loader: A pixbuf loader.

-> Bytes

buffer: The image data as a Bytes

-> m ()

(Can throw GError)

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

areaUpdated

closed

sizePrepared