]> Pileus Git - ~andy/gtk/blob - docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
Some updates
[~andy/gtk] / docs / reference / gdk-pixbuf / tmpl / gdk-pixbuf-loader.sgml
1 <!-- ##### SECTION Title ##### -->
2 GdkPixbufLoader
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Application-driven progressive image loading.
6
7 <!-- ##### SECTION Long_Description ##### -->
8   <para>
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() when they need to parse image data in
14     small chunks.  For example, it should be used when reading an
15     image from a (potentially) slow network connection, or when
16     loading an extremely large file.
17   </para>
18
19   <para>
20     To use #GdkPixbufLoader to load an image, just create a new one,
21     and call gdk_pixbuf_loader_write() to send the data to it.  When
22     done, gdk_pixbuf_loader_close() should be called to end the stream
23     and finalize everything.  The loader will emit two important
24     signals throughout the process.  The first, "<link
25     linkend="GdkPixbufLoader-area-prepared">area_prepared</link>",
26     will be called as soon as the image has enough information to
27     determine the size of the image to be used.  It will pass a
28     @GdkPixbuf in.  If you want to use it, you can simply ref it.  In
29     addition, no actual information will be passed in yet, so the
30     pixbuf can be safely filled with any temporary graphics (or an
31     initial color) as needed.  You can also call the
32     gdk_pixbuf_loader_get_pixbuf() once this signal has been emitted
33     and get the same pixbuf.
34   </para>
35
36   <para>
37     The other signal, "<link
38     linkend="GdkPixbufLoader-area-updated">area_updated</link>" gets
39     called every time a region is updated.  This way you can update a
40     partially completed image.  Note that you do not know anything
41     about the completeness of an image from the area updated.  For
42     example, in an interlaced image, you need to make several passes
43     before the image is done loading.
44   </para>
45
46   <refsect2>
47     <title>Loading an animation</title>
48
49     <para>
50       Loading an animation is a little more complex then loading an
51       image.  In addition to the above signals, there is also a "<link
52       linkend="GdkPixbufLoader-frame-done">frame_done</link>" signal,
53       as well as an "<link
54       linkend="GdkPixbufLoader-animation-done">animation_done</link>"
55       signal.  The first lets the application know that it is dealing
56       with an animation, instead of a static image.  It also passes a
57       #GdkPixbufFrame in the signal.  As before, if you want to keep
58       the frame, you need to ref it.  Once the first "<link
59       linkend="GdkPixbufLoader-frame-done">frame_done</link>" signal
60       has been emitted, you can call gdk_pixbuf_loader_get_animation()
61       to get the #GdkPixbufAnimation struct.  Each subsequent frame
62       goes through a similar lifecycle.  For example "<link
63       linkend="GdkPixbufLoader-area-prepared">area_prepared</link>" is
64       re-emitted.  Then "<link
65       linkend="GdkPixbufLoader-area-updated">area_updated</link>" is
66       emitted as many times as necessary.  Finally, "<link
67       linkend="GdkPixbufLoader-animation-done">animation_done</link>"
68       is emitted as soon as all frames are done.
69     </para>
70   </refsect2>
71
72 <!-- ##### SECTION See_Also ##### -->
73   <para>
74     gdk_pixbuf_new_from_file()
75   </para>
76
77 <!-- ##### FUNCTION gdk_pixbuf_loader_new ##### -->
78 <para>
79
80 </para>
81
82 @Returns: 
83
84
85 <!-- ##### FUNCTION gdk_pixbuf_loader_new_with_type ##### -->
86 <para>
87
88 </para>
89
90 @image_type: 
91 @error: 
92 @Returns: 
93
94
95 <!-- ##### FUNCTION gdk_pixbuf_loader_write ##### -->
96 <para>
97
98 </para>
99
100 @loader: 
101 @buf: 
102 @count: 
103 @error: 
104 @Returns: 
105
106
107 <!-- ##### FUNCTION gdk_pixbuf_loader_get_pixbuf ##### -->
108 <para>
109
110 </para>
111
112 @loader: 
113 @Returns: 
114
115
116 <!-- ##### FUNCTION gdk_pixbuf_loader_get_animation ##### -->
117 <para>
118
119 </para>
120
121 @loader: 
122 @Returns: 
123
124
125 <!-- ##### FUNCTION gdk_pixbuf_loader_close ##### -->
126 <para>
127
128 </para>
129
130 @loader: 
131
132
133 <!-- ##### SIGNAL GdkPixbufLoader::area-updated ##### -->
134   <para>
135     This signal is emitted when a significant area of the image being
136     loaded has been updated.  Normally it means that a complete
137     scanline has been read in, but it could be a different area as
138     well.  Applications can use this signal to know when to repaint
139     areas of an image that is being loaded.
140   </para>
141
142 @gdkpixbufloader: the object which received the signal.
143 @arg1: 
144 @arg2: 
145 @arg3: 
146 @arg4: 
147 <!-- # Unused Parameters # -->
148 @loader: Loader which emitted the signal.
149 @x: X offset of upper-left corner of the updated area.
150 @y: Y offset of upper-left corner of the updated area.
151 @width: Width of updated area.
152 @height: Height of updated area.
153
154 <!-- ##### SIGNAL GdkPixbufLoader::area-prepared ##### -->
155   <para>
156     This signal is emitted when the pixbuf loader has been fed the
157     initial amount of data that is required to figure out the size and
158     format of the image that it will create.  After this signal is
159     emitted, applications can call gdk_pixbuf_loader_get_pixbuf() to
160     fetch the partially-loaded pixbuf.
161   </para>
162
163 @gdkpixbufloader: the object which received the signal.
164 <!-- # Unused Parameters # -->
165 @loader: Loader which emitted the signal.
166
167 <!-- ##### SIGNAL GdkPixbufLoader::frame-done ##### -->
168   <para>
169     This signal is emitted when a frame is done loading.  It will be
170     emitted for each frame in an animation data stream.
171   </para>
172
173 @gdkpixbufloader: the object which received the signal.
174 @arg1: 
175 <!-- # Unused Parameters # -->
176 @loader: Loader which emitted the signal.
177 @frame: Frame which just completed loading.
178
179 <!-- ##### SIGNAL GdkPixbufLoader::animation-done ##### -->
180   <para>
181     This signal is emitted when an animation is done loading.
182   </para>
183
184 @gdkpixbufloader: the object which received the signal.
185 <!-- # Unused Parameters # -->
186 @loader: Loader which emitted the signal.
187
188 <!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
189   <para>
190     This signal is emitted when gdk_pixbuf_loader_close() is called.
191     It can be used by different parts of an application to receive
192     notification when an image loader is closed by the code that
193     drives it.
194   </para>
195
196 @gdkpixbufloader: the object which received the signal.
197 <!-- # Unused Parameters # -->
198 @loader: Loader which emitted the signal.
199
200 <!--
201 Local variables:
202 mode: sgml
203 sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
204 End:
205 -->
206