~ubuntu-branches/ubuntu/precise/gdk-pixbuf/precise-proposed

« back to all changes in this revision

Viewing changes to docs/reference/gdk-pixbuf/html/gdk-pixbuf-File-Loading.html

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2011-04-05 10:14:08 UTC
  • mto: (1.3.2) (4.1.4 sid) (33.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20110405101408-xmmvv2ug9rzyoiag
Tags: upstream-2.23.3
Import upstream version 2.23.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<html>
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
5
<title>File Loading</title>
 
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
 
7
<link rel="home" href="index.html" title="GDK-PixBuf Reference Manual">
 
8
<link rel="up" href="rn01.html" title="API Reference">
 
9
<link rel="prev" href="gdk-pixbuf-Reference-Counting-and-Memory-Mangement.html" title="Reference Counting and Memory Mangement">
 
10
<link rel="next" href="gdk-pixbuf-File-saving.html" title="File saving">
 
11
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
 
12
<link rel="stylesheet" href="style.css" type="text/css">
 
13
</head>
 
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
 
16
<tr valign="middle">
 
17
<td><a accesskey="p" href="gdk-pixbuf-Reference-Counting-and-Memory-Mangement.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
 
18
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
 
19
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
 
20
<th width="100%" align="center">GDK-PixBuf Reference Manual</th>
 
21
<td><a accesskey="n" href="gdk-pixbuf-File-saving.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
 
22
</tr>
 
23
<tr><td colspan="5" class="shortcuts">
 
24
<a href="#gdk-pixbuf-File-Loading.synopsis" class="shortcut">Top</a>
 
25
                   | 
 
26
                  <a href="#gdk-pixbuf-File-Loading.description" class="shortcut">Description</a>
 
27
</td></tr>
 
28
</table>
 
29
<div class="refentry">
 
30
<a name="gdk-pixbuf-File-Loading"></a><div class="titlepage"></div>
 
31
<div class="refnamediv"><table width="100%"><tr>
 
32
<td valign="top">
 
33
<h2><span class="refentrytitle"><a name="gdk-pixbuf-File-Loading.top_of_page"></a>File Loading</span></h2>
 
34
<p>File Loading — Loading a pixbuf from a file.</p>
 
35
</td>
 
36
<td valign="top" align="right"></td>
 
37
</tr></table></div>
 
38
<div class="refsynopsisdiv">
 
39
<a name="gdk-pixbuf-File-Loading.synopsis"></a><h2>Synopsis</h2>
 
40
<pre class="synopsis">
 
41
#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;
 
42
 
 
43
#define             <a class="link" href="gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-file" title="gdk_pixbuf_new_from_file">gdk_pixbuf_new_from_file</a>
 
44
#define             <a class="link" href="gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-file-at-size" title="gdk_pixbuf_new_from_file_at_size">gdk_pixbuf_new_from_file_at_size</a>
 
45
#define             <a class="link" href="gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-file-at-scale" title="gdk_pixbuf_new_from_file_at_scale">gdk_pixbuf_new_from_file_at_scale</a>
 
46
<a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="returnvalue">GdkPixbufFormat</span></a> *   <a class="link" href="gdk-pixbuf-File-Loading.html#gdk-pixbuf-get-file-info" title="gdk_pixbuf_get_file_info ()">gdk_pixbuf_get_file_info</a>            (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>,
 
47
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *width</code></em>,
 
48
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *height</code></em>);
 
49
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-stream" title="gdk_pixbuf_new_from_stream ()">gdk_pixbuf_new_from_stream</a>          (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
 
50
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
 
51
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
 
52
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-stream-at-scale" title="gdk_pixbuf_new_from_stream_at_scale ()">gdk_pixbuf_new_from_stream_at_scale</a> (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
 
53
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
 
54
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
 
55
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> preserve_aspect_ratio</code></em>,
 
56
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
 
57
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
 
58
</pre>
 
59
</div>
 
60
<div class="refsect1">
 
61
<a name="gdk-pixbuf-File-Loading.description"></a><h2>Description</h2>
 
62
<p>
 
63
The &amp;gdk-pixbuf; library provides a simple mechanism for loading
 
64
an image from a file in synchronous fashion.  This means that the
 
65
library takes control of the application while the file is being
 
66
loaded; from the user's point of view, the application will block
 
67
until the image is done loading.
 
68
</p>
 
69
<p>
 
70
This interface can be used by applications in which blocking is
 
71
acceptable while an image is being loaded.  It can also be used to
 
72
load small images in general.  Applications that need progressive
 
73
loading can use the <a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> functionality instead.
 
74
</p>
 
75
</div>
 
76
<div class="refsect1">
 
77
<a name="gdk-pixbuf-File-Loading.details"></a><h2>Details</h2>
 
78
<div class="refsect2">
 
79
<a name="gdk-pixbuf-new-from-file"></a><h3>gdk_pixbuf_new_from_file</h3>
 
80
<pre class="programlisting">#define gdk_pixbuf_new_from_file gdk_pixbuf_new_from_file_utf8
 
81
</pre>
 
82
<p>
 
83
Creates a new pixbuf by loading an image from a file.  The file format is
 
84
detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then <em class="parameter"><code>error</code></em> will be set.
 
85
Possible errors are in the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> and <a href="http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> domains.
 
86
</p>
 
87
<div class="variablelist"><table border="0">
 
88
<col align="left" valign="top">
 
89
<tbody>
 
90
<tr>
 
91
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
 
92
<td>Name of file to load, in the GLib file name encoding</td>
 
93
</tr>
 
94
<tr>
 
95
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
96
<td>Return location for an error</td>
 
97
</tr>
 
98
<tr>
 
99
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
100
<td>A newly-created pixbuf with a reference count of 1, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if
 
101
any of several error conditions occurred:  the file could not be opened,
 
102
there was no loader for the file's format, there was not enough memory to
 
103
allocate the image buffer, or the image file contained invalid data.</td>
 
104
</tr>
 
105
</tbody>
 
106
</table></div>
 
107
</div>
 
108
<hr>
 
109
<div class="refsect2">
 
110
<a name="gdk-pixbuf-new-from-file-at-size"></a><h3>gdk_pixbuf_new_from_file_at_size</h3>
 
111
<pre class="programlisting">#define gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size_utf8
 
112
</pre>
 
113
<p>
 
114
Creates a new pixbuf by loading an image from a file.  
 
115
The file format is detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then 
 
116
<em class="parameter"><code>error</code></em> will be set. Possible errors are in the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> and 
 
117
<a href="http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> domains.
 
118
</p>
 
119
<p>
 
120
The image will be scaled to fit in the requested size, preserving
 
121
the image's aspect ratio. Note that the returned pixbuf may be smaller
 
122
than <em class="parameter"><code>width</code></em> x <em class="parameter"><code>height</code></em>, if the aspect ratio requires it. To load
 
123
and image at the requested size, regardless of aspect ratio, use
 
124
<a class="link" href="gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-file-at-scale" title="gdk_pixbuf_new_from_file_at_scale"><code class="function">gdk_pixbuf_new_from_file_at_scale()</code></a>.
 
125
</p>
 
126
<div class="variablelist"><table border="0">
 
127
<col align="left" valign="top">
 
128
<tbody>
 
129
<tr>
 
130
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
 
131
<td>Name of file to load, in the GLib file name encoding</td>
 
132
</tr>
 
133
<tr>
 
134
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
 
135
<td>The width the image should have or -1 to not constrain the width</td>
 
136
</tr>
 
137
<tr>
 
138
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
 
139
<td>The height the image should have or -1 to not constrain the height</td>
 
140
</tr>
 
141
<tr>
 
142
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
143
<td>Return location for an error</td>
 
144
</tr>
 
145
<tr>
 
146
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
147
<td>A newly-created pixbuf with a reference count of 1, or
 
148
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if any of several error conditions occurred:  the file could not
 
149
be opened, there was no loader for the file's format, there was not
 
150
enough memory to allocate the image buffer, or the image file contained
 
151
invalid data.</td>
 
152
</tr>
 
153
</tbody>
 
154
</table></div>
 
155
<p class="since">Since 2.4</p>
 
156
</div>
 
157
<hr>
 
158
<div class="refsect2">
 
159
<a name="gdk-pixbuf-new-from-file-at-scale"></a><h3>gdk_pixbuf_new_from_file_at_scale</h3>
 
160
<pre class="programlisting">#define gdk_pixbuf_new_from_file_at_scale gdk_pixbuf_new_from_file_at_scale_utf8
 
161
</pre>
 
162
<p>
 
163
Creates a new pixbuf by loading an image from a file.  The file format is
 
164
detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then <em class="parameter"><code>error</code></em> will be set.
 
165
Possible errors are in the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> and <a href="http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> domains.
 
166
The image will be scaled to fit in the requested size, optionally preserving
 
167
the image's aspect ratio. 
 
168
</p>
 
169
<p>
 
170
When preserving the aspect ratio, a <em class="parameter"><code>width</code></em> of -1 will cause the image
 
171
to be scaled to the exact given height, and a <em class="parameter"><code>height</code></em> of -1 will cause
 
172
the image to be scaled to the exact given width. When not preserving
 
173
aspect ratio, a <em class="parameter"><code>width</code></em> or <em class="parameter"><code>height</code></em> of -1 means to not scale the image 
 
174
at all in that dimension. Negative values for <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> are 
 
175
allowed since 2.8.
 
176
</p>
 
177
<div class="variablelist"><table border="0">
 
178
<col align="left" valign="top">
 
179
<tbody>
 
180
<tr>
 
181
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
 
182
<td>Name of file to load, in the GLib file name encoding</td>
 
183
</tr>
 
184
<tr>
 
185
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
 
186
<td>The width the image should have or -1 to not constrain the width</td>
 
187
</tr>
 
188
<tr>
 
189
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
 
190
<td>The height the image should have or -1 to not constrain the height</td>
 
191
</tr>
 
192
<tr>
 
193
<td><p><span class="term"><em class="parameter"><code>preserve_aspect_ratio</code></em> :</span></p></td>
 
194
<td>
 
195
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to preserve the image's aspect ratio</td>
 
196
</tr>
 
197
<tr>
 
198
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
199
<td>Return location for an error</td>
 
200
</tr>
 
201
<tr>
 
202
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
203
<td>A newly-created pixbuf with a reference count of 1, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
 
204
if any of several error conditions occurred:  the file could not be opened,
 
205
there was no loader for the file's format, there was not enough memory to
 
206
allocate the image buffer, or the image file contained invalid data.</td>
 
207
</tr>
 
208
</tbody>
 
209
</table></div>
 
210
<p class="since">Since 2.6</p>
 
211
</div>
 
212
<hr>
 
213
<div class="refsect2">
 
214
<a name="gdk-pixbuf-get-file-info"></a><h3>gdk_pixbuf_get_file_info ()</h3>
 
215
<pre class="programlisting"><a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="returnvalue">GdkPixbufFormat</span></a> *   gdk_pixbuf_get_file_info            (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>,
 
216
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *width</code></em>,
 
217
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *height</code></em>);</pre>
 
218
<p>
 
219
Parses an image file far enough to determine its format and size.
 
220
</p>
 
221
<div class="variablelist"><table border="0">
 
222
<col align="left" valign="top">
 
223
<tbody>
 
224
<tr>
 
225
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
 
226
<td>The name of the file to identify.</td>
 
227
</tr>
 
228
<tr>
 
229
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
 
230
<td>Return location for the width of the image, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
 
231
</td>
 
232
</tr>
 
233
<tr>
 
234
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
 
235
<td>Return location for the height of the image, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
 
236
</td>
 
237
</tr>
 
238
<tr>
 
239
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
240
<td>A <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="type">GdkPixbufFormat</span></a> describing the image format of the file
 
241
or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the image format wasn't recognized. The return value
 
242
is owned by GdkPixbuf and should not be freed.</td>
 
243
</tr>
 
244
</tbody>
 
245
</table></div>
 
246
<p class="since">Since 2.4</p>
 
247
</div>
 
248
<hr>
 
249
<div class="refsect2">
 
250
<a name="gdk-pixbuf-new-from-stream"></a><h3>gdk_pixbuf_new_from_stream ()</h3>
 
251
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_new_from_stream          (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
 
252
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
 
253
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
 
254
<p>
 
255
Creates a new pixbuf by loading an image from an input stream.  
 
256
</p>
 
257
<p>
 
258
The file format is detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then 
 
259
<em class="parameter"><code>error</code></em> will be set. The <em class="parameter"><code>cancellable</code></em> can be used to abort the operation
 
260
from another thread. If the operation was cancelled, the error 
 
261
<code class="literal">GIO_ERROR_CANCELLED</code> will be returned. Other possible errors are in 
 
262
the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> and <a href="http://library.gnome.org/devel/gio/unstable/gio-GIOError.html#G-IO-ERROR:CAPS"><code class="literal">G_IO_ERROR</code></a> domains. 
 
263
</p>
 
264
<p>
 
265
The stream is not closed.
 
266
</p>
 
267
<div class="variablelist"><table border="0">
 
268
<col align="left" valign="top">
 
269
<tbody>
 
270
<tr>
 
271
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
 
272
<td>a <a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> to load the pixbuf from</td>
 
273
</tr>
 
274
<tr>
 
275
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
 
276
<td>optional <a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> object, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore</td>
 
277
</tr>
 
278
<tr>
 
279
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
280
<td>Return location for an error</td>
 
281
</tr>
 
282
<tr>
 
283
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
284
<td>A newly-created pixbuf, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if any of several error
 
285
conditions occurred: the file could not be opened, the image format is
 
286
not supported, there was not enough memory to allocate the image buffer,
 
287
the stream contained invalid data, or the operation was cancelled.</td>
 
288
</tr>
 
289
</tbody>
 
290
</table></div>
 
291
<p class="since">Since 2.14</p>
 
292
</div>
 
293
<hr>
 
294
<div class="refsect2">
 
295
<a name="gdk-pixbuf-new-from-stream-at-scale"></a><h3>gdk_pixbuf_new_from_stream_at_scale ()</h3>
 
296
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_new_from_stream_at_scale (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
 
297
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
 
298
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
 
299
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> preserve_aspect_ratio</code></em>,
 
300
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
 
301
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
 
302
<p>
 
303
Creates a new pixbuf by loading an image from an input stream.  
 
304
</p>
 
305
<p>
 
306
The file format is detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then 
 
307
<em class="parameter"><code>error</code></em> will be set. The <em class="parameter"><code>cancellable</code></em> can be used to abort the operation
 
308
from another thread. If the operation was cancelled, the error 
 
309
<code class="literal">GIO_ERROR_CANCELLED</code> will be returned. Other possible errors are in 
 
310
the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> and <a href="http://library.gnome.org/devel/gio/unstable/gio-GIOError.html#G-IO-ERROR:CAPS"><code class="literal">G_IO_ERROR</code></a> domains. 
 
311
</p>
 
312
<p>
 
313
The image will be scaled to fit in the requested size, optionally 
 
314
preserving the image's aspect ratio. When preserving the aspect ratio, 
 
315
a <em class="parameter"><code>width</code></em> of -1 will cause the image to be scaled to the exact given 
 
316
height, and a <em class="parameter"><code>height</code></em> of -1 will cause the image to be scaled to the 
 
317
exact given width. When not preserving aspect ratio, a <em class="parameter"><code>width</code></em> or 
 
318
<em class="parameter"><code>height</code></em> of -1 means to not scale the image at all in that dimension.
 
319
</p>
 
320
<p>
 
321
The stream is not closed.
 
322
</p>
 
323
<div class="variablelist"><table border="0">
 
324
<col align="left" valign="top">
 
325
<tbody>
 
326
<tr>
 
327
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
 
328
<td>a <a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> to load the pixbuf from</td>
 
329
</tr>
 
330
<tr>
 
331
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
 
332
<td>The width the image should have or -1 to not constrain the width</td>
 
333
</tr>
 
334
<tr>
 
335
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
 
336
<td>The height the image should have or -1 to not constrain the height</td>
 
337
</tr>
 
338
<tr>
 
339
<td><p><span class="term"><em class="parameter"><code>preserve_aspect_ratio</code></em> :</span></p></td>
 
340
<td>
 
341
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to preserve the image's aspect ratio</td>
 
342
</tr>
 
343
<tr>
 
344
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
 
345
<td>optional <a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> object, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore</td>
 
346
</tr>
 
347
<tr>
 
348
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
349
<td>Return location for an error</td>
 
350
</tr>
 
351
<tr>
 
352
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
353
<td>A newly-created pixbuf, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if any of several error
 
354
conditions occurred: the file could not be opened, the image format is
 
355
not supported, there was not enough memory to allocate the image buffer,
 
356
the stream contained invalid data, or the operation was cancelled.</td>
 
357
</tr>
 
358
</tbody>
 
359
</table></div>
 
360
<p class="since">Since 2.14</p>
 
361
</div>
 
362
</div>
 
363
<div class="refsect1">
 
364
<a name="gdk-pixbuf-File-Loading.see-also"></a><h2>See Also</h2>
 
365
<a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a>.
 
366
</div>
 
367
</div>
 
368
<div class="footer">
 
369
<hr>
 
370
          Generated by GTK-Doc V1.17</div>
 
371
</body>
 
372
</html>
 
 
b'\\ No newline at end of file'