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 <!-- ##### FUNCTION gdk_pixbuf_loader_new ##### -->
80 <!-- ##### FUNCTION gdk_pixbuf_loader_new_with_type ##### -->
90 <!-- ##### FUNCTION gdk_pixbuf_loader_get_format ##### -->
99 <!-- ##### FUNCTION gdk_pixbuf_loader_write ##### -->
111 <!-- ##### FUNCTION gdk_pixbuf_loader_set_size ##### -->
121 <!-- ##### FUNCTION gdk_pixbuf_loader_get_pixbuf ##### -->
130 <!-- ##### FUNCTION gdk_pixbuf_loader_get_animation ##### -->
139 <!-- ##### FUNCTION gdk_pixbuf_loader_close ##### -->
149 <!-- ##### SIGNAL GdkPixbufLoader::area-prepared ##### -->
151 This signal is emitted when the pixbuf loader has allocated the pixbuf
152 in the desired size. After this signal is emitted, applications can
153 call gdk_pixbuf_loader_get_pixbuf() to fetch the partially-loaded pixbuf.
156 @gdkpixbufloader: the object which received the signal.
158 <!-- ##### SIGNAL GdkPixbufLoader::area-updated ##### -->
160 This signal is emitted when a significant area of the image being
161 loaded has been updated. Normally it means that a complete
162 scanline has been read in, but it could be a different area as
163 well. Applications can use this signal to know when to repaint
164 areas of an image that is being loaded.
167 @gdkpixbufloader: Loader which emitted the signal.
172 <!-- # Unused Parameters # -->
173 @x: X offset of upper-left corner of the updated area.
174 @y: Y offset of upper-left corner of the updated area.
175 @width: Width of updated area.
176 @height: Height of updated area.
178 <!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
180 This signal is emitted when gdk_pixbuf_loader_close() is called.
181 It can be used by different parts of an application to receive
182 notification when an image loader is closed by the code that
186 @gdkpixbufloader: the object which received the signal.
191 sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
195 <!-- ##### SIGNAL GdkPixbufLoader::size-prepared ##### -->
197 This signal is emitted when the pixbuf loader has been fed the
198 initial amount of data that is required to figure out the size
199 of the image that it will create. Applications can call
200 gdk_pixbuf_loader_set_size() in response to this signal to set
201 the desired size to which the image should be scaled.
204 @gdkpixbufloader: the object which received the signal.
207 <!-- # Unused Parameters # -->
208 @width: the original width of the image
209 @height: the original height of the image