Constructs a pixbuf loader object for a specific image type.
Constructs a new pixbuf loader object that always attempts to parse image data as if it were an image of type image_type, 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.
Parameters:
image_type
Name of the image format to be loaded with the image.
Exceptions:
Gdk::PixbufError
Member Function Documentation
void Gdk::PixbufLoader::close
(
)
Informs a pixbuf loader that no further writes with PixbufLoader::write() 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 exception will be thrown. If you're just cancelling a load rather than expecting it to be finished, writing an empty catch() block to ignore errors is reasonable.
Creates a new pixbuf loader object for a specific image type.
Creates a new pixbuf loader object that always attempts to parse image data as if it were an image of type image_type, 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.
Parameters:
image_type
Name of the image format to be loaded with the image.
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 0.
Returns:
The Gdk::PixbufAnimation that the loader is loading, or 0 if not enough data has been read to determine the information.
Queries the Gdk::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 write(), then this function returns 0. The returned pixbuf will be the same in all future calls to the loader, so simply calling Glib::object_ref() should be sufficient to continue using it. Additionally, if the loader is an animation, it will return the "static image" of the animation (see Gdk::PixbufAnimation::get_static_image()).
Returns:
The Gdk::Pixbuf that the loader is creating, or 0 if not enough data has been read to determine how to create the image buffer.
Causes the pixbuf loader to parse the next count bytes of an image.
It will return if the data was loaded successfully, and throw an exception if an error occurred. In the latter case, the loader will be closed, and will not accept further writes.