![]() |
![]() |
Public Member Functions | ||||
void | close (std::auto_ptr<Glib::Error>& error) | |||
Informs a pixbuf loader that no further writes with write() will occur, so that it can free its internal loading structures. | ||||
Glib::RefPtr<Gdk::PixbufAnimation> | get_animation () | |||
Queries the Gdk::PixbufAnimation that a pixbuf loader is currently creating. | ||||
PixbufFormat | get_format () const | |||
Obtains the available information about the format of the currently loading image file. | ||||
Glib::RefPtr<Gdk::Pixbuf> | get_pixbuf () | |||
Queries the Gdk::Pixbuf that a pixbuf loader is currently creating. | ||||
const GdkPixbufLoader* | gobj () const | |||
Provides access to the underlying C GObject. | ||||
GdkPixbufLoader* | gobj () | |||
Provides access to the underlying C GObject. | ||||
GdkPixbufLoader* | gobj_copy () | |||
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | ||||
void | set_size (int width, int height) | |||
Causes the image to be scaled while it is loaded. | ||||
Glib::SignalProxy0<void> | signal_area_prepared () | |||
| ||||
Glib::SignalProxy4< void, int, int, int, int > | signal_area_updated () | |||
| ||||
Glib::SignalProxy0<void> | signal_closed () | |||
| ||||
Glib::SignalProxy2< void, int, int > | signal_size_prepared () | |||
| ||||
void | write (const guint8* buf, gsize count, std::auto_ptr<Glib::Error>& error) | |||
This will cause a pixbuf loader to parse the next count bytes of an image. | ||||
virtual | ~PixbufLoader () | |||
Static Public Member Functions | ||||
static Glib::RefPtr<PixbufLoader> | create (const Glib::ustring& image_type, bool mime_type=false) | |||
Constructs a pixbuf loader object for a specific image type. | ||||
static Glib::RefPtr<PixbufLoader> | create () | |||
Creates a new pixbuf loader object. | ||||
Protected Member Functions | ||||
PixbufLoader (const Glib::ustring& image_type, bool mime_type=false) | ||||
Constructs a pixbuf loader object for a specific image type. | ||||
PixbufLoader () | ||||
Constructs a pixbuf loader object. | ||||
Related Functions | ||||
(Note that these are not member functions.) | ||||
Glib::RefPtr<Gdk::PixbufLoader> | wrap (GdkPixbufLoader* object, bool take_copy=false) | |||
|
virtual Gdk::PixbufLoader::~PixbufLoader | ( | ) | [virtual] |
Gdk::PixbufLoader::PixbufLoader | ( | ) | [protected] |
Constructs a pixbuf loader object.
Gdk::PixbufLoader::PixbufLoader | ( | const Glib::ustring & | image_type, | |
bool | mime_type = false | |||
) | [explicit, protected] |
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.
The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.
Common MIME Types are listed here http://www.iana.org/assignments/media-types/ and here: http://www.freedesktop.org/Software/shared-mime-info
image_type | Name of the image format to be loaded with the image. | |
mime_type | If this is true then the image_type is a MIME type. |
Gdk::PixbufError |
void Gdk::PixbufLoader::close | ( | std::auto_ptr< Glib::Error > & | error | ) |
Informs a pixbuf loader that no further writes with 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 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 0
for error to ignore it is reasonable.
error | Return location for a G::Error, or 0 to ignore errors. |
true
if all image data written so far was successfully passed out via the update_area signal. static Glib::RefPtr<PixbufLoader> Gdk::PixbufLoader::create | ( | const Glib::ustring & | image_type, | |
bool | mime_type = false | |||
) | [static] |
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.
The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.
Common MIME Types are listed here http://www.iana.org/assignments/media-types/ and here: http://www.freedesktop.org/Software/shared-mime-info
image_type | Name of the image format to be loaded with the image. | |
mime_type | If this is true then the image_type is a MIME type. |
Gdk::PixbufError |
static Glib::RefPtr<PixbufLoader> Gdk::PixbufLoader::create | ( | ) | [static] |
Creates a new pixbuf loader object.
Glib::RefPtr<Gdk::PixbufAnimation> Gdk::PixbufLoader::get_animation | ( | ) |
Queries the Gdk::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 0
.
0
if not enough data has been read to determine the information. PixbufFormat Gdk::PixbufLoader::get_format | ( | ) | const |
Obtains the available information about the format of the currently loading image file.
0
. The return value is owned by GdkPixbuf and should not be freed.Glib::RefPtr<Gdk::Pixbuf> Gdk::PixbufLoader::get_pixbuf | ( | ) |
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()).
0
if not enough data has been read to determine how to create the image buffer. const GdkPixbufLoader* Gdk::PixbufLoader::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
GdkPixbufLoader* Gdk::PixbufLoader::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
GdkPixbufLoader* Gdk::PixbufLoader::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void Gdk::PixbufLoader::set_size | ( | int | width, | |
int | height | |||
) |
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 set_size() 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.
width | The desired width of the image being loaded. | |
height | The desired height of the image being loaded. |
Glib::SignalProxy0< void > Gdk::PixbufLoader::signal_area_prepared | ( | ) |
void area_prepared()
Glib::SignalProxy4< void,int,int,int,int > Gdk::PixbufLoader::signal_area_updated | ( | ) |
void area_updated(int x, int y, int width, int height)
Glib::SignalProxy0< void > Gdk::PixbufLoader::signal_closed | ( | ) |
void closed()
Glib::SignalProxy2< void,int,int > Gdk::PixbufLoader::signal_size_prepared | ( | ) |
void size_prepared(int width, int height)
void Gdk::PixbufLoader::write | ( | const guint8 * | buf, | |
gsize | count, | |||
std::auto_ptr< Glib::Error > & | error | |||
) |
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.
buf | Pointer to image data. | |
count | Length of the buf buffer in bytes. | |
error | Return location for errors. |
true
if the write was successful, or false
if the loader cannot parse the buffer.
Glib::RefPtr<Gdk::PixbufLoader> wrap | ( | GdkPixbufLoader * | object, | |
bool | take_copy = false | |||
) | [related] |
object | The C instance |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |