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

« back to all changes in this revision

Viewing changes to docs/reference/gdk-pixbuf/html/gdk-pixbuf-Image-Data-in-Memory.html

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2011-09-02 12:05:31 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: package-import@ubuntu.com-20110902120531-m8ps135i9wx0wu9c
Tags: 2.24.0-1
New upstream bug fix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include <gdk-pixbuf/gdk-pixbuf.h>
42
42
 
43
43
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new" title="gdk_pixbuf_new ()">gdk_pixbuf_new</a>                      (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkColorspace" title="enum GdkColorspace"><span class="type">GdkColorspace</span></a> colorspace</code></em>,
44
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> has_alpha</code></em>,
 
44
                                                         <em class="parameter"><code><span class="type">gboolean</span> has_alpha</code></em>,
45
45
                                                         <em class="parameter"><code><span class="type">int</span> bits_per_sample</code></em>,
46
46
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
47
47
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>);
48
 
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-data" title="gdk_pixbuf_new_from_data ()">gdk_pixbuf_new_from_data</a>            (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guchar"><span class="type">guchar</span></a> *data</code></em>,
 
48
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-data" title="gdk_pixbuf_new_from_data ()">gdk_pixbuf_new_from_data</a>            (<em class="parameter"><code>const <span class="type">guchar</span> *data</code></em>,
49
49
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkColorspace" title="enum GdkColorspace"><span class="type">GdkColorspace</span></a> colorspace</code></em>,
50
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> has_alpha</code></em>,
 
50
                                                         <em class="parameter"><code><span class="type">gboolean</span> has_alpha</code></em>,
51
51
                                                         <em class="parameter"><code><span class="type">int</span> bits_per_sample</code></em>,
52
52
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
53
53
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>,
54
54
                                                         <em class="parameter"><code><span class="type">int</span> rowstride</code></em>,
55
55
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-Reference-Counting-and-Memory-Mangement.html#GdkPixbufDestroyNotify" title="GdkPixbufDestroyNotify ()"><span class="type">GdkPixbufDestroyNotify</span></a> destroy_fn</code></em>,
56
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> destroy_fn_data</code></em>);
 
56
                                                         <em class="parameter"><code><span class="type">gpointer</span> destroy_fn_data</code></em>);
57
57
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-xpm-data" title="gdk_pixbuf_new_from_xpm_data ()">gdk_pixbuf_new_from_xpm_data</a>        (<em class="parameter"><code>const <span class="type">char</span> **data</code></em>);
58
 
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-inline" title="gdk_pixbuf_new_from_inline ()">gdk_pixbuf_new_from_inline</a>          (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> data_length</code></em>,
59
 
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint8"><span class="type">guint8</span></a> *data</code></em>,
60
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> copy_pixels</code></em>,
61
 
                                                         <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
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-inline" title="gdk_pixbuf_new_from_inline ()">gdk_pixbuf_new_from_inline</a>          (<em class="parameter"><code><span class="type">gint</span> data_length</code></em>,
 
59
                                                         <em class="parameter"><code>const <span class="type">guint8</span> *data</code></em>,
 
60
                                                         <em class="parameter"><code><span class="type">gboolean</span> copy_pixels</code></em>,
 
61
                                                         <em class="parameter"><code><span class="type">GError</span> **error</code></em>);
62
62
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-subpixbuf" title="gdk_pixbuf_new_subpixbuf ()">gdk_pixbuf_new_subpixbuf</a>            (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *src_pixbuf</code></em>,
63
63
                                                         <em class="parameter"><code><span class="type">int</span> src_x</code></em>,
64
64
                                                         <em class="parameter"><code><span class="type">int</span> src_y</code></em>,
77
77
data buffer needs to be freed; this will happen when a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
78
78
is finalized by the reference counting functions If you have a
79
79
chunk of static data compiled into your application, you can pass
80
 
in <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> as the destroy notification function so that the data
 
80
in <a href="/home/mclasen/gnome/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> as the destroy notification function so that the data
81
81
will not be freed.
82
82
</p>
83
83
<p>
94
94
</p>
95
95
<p>
96
96
You can also copy an existing pixbuf with the <a class="link" href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-copy" title="gdk_pixbuf_copy ()"><code class="function">gdk_pixbuf_copy()</code></a>
97
 
function.  This is not the same as just doing a <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-ref"><code class="function">g_object_ref()</code></a>
 
97
function.  This is not the same as just doing a <code class="function">g_object_ref()</code>
98
98
on the old pixbuf; the copy function will actually duplicate the
99
99
pixel data in memory and create a new <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> structure for it.
100
100
</p>
104
104
<div class="refsect2">
105
105
<a name="gdk-pixbuf-new"></a><h3>gdk_pixbuf_new ()</h3>
106
106
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_new                      (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkColorspace" title="enum GdkColorspace"><span class="type">GdkColorspace</span></a> colorspace</code></em>,
107
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> has_alpha</code></em>,
 
107
                                                         <em class="parameter"><code><span class="type">gboolean</span> has_alpha</code></em>,
108
108
                                                         <em class="parameter"><code><span class="type">int</span> bits_per_sample</code></em>,
109
109
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
110
110
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>);</pre>
139
139
<tr>
140
140
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
141
141
<td>A newly-created <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> with a reference count of 1, or
142
 
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not enough memory could be allocated for the image buffer.</td>
 
