Synopsis#include <gdk-pixbuf/gdk-pixbuf.h> GdkPixbufLoader; GdkPixbufLoader* gdk_pixbuf_loader_new (void); GdkPixbufLoader* gdk_pixbuf_loader_new_with_type (const char *image_type, GError **error); GdkPixbufLoader* gdk_pixbuf_loader_new_with_mime_type (const char *mime_type, GError **error); GdkPixbufFormat* gdk_pixbuf_loader_get_format (GdkPixbufLoader *loader); gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader, const guchar *buf, gsize count, GError **error); void gdk_pixbuf_loader_set_size (GdkPixbufLoader *loader, int width, int height); GdkPixbuf* gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader); GdkPixbufAnimation* gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader); gboolean gdk_pixbuf_loader_close (GdkPixbufLoader *loader, GError **error); Signals"area-prepared" : Run Last "area-updated" : Run Last "closed" : Run Last "size-prepared" : Run Last Description
GdkPixbufLoader provides a way for applications to drive the
process of loading an image, by letting them send the image data
directly to the loader instead of having the loader read the data
from a file. Applications can use this functionality instead of
To use GdkPixbufLoader to load an image, just create a new one,
and call The second signal, "area_prepared",
will be called as soon as the pixbuf of the desired has been
allocated. You can obtain it by calling The last signal, "area_updated" gets called every time a region is updated. This way you can update a partially completed image. Note that you do not know anything about the completeness of an image from the area updated. For example, in an interlaced image, you need to make several passes before the image is done loading. Loading an animation
Loading an animation is almost as easy as loading an
image. Once the first "area_prepared" signal
has been emitted, you can call DetailsGdkPixbufLoadertypedef struct _GdkPixbufLoader GdkPixbufLoader; The GdkPixbufLoader struct contains only private fields. gdk_pixbuf_loader_new ()GdkPixbufLoader* gdk_pixbuf_loader_new (void); Creates a new pixbuf loader object.
gdk_pixbuf_loader_new_with_type ()GdkPixbufLoader* gdk_pixbuf_loader_new_with_type (const char *image_type, GError **error);
Creates a new pixbuf loader object that always attempts to parse
image data as if it were an image of 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
gdk_pixbuf_loader_new_with_mime_type ()GdkPixbufLoader* gdk_pixbuf_loader_new_with_mime_type (const char *mime_type, GError **error);
Creates a new pixbuf loader object that always attempts to parse
image data as if it were an image of 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
Since 2.4 gdk_pixbuf_loader_get_format ()GdkPixbufFormat* gdk_pixbuf_loader_get_format (GdkPixbufLoader *loader); Obtains the available information about the format of the currently loading image file.
Since 2.2 gdk_pixbuf_loader_write ()gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader, const guchar *buf, gsize count, GError **error);
This will cause a pixbuf loader to parse the next
gdk_pixbuf_loader_set_size ()void gdk_pixbuf_loader_set_size (GdkPixbufLoader *loader, 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 Attempts to set the desired image size are ignored after the emission of the ::size-prepared signal.
Since 2.2 gdk_pixbuf_loader_get_pixbuf ()GdkPixbuf* gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader);
Queries the GdkPixbuf 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
gdk_pixbuf_loader_get_animation ()GdkPixbufAnimation* gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader);
Queries the GdkPixbufAnimation 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
gdk_pixbuf_loader_close ()gboolean gdk_pixbuf_loader_close (GdkPixbufLoader *loader, GError **error);
Informs a pixbuf loader that no further writes with
Signal DetailsThe
|
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"area-updated"
signalvoid user_function (GdkPixbufLoader *loader, gint x, gint y, gint width, gint height, gpointer user_data) : Run Last
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.
|
the object which received the signal. |
|
X offset of upper-left corner of the updated area. |
|
Y offset of upper-left corner of the updated area. |
|
Width of updated area. |
|
Height of updated area. |
|
user data set when the signal handler was connected. |
"closed"
signalvoid user_function (GdkPixbufLoader *loader, gpointer user_data) : Run Last
This signal is emitted when gdk_pixbuf_loader_close()
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.
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"size-prepared"
signalvoid user_function (GdkPixbufLoader *loader, gint width, gint height, gpointer user_data) : Run Last
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
gdk_pixbuf_loader_set_size()
in response to this signal to set
the desired size to which the image should be scaled.
|
the object which received the signal. |
|
the original width of the image |
|
the original height of the image |
|
user data set when the signal handler was connected. |