1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 Application-driven progressive image loading.
7 <!-- ##### SECTION Long_Description ##### -->
9 #GdkPixbufLoader provides a way for applications to drive the
10 process of loading an image, by letting them send the image data
11 directly to the loader instead of having the loader read the data
12 from a file. Applications can use this functionality instead of
13 gdk_pixbuf_new_from_file() or gdk_pixbuf_animation_new_from_file()
14 when they need to parse image data in
15 small chunks. For example, it should be used when reading an
16 image from a (potentially) slow network connection, or when
17 loading an extremely large file.
21 To use #GdkPixbufLoader to load an image, just create a new one,
22 and call gdk_pixbuf_loader_write() to send the data to it. When
23 done, gdk_pixbuf_loader_close() should be called to end the stream
24 and finalize everything. The loader will emit three important
25 signals throughout the process. The first, "<link
26 linkend="GdkPixbufLoader-size-prepared">size_prepared</link>",
27 will be called as soon as the image has enough information to
28 determine the size of the image to be used. If you want to scale
29 the image while loading it, you can call gdk_pixbuf_loader_set_size()
30 in response to this signal.
33 <para>The second signal, "<link
34 linkend="GdkPixbufLoader-area-prepared">area_prepared</link>",
35 will be called as soon as the pixbuf of the desired has been
36 allocated. You can obtain it by calling gdk_pixbuf_loader_get_pixbuf().
37 If you want to use it, simply ref it.
38 In addition, no actual information will be passed in yet, so the
39 pixbuf can be safely filled with any temporary graphics (or an
40 initial color) as needed. You can also call
41 gdk_pixbuf_loader_get_pixbuf() later and get the same pixbuf.
45 The last signal, "<link
46 linkend="GdkPixbufLoader-area-updated">area_updated</link>" gets
47 called every time a region is updated. This way you can update a
48 partially completed image. Note that you do not know anything
49 about the completeness of an image from the area updated. For
50 example, in an interlaced image, you need to make several passes
51 before the image is done loading.
55 <title>Loading an animation</title>
58 Loading an animation is almost as easy as loading an
59 image. Once the first "<link
60 linkend="GdkPixbufLoader-area-prepared">area_prepared</link>" signal
61 has been emitted, you can call gdk_pixbuf_loader_get_animation()
62 to get the #GdkPixbufAnimation struct and gdk_pixbuf_animation_get_iter()
63 to get an #GdkPixbufAnimationIter for displaying it.
67 <!-- ##### SECTION See_Also ##### -->
69 gdk_pixbuf_new_from_file(), gdk_pixbuf_animation_new_from_file()
72 <!-- ##### SECTION Stability_Level ##### -->
75 <!-- ##### SECTION Image ##### -->
78 <!-- ##### STRUCT GdkPixbufLoader ##### -->
80 The <structname>GdkPixbufLoader</structname> struct contains only private
85 <!-- ##### SIGNAL GdkPixbufLoader::area-prepared ##### -->
91 <!-- ##### SIGNAL GdkPixbufLoader::area-updated ##### -->
101 <!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
107 <!-- ##### SIGNAL GdkPixbufLoader::size-prepared ##### -->
115 <!-- ##### FUNCTION gdk_pixbuf_loader_new ##### -->
124 <!-- ##### FUNCTION gdk_pixbuf_loader_new_with_type ##### -->
134 <!-- ##### FUNCTION gdk_pixbuf_loader_new_with_mime_type ##### -->
144 <!-- ##### FUNCTION gdk_pixbuf_loader_get_format ##### -->
153 <!-- ##### FUNCTION gdk_pixbuf_loader_write ##### -->
165 <!-- ##### FUNCTION gdk_pixbuf_loader_set_size ##### -->
175 <!-- ##### FUNCTION gdk_pixbuf_loader_get_pixbuf ##### -->
184 <!-- ##### FUNCTION gdk_pixbuf_loader_get_animation ##### -->
193 <!-- ##### FUNCTION gdk_pixbuf_loader_close ##### -->
205 sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")