142
<a href="/home/mclasen/gnome/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if not enough memory could be allocated for the image buffer.</td>
143
143
</tr>
144
144
</tbody>
145
145
</table></div>
147
147
<hr>
148
148
<div class="refsect2">
149
149
<a name="gdk-pixbuf-new-from-data"></a><h3>gdk_pixbuf_new_from_data ()</h3>
150
 
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_new_from_data            (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guchar"><span class="type">guchar</span></a> *data</code></em>,
 
150
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_new_from_data            (<em class="parameter"><code>const <span class="type">guchar</span> *data</code></em>,
151
151
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkColorspace" title="enum GdkColorspace"><span class="type">GdkColorspace</span></a> colorspace</code></em>,
152
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> has_alpha</code></em>,
 
152
                                                         <em class="parameter"><code><span class="type">gboolean</span> has_alpha</code></em>,
153
153
                                                         <em class="parameter"><code><span class="type">int</span> bits_per_sample</code></em>,
154
154
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
155
155
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>,
156
156
                                                         <em class="parameter"><code><span class="type">int</span> rowstride</code></em>,
157
157
                                                         <em class="parameter"><code><a class="link" href="gdk-pixbuf-Reference-Counting-and-Memory-Mangement.html#GdkPixbufDestroyNotify" title="GdkPixbufDestroyNotify ()"><span class="type">GdkPixbufDestroyNotify</span></a> destroy_fn</code></em>,
158
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> destroy_fn_data</code></em>);</pre>
 
158
                                                         <em class="parameter"><code><span class="type">gpointer</span> destroy_fn_data</code></em>);</pre>
159
159
<p>
160
160
Creates a new <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> out of in-memory image data.  Currently only RGB
161
161
images with 8 bits per sample are supported.
195
195
<tr>
196
196
<td><p><span class="term"><em class="parameter"><code>destroy_fn</code></em> :</span></p></td>
197
197
<td>Function used to free the data when the pixbuf's reference count
198
 
drops to zero, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the data should not be freed. <span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span>
 
198
drops to zero, or <a href="/home/mclasen/gnome/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if the data should not be freed. <span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span>
199
199
</td>
200
200
</tr>
201
201
<tr>
236
236
<hr>
237
237
<div class="refsect2">
238
238
<a name="gdk-pixbuf-new-from-inline"></a><h3>gdk_pixbuf_new_from_inline ()</h3>
239
 
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_new_from_inline          (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> data_length</code></em>,
240
 
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint8"><span class="type">guint8</span></a> *data</code></em>,
241
 
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> copy_pixels</code></em>,
242
 
                                                         <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>
 
239
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_new_from_inline          (<em class="parameter"><code><span class="type">gint</span> data_length</code></em>,
 
240
                                                         <em class="parameter"><code>const <span class="type">guint8</span> *data</code></em>,
 
241
                                                         <em class="parameter"><code><span class="type">gboolean</span> copy_pixels</code></em>,
 
242
                                                         <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
243
243
<p>
244
244
Create a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> from a flat representation that is suitable for
245
245
storing as inline data in a program. This is useful if you want to
270
270
<p>
271
271
For the typical case where the inline pixbuf is read-only static data,
272
272
you don't need to copy the pixel data unless you intend to write to
273
 
it, so you can pass <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for <em class="parameter"><code>copy_pixels</code></em>.  (If you pass 
 
273
it, so you can pass <code class="literal">FALSE</code> for <em class="parameter"><code>copy_pixels</code></em>.  (If you pass 
274
274
<code class="option">--rle</code> to <span class="command"><strong>gdk-pixbuf-csource</strong></span>, a copy 
275
 
will be made even if <em class="parameter"><code>copy_pixels</code></em> is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, so using this option is 
 
275
will be made even if <em class="parameter"><code>copy_pixels</code></em> is <code class="literal">FALSE</code>, so using this option is 
276
276
generally a bad idea.)
277
277
</p>
278
278
<p>
285
285
    <tbody>
286
286
      <tr>
287
287
        <td class="listing_lines" align="right"><pre>1</pre></td>
288
 
        <td class="listing_code"><pre class="programlisting"><span class="normal">pixbuf </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-inline">gdk_pixbuf_new_from_inline</a></span><span class="normal"> </span><span class="symbol">(-</span><span class="number">1</span><span class="symbol">,</span><span class="normal"> myimage_inline</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span></pre></td>
 
288
        <td class="listing_code"><pre class="programlisting"><span class="normal">pixbuf </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-inline">gdk_pixbuf_new_from_inline</a></span><span class="normal"> </span><span class="symbol">(-</span><span class="number">1</span><span class="symbol">,</span><span class="normal"> myimage_inline</span><span class="symbol">,</span><span class="normal"> FALSE</span><span class="symbol">,</span><span class="normal"> <a href="/home/mclasen/gnome/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS">NULL</a></span><span class="symbol">);</span></pre></td>
289
289
      </tr>
290
290
    </tbody>
291
291
  </table>
318
318
<tr>
319
319
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
320
320
<td>
321
 
<a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> return location, may be <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors</td>
 
321
<span class="type">GError</span> return location, may be <a href="/home/mclasen/gnome/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> to ignore errors</td>
322
322
</tr>
323
323
<tr>
324
324
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
325
325
<td>A newly-created <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> structure with a reference,
326
 
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 an error occurred.</td>
 
326
count of 1, or <a href="/home/mclasen/gnome/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if an error occurred.</td>
327
327
</tr>
328
328
</tbody>
329
329
</table></div>
397
397
</tr>
398
398
<tr>
399
399
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
400
 
<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
 
400
<td>A newly-created pixbuf with a reference count of 1, or <a href="/home/mclasen/gnome/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if
401
401
not enough memory could be allocated. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
402
402
</td>
403
403
</tr>