"Initial commit to Gerrit"
[profile/ivi/cogl.git] / doc / reference / cogl / html / cogl-Textures.html
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>Textures</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="Cogl Reference Manual">
8 <link rel="up" href="ch01.html" title="Cogl - a modern 3D graphics API">
9 <link rel="prev" href="cogl-Color-Type.html" title="Color Type">
10 <link rel="next" href="cogl-Blend-Strings.html" title="Material Blend Strings">
11 <meta name="generator" content="GTK-Doc V1.18.1 (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="cogl-Color-Type.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="ch01.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">Cogl Reference Manual</th>
21 <td><a accesskey="n" href="cogl-Blend-Strings.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="#cogl-Textures.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#cogl-Textures.description" class="shortcut">Description</a>
27 </td></tr>
28 </table>
29 <div class="refentry">
30 <a name="cogl-Textures"></a><div class="titlepage"></div>
31 <div class="refnamediv"><table width="100%"><tr>
32 <td valign="top">
33 <h2><span class="refentrytitle"><a name="cogl-Textures.top_of_page"></a>Textures</span></h2>
34 <p>Textures — Fuctions for creating and manipulating textures</p>
35 </td>
36 <td valign="top" align="right"></td>
37 </tr></table></div>
38 <div class="refsynopsisdiv">
39 <a name="cogl-Textures.synopsis"></a><h2>Synopsis</h2>
40 <pre class="synopsis">struct              <a class="link" href="cogl-Textures.html#CoglTextureVertex" title="struct CoglTextureVertex">CoglTextureVertex</a>;
41 enum                <a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags">CoglTextureFlags</a>;
42 <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       <a class="link" href="cogl-Textures.html#cogl-texture-new-with-size" title="cogl_texture_new_with_size ()">cogl_texture_new_with_size</a>          (<em class="parameter"><code>unsigned <span class="type">int</span> width</code></em>,
43                                                          <em class="parameter"><code>unsigned <span class="type">int</span> height</code></em>,
44                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
45                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>);
46 <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       <a class="link" href="cogl-Textures.html#cogl-texture-new-from-file" title="cogl_texture_new_from_file ()">cogl_texture_new_from_file</a>          (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
47                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
48                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>,
49                                                          <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>);
50 <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       <a class="link" href="cogl-Textures.html#cogl-texture-new-from-data" title="cogl_texture_new_from_data ()">cogl_texture_new_from_data</a>          (<em class="parameter"><code>unsigned <span class="type">int</span> width</code></em>,
51                                                          <em class="parameter"><code>unsigned <span class="type">int</span> height</code></em>,
52                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
53                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>,
54                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>,
55                                                          <em class="parameter"><code>unsigned <span class="type">int</span> rowstride</code></em>,
56                                                          <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>);
57 <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       <a class="link" href="cogl-Textures.html#cogl-texture-new-from-foreign" title="cogl_texture_new_from_foreign ()">cogl_texture_new_from_foreign</a>       (<em class="parameter"><code><span class="type">GLuint</span> gl_handle</code></em>,
58                                                          <em class="parameter"><code><span class="type">GLenum</span> gl_target</code></em>,
59                                                          <em class="parameter"><code><span class="type">GLuint</span> width</code></em>,
60                                                          <em class="parameter"><code><span class="type">GLuint</span> height</code></em>,
61                                                          <em class="parameter"><code><span class="type">GLuint</span> x_pot_waste</code></em>,
62                                                          <em class="parameter"><code><span class="type">GLuint</span> y_pot_waste</code></em>,
63                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>);
64 <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       <a class="link" href="cogl-Textures.html#cogl-texture-new-from-bitmap" title="cogl_texture_new_from_bitmap ()">cogl_texture_new_from_bitmap</a>        (<em class="parameter"><code><a class="link" href="cogl-Bitmaps.html#CoglBitmap" title="CoglBitmap"><span class="type">CoglBitmap</span></a> *bitmap</code></em>,
65                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
66                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>);
67 <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       <a class="link" href="cogl-Textures.html#cogl-texture-new-from-sub-texture" title="cogl_texture_new_from_sub_texture ()">cogl_texture_new_from_sub_texture</a>   (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *full_texture</code></em>,
68                                                          <em class="parameter"><code><span class="type">int</span> sub_x</code></em>,
69                                                          <em class="parameter"><code><span class="type">int</span> sub_y</code></em>,
70                                                          <em class="parameter"><code><span class="type">int</span> sub_width</code></em>,
71                                                          <em class="parameter"><code><span class="type">int</span> sub_height</code></em>);
72 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="cogl-Textures.html#cogl-is-texture" title="cogl_is_texture ()">cogl_is_texture</a>                     (<em class="parameter"><code><span class="type">void</span> *object</code></em>);
73
74 unsigned <span class="returnvalue">int</span>        <a class="link" href="cogl-Textures.html#cogl-texture-get-width" title="cogl_texture_get_width ()">cogl_texture_get_width</a>              (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);
75 unsigned <span class="returnvalue">int</span>        <a class="link" href="cogl-Textures.html#cogl-texture-get-height" title="cogl_texture_get_height ()">cogl_texture_get_height</a>             (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);
76 <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="returnvalue">CoglPixelFormat</span></a>     <a class="link" href="cogl-Textures.html#cogl-texture-get-format" title="cogl_texture_get_format ()">cogl_texture_get_format</a>             (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);
77 unsigned <span class="returnvalue">int</span>        <a class="link" href="cogl-Textures.html#cogl-texture-get-rowstride" title="cogl_texture_get_rowstride ()">cogl_texture_get_rowstride</a>          (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);
78 <span class="returnvalue">int</span>                 <a class="link" href="cogl-Textures.html#cogl-texture-get-max-waste" title="cogl_texture_get_max_waste ()">cogl_texture_get_max_waste</a>          (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);
79 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="cogl-Textures.html#cogl-texture-is-sliced" title="cogl_texture_is_sliced ()">cogl_texture_is_sliced</a>              (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);
80 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="cogl-Textures.html#cogl-texture-get-gl-texture" title="cogl_texture_get_gl_texture ()">cogl_texture_get_gl_texture</a>         (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>,
81                                                          <em class="parameter"><code><span class="type">GLuint</span> *out_gl_handle</code></em>,
82                                                          <em class="parameter"><code><span class="type">GLenum</span> *out_gl_target</code></em>);
83 <span class="returnvalue">int</span>                 <a class="link" href="cogl-Textures.html#cogl-texture-get-data" title="cogl_texture_get_data ()">cogl_texture_get_data</a>               (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>,
84                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>,
85                                                          <em class="parameter"><code>unsigned <span class="type">int</span> rowstride</code></em>,
86                                                          <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint8"><span class="type">guint8</span></a> *data</code></em>);
87 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="cogl-Textures.html#cogl-texture-set-region" title="cogl_texture_set_region ()">cogl_texture_set_region</a>             (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>,
88                                                          <em class="parameter"><code><span class="type">int</span> src_x</code></em>,
89                                                          <em class="parameter"><code><span class="type">int</span> src_y</code></em>,
90                                                          <em class="parameter"><code><span class="type">int</span> dst_x</code></em>,
91                                                          <em class="parameter"><code><span class="type">int</span> dst_y</code></em>,
92                                                          <em class="parameter"><code>unsigned <span class="type">int</span> dst_width</code></em>,
93                                                          <em class="parameter"><code>unsigned <span class="type">int</span> dst_height</code></em>,
94                                                          <em class="parameter"><code><span class="type">int</span> width</code></em>,
95                                                          <em class="parameter"><code><span class="type">int</span> height</code></em>,
96                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>,
97                                                          <em class="parameter"><code>unsigned <span class="type">int</span> rowstride</code></em>,
98                                                          <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>);
99 </pre>
100 </div>
101 <div class="refsect1">
102 <a name="cogl-Textures.description"></a><h2>Description</h2>
103 <p>
104 Cogl allows creating and manipulating textures using a uniform
105 API that tries to hide all the various complexities of creating,
106 loading and manipulating textures.
107 </p>
108 </div>
109 <div class="refsect1">
110 <a name="cogl-Textures.details"></a><h2>Details</h2>
111 <div class="refsect2">
112 <a name="CoglTextureVertex"></a><h3>struct CoglTextureVertex</h3>
113 <pre class="programlisting">struct CoglTextureVertex {
114   float x, y, z;
115   float tx, ty;
116
117   CoglColor color;
118 };
119 </pre>
120 <p>
121 Used to specify vertex information when calling <a class="link" href="cogl-Primitives.html#cogl-polygon" title="cogl_polygon ()"><code class="function">cogl_polygon()</code></a>
122 </p>
123 <div class="variablelist"><table border="0">
124 <col align="left" valign="top">
125 <tbody>
126 <tr>
127 <td><p><span class="term"><span class="type">float</span> <em class="structfield"><code><a name="CoglTextureVertex.x"></a>x</code></em>;</span></p></td>
128 <td>Model x-coordinate</td>
129 </tr>
130 <tr>
131 <td><p><span class="term"><span class="type">float</span> <em class="structfield"><code><a name="CoglTextureVertex.y"></a>y</code></em>;</span></p></td>
132 <td>Model y-coordinate</td>
133 </tr>
134 <tr>
135 <td><p><span class="term"><span class="type">float</span> <em class="structfield"><code><a name="CoglTextureVertex.z"></a>z</code></em>;</span></p></td>
136 <td>Model z-coordinate</td>
137 </tr>
138 <tr>
139 <td><p><span class="term"><span class="type">float</span> <em class="structfield"><code><a name="CoglTextureVertex.tx"></a>tx</code></em>;</span></p></td>
140 <td>Texture x-coordinate</td>
141 </tr>
142 <tr>
143 <td><p><span class="term"><span class="type">float</span> <em class="structfield"><code><a name="CoglTextureVertex.ty"></a>ty</code></em>;</span></p></td>
144 <td>Texture y-coordinate</td>
145 </tr>
146 <tr>
147 <td><p><span class="term"><a class="link" href="cogl-Color-Type.html#CoglColor" title="struct CoglColor"><span class="type">CoglColor</span></a> <em class="structfield"><code><a name="CoglTextureVertex.color"></a>color</code></em>;</span></p></td>
148 <td>The color to use at this vertex. This is ignored if
149 use_color is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> when calling <a class="link" href="cogl-Primitives.html#cogl-polygon" title="cogl_polygon ()"><code class="function">cogl_polygon()</code></a>
150 </td>
151 </tr>
152 </tbody>
153 </table></div>
154 </div>
155 <hr>
156 <div class="refsect2">
157 <a name="CoglTextureFlags"></a><h3>enum CoglTextureFlags</h3>
158 <pre class="programlisting">typedef enum {
159   COGL_TEXTURE_NONE           = 0,
160   COGL_TEXTURE_NO_AUTO_MIPMAP = 1 &lt;&lt; 0,
161   COGL_TEXTURE_NO_SLICING     = 1 &lt;&lt; 1,
162   COGL_TEXTURE_NO_ATLAS       = 1 &lt;&lt; 2
163 } CoglTextureFlags;
164 </pre>
165 <p>
166 Flags to pass to the cogl_texture_new_* family of functions.
167 </p>
168 <div class="variablelist"><table border="0">
169 <col align="left" valign="top">
170 <tbody>
171 <tr>
172 <td><p><a name="COGL-TEXTURE-NONE:CAPS"></a><span class="term"><code class="literal">COGL_TEXTURE_NONE</code></span></p></td>
173 <td>No flags specified
174 </td>
175 </tr>
176 <tr>
177 <td><p><a name="COGL-TEXTURE-NO-AUTO-MIPMAP:CAPS"></a><span class="term"><code class="literal">COGL_TEXTURE_NO_AUTO_MIPMAP</code></span></p></td>
178 <td>Disables the automatic generation of
179   the mipmap pyramid from the base level image whenever it is
180   updated. The mipmaps are only generated when the texture is
181   rendered with a mipmap filter so it should be free to leave out
182   this flag when using other filtering modes
183 </td>
184 </tr>
185 <tr>
186 <td><p><a name="COGL-TEXTURE-NO-SLICING:CAPS"></a><span class="term"><code class="literal">COGL_TEXTURE_NO_SLICING</code></span></p></td>
187 <td>Disables the slicing of the texture
188 </td>
189 </tr>
190 <tr>
191 <td><p><a name="COGL-TEXTURE-NO-ATLAS:CAPS"></a><span class="term"><code class="literal">COGL_TEXTURE_NO_ATLAS</code></span></p></td>
192 <td>Disables the insertion of the texture inside
193   the texture atlas used by Cogl
194 </td>
195 </tr>
196 </tbody>
197 </table></div>
198 <p class="since">Since 1.0</p>
199 </div>
200 <hr>
201 <div class="refsect2">
202 <a name="cogl-texture-new-with-size"></a><h3>cogl_texture_new_with_size ()</h3>
203 <pre class="programlisting"><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       cogl_texture_new_with_size          (<em class="parameter"><code>unsigned <span class="type">int</span> width</code></em>,
204                                                          <em class="parameter"><code>unsigned <span class="type">int</span> height</code></em>,
205                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
206                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>);</pre>
207 <p>
208 Creates a new <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> with the specified dimensions and pixel format.
209 </p>
210 <div class="variablelist"><table border="0">
211 <col align="left" valign="top">
212 <tbody>
213 <tr>
214 <td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
215 <td>width of texture in pixels.</td>
216 </tr>
217 <tr>
218 <td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
219 <td>height of texture in pixels.</td>
220 </tr>
221 <tr>
222 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
223 <td>Optional flags for the texture, or <a class="link" href="cogl-Textures.html#COGL-TEXTURE-NONE:CAPS"><code class="literal">COGL_TEXTURE_NONE</code></a>
224 </td>
225 </tr>
226 <tr>
227 <td><p><span class="term"><em class="parameter"><code>internal_format</code></em> :</span></p></td>
228 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> to use for the GPU storage of the
229 texture.</td>
230 </tr>
231 <tr>
232 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
233 <td>A newly created <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td>
234 </tr>
235 </tbody>
236 </table></div>
237 <p class="since">Since 0.8</p>
238 </div>
239 <hr>
240 <div class="refsect2">
241 <a name="cogl-texture-new-from-file"></a><h3>cogl_texture_new_from_file ()</h3>
242 <pre class="programlisting"><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       cogl_texture_new_from_file          (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
243                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
244                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>,
245                                                          <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>
246 <p>
247 Creates a <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> from an image file.
248 </p>
249 <div class="variablelist"><table border="0">
250 <col align="left" valign="top">
251 <tbody>
252 <tr>
253 <td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
254 <td>the file to load</td>
255 </tr>
256 <tr>
257 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
258 <td>Optional flags for the texture, or <a class="link" href="cogl-Textures.html#COGL-TEXTURE-NONE:CAPS"><code class="literal">COGL_TEXTURE_NONE</code></a>
259 </td>
260 </tr>
261 <tr>
262 <td><p><span class="term"><em class="parameter"><code>internal_format</code></em> :</span></p></td>
263 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> to use for the GPU storage of the
264 texture. If <a class="link" href="cogl-General-API.html#COGL-PIXEL-FORMAT-ANY:CAPS"><code class="literal">COGL_PIXEL_FORMAT_ANY</code></a> is given then a premultiplied
265 format similar to the format of the source data will be used. The
266 default blending equations of Cogl expect premultiplied color data;
267 the main use of passing a non-premultiplied format here is if you
268 have non-premultiplied source data and are going to adjust the blend
269 mode (see <a class="link" href="cogl-Materials.html#cogl-material-set-blend" title="cogl_material_set_blend ()"><code class="function">cogl_material_set_blend()</code></a>) or use the data for something
270 other than straight blending.</td>
271 </tr>
272 <tr>
273 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
274 <td>return location for a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
275 </td>
276 </tr>
277 <tr>
278 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
279 <td>A newly created <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td>
280 </tr>
281 </tbody>
282 </table></div>
283 <p class="since">Since 0.8</p>
284 </div>
285 <hr>
286 <div class="refsect2">
287 <a name="cogl-texture-new-from-data"></a><h3>cogl_texture_new_from_data ()</h3>
288 <pre class="programlisting"><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       cogl_texture_new_from_data          (<em class="parameter"><code>unsigned <span class="type">int</span> width</code></em>,
289                                                          <em class="parameter"><code>unsigned <span class="type">int</span> height</code></em>,
290                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
291                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>,
292                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>,
293                                                          <em class="parameter"><code>unsigned <span class="type">int</span> rowstride</code></em>,
294                                                          <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>);</pre>
295 <p>
296 Creates a new <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> based on data residing in memory.
297 </p>
298 <div class="variablelist"><table border="0">
299 <col align="left" valign="top">
300 <tbody>
301 <tr>
302 <td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
303 <td>width of texture in pixels</td>
304 </tr>
305 <tr>
306 <td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
307 <td>height of texture in pixels</td>
308 </tr>
309 <tr>
310 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
311 <td>Optional flags for the texture, or <a class="link" href="cogl-Textures.html#COGL-TEXTURE-NONE:CAPS"><code class="literal">COGL_TEXTURE_NONE</code></a>
312 </td>
313 </tr>
314 <tr>
315 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
316 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> the buffer is stored in in RAM</td>
317 </tr>
318 <tr>
319 <td><p><span class="term"><em class="parameter"><code>internal_format</code></em> :</span></p></td>
320 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> that will be used for storing
321 the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
322 premultiplied format similar to the format of the source data will
323 be used. The default blending equations of Cogl expect premultiplied
324 color data; the main use of passing a non-premultiplied format here
325 is if you have non-premultiplied source data and are going to adjust
326 the blend mode (see <a class="link" href="cogl-Materials.html#cogl-material-set-blend" title="cogl_material_set_blend ()"><code class="function">cogl_material_set_blend()</code></a>) or use the data for
327 something other than straight blending.</td>
328 </tr>
329 <tr>
330 <td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
331 <td>the memory offset in bytes between the starts of
332 scanlines in <em class="parameter"><code>data</code></em>
333 </td>
334 </tr>
335 <tr>
336 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
337 <td>pointer the memory region where the source buffer resides</td>
338 </tr>
339 <tr>
340 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
341 <td>A newly created <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td>
342 </tr>
343 </tbody>
344 </table></div>
345 <p class="since">Since 0.8</p>
346 </div>
347 <hr>
348 <div class="refsect2">
349 <a name="cogl-texture-new-from-foreign"></a><h3>cogl_texture_new_from_foreign ()</h3>
350 <pre class="programlisting"><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       cogl_texture_new_from_foreign       (<em class="parameter"><code><span class="type">GLuint</span> gl_handle</code></em>,
351                                                          <em class="parameter"><code><span class="type">GLenum</span> gl_target</code></em>,
352                                                          <em class="parameter"><code><span class="type">GLuint</span> width</code></em>,
353                                                          <em class="parameter"><code><span class="type">GLuint</span> height</code></em>,
354                                                          <em class="parameter"><code><span class="type">GLuint</span> x_pot_waste</code></em>,
355                                                          <em class="parameter"><code><span class="type">GLuint</span> y_pot_waste</code></em>,
356                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>);</pre>
357 <p>
358 Creates a <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> based on an existing OpenGL texture; the
359 width, height and format are passed along since it is not always
360 possible to query these from OpenGL.
361 </p>
362 <p>
363 The waste arguments allow you to create a Cogl texture that maps to
364 a region smaller than the real OpenGL texture. For instance if your
365 hardware only supports power-of-two textures you may load a
366 non-power-of-two image into a larger power-of-two texture and use
367 the waste arguments to tell Cogl which region should be mapped to
368 the texture coordinate range [0:1].
369 </p>
370 <div class="variablelist"><table border="0">
371 <col align="left" valign="top">
372 <tbody>
373 <tr>
374 <td><p><span class="term"><em class="parameter"><code>gl_handle</code></em> :</span></p></td>
375 <td>opengl handle of foreign texture.</td>
376 </tr>
377 <tr>
378 <td><p><span class="term"><em class="parameter"><code>gl_target</code></em> :</span></p></td>
379 <td>opengl target type of foreign texture</td>
380 </tr>
381 <tr>
382 <td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
383 <td>width of foreign texture</td>
384 </tr>
385 <tr>
386 <td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
387 <td>height of foreign texture.</td>
388 </tr>
389 <tr>
390 <td><p><span class="term"><em class="parameter"><code>x_pot_waste</code></em> :</span></p></td>
391 <td>horizontal waste on the right hand edge of the texture.</td>
392 </tr>
393 <tr>
394 <td><p><span class="term"><em class="parameter"><code>y_pot_waste</code></em> :</span></p></td>
395 <td>vertical waste on the bottom edge of the texture.</td>
396 </tr>
397 <tr>
398 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
399 <td>format of the foreign texture.</td>
400 </tr>
401 <tr>
402 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
403 <td>A newly created <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td>
404 </tr>
405 </tbody>
406 </table></div>
407 <p class="since">Since 0.8</p>
408 </div>
409 <hr>
410 <div class="refsect2">
411 <a name="cogl-texture-new-from-bitmap"></a><h3>cogl_texture_new_from_bitmap ()</h3>
412 <pre class="programlisting"><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       cogl_texture_new_from_bitmap        (<em class="parameter"><code><a class="link" href="cogl-Bitmaps.html#CoglBitmap" title="CoglBitmap"><span class="type">CoglBitmap</span></a> *bitmap</code></em>,
413                                                          <em class="parameter"><code><a class="link" href="cogl-Textures.html#CoglTextureFlags" title="enum CoglTextureFlags"><span class="type">CoglTextureFlags</span></a> flags</code></em>,
414                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>);</pre>
415 <p>
416 Creates a <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> from a <a class="link" href="cogl-Bitmaps.html#CoglBitmap" title="CoglBitmap"><span class="type">CoglBitmap</span></a>.
417 </p>
418 <div class="variablelist"><table border="0">
419 <col align="left" valign="top">
420 <tbody>
421 <tr>
422 <td><p><span class="term"><em class="parameter"><code>bitmap</code></em> :</span></p></td>
423 <td>A <a class="link" href="cogl-Bitmaps.html#CoglBitmap" title="CoglBitmap"><span class="type">CoglBitmap</span></a> pointer</td>
424 </tr>
425 <tr>
426 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
427 <td>Optional flags for the texture, or <a class="link" href="cogl-Textures.html#COGL-TEXTURE-NONE:CAPS"><code class="literal">COGL_TEXTURE_NONE</code></a>
428 </td>
429 </tr>
430 <tr>
431 <td><p><span class="term"><em class="parameter"><code>internal_format</code></em> :</span></p></td>
432 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> to use for the GPU storage of the
433 texture</td>
434 </tr>
435 <tr>
436 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
437 <td>A newly created <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td>
438 </tr>
439 </tbody>
440 </table></div>
441 <p class="since">Since 1.0</p>
442 </div>
443 <hr>
444 <div class="refsect2">
445 <a name="cogl-texture-new-from-sub-texture"></a><h3>cogl_texture_new_from_sub_texture ()</h3>
446 <pre class="programlisting"><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="returnvalue">CoglTexture</span></a> *       cogl_texture_new_from_sub_texture   (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *full_texture</code></em>,
447                                                          <em class="parameter"><code><span class="type">int</span> sub_x</code></em>,
448                                                          <em class="parameter"><code><span class="type">int</span> sub_y</code></em>,
449                                                          <em class="parameter"><code><span class="type">int</span> sub_width</code></em>,
450                                                          <em class="parameter"><code><span class="type">int</span> sub_height</code></em>);</pre>
451 <p>
452 Creates a new texture which represents a subregion of another
453 texture. The GL resources will be shared so that no new texture
454 data is actually allocated.
455 </p>
456 <p>
457 Sub textures have undefined behaviour texture coordinates outside
458 of the range [0,1] are used. They also do not work with
459 CoglVertexBuffers.
460 </p>
461 <p>
462 The sub texture will keep a reference to the full texture so you do
463 not need to keep one separately if you only want to use the sub
464 texture.
465 </p>
466 <div class="variablelist"><table border="0">
467 <col align="left" valign="top">
468 <tbody>
469 <tr>
470 <td><p><span class="term"><em class="parameter"><code>full_texture</code></em> :</span></p></td>
471 <td>a <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> pointer</td>
472 </tr>
473 <tr>
474 <td><p><span class="term"><em class="parameter"><code>sub_x</code></em> :</span></p></td>
475 <td>X coordinate of the top-left of the subregion</td>
476 </tr>
477 <tr>
478 <td><p><span class="term"><em class="parameter"><code>sub_y</code></em> :</span></p></td>
479 <td>Y coordinate of the top-left of the subregion</td>
480 </tr>
481 <tr>
482 <td><p><span class="term"><em class="parameter"><code>sub_width</code></em> :</span></p></td>
483 <td>Width in pixels of the subregion</td>
484 </tr>
485 <tr>
486 <td><p><span class="term"><em class="parameter"><code>sub_height</code></em> :</span></p></td>
487 <td>Height in pixels of the subregion</td>
488 </tr>
489 <tr>
490 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
491 <td>A newly created <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td>
492 </tr>
493 </tbody>
494 </table></div>
495 <p class="since">Since 1.2</p>
496 </div>
497 <hr>
498 <div class="refsect2">
499 <a name="cogl-is-texture"></a><h3>cogl_is_texture ()</h3>
500 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            cogl_is_texture                     (<em class="parameter"><code><span class="type">void</span> *object</code></em>);</pre>
501 <p>
502 Gets whether the given object references a texture object.
503 </p>
504 <div class="variablelist"><table border="0">
505 <col align="left" valign="top">
506 <tbody>
507 <tr>
508 <td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
509 <td>A <a class="link" href="cogl-General-API.html#CoglObject" title="CoglObject"><span class="type">CoglObject</span></a> pointer</td>
510 </tr>
511 <tr>
512 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
513 <td>
514 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the handle references a texture, and
515 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
516 </tr>
517 </tbody>
518 </table></div>
519 </div>
520 <hr>
521 <div class="refsect2">
522 <a name="cogl-texture-get-width"></a><h3>cogl_texture_get_width ()</h3>
523 <pre class="programlisting">unsigned <span class="returnvalue">int</span>        cogl_texture_get_width              (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);</pre>
524 <p>
525 Queries the width of a cogl texture.
526 </p>
527 <div class="variablelist"><table border="0">
528 <col align="left" valign="top">
529 <tbody><tr>
530 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
531 <td>the width of the GPU side texture in pixels</td>
532 </tr></tbody>
533 </table></div>
534 </div>
535 <hr>
536 <div class="refsect2">
537 <a name="cogl-texture-get-height"></a><h3>cogl_texture_get_height ()</h3>
538 <pre class="programlisting">unsigned <span class="returnvalue">int</span>        cogl_texture_get_height             (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);</pre>
539 <p>
540 Queries the height of a cogl texture.
541 </p>
542 <div class="variablelist"><table border="0">
543 <col align="left" valign="top">
544 <tbody><tr>
545 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
546 <td>the height of the GPU side texture in pixels</td>
547 </tr></tbody>
548 </table></div>
549 </div>
550 <hr>
551 <div class="refsect2">
552 <a name="cogl-texture-get-format"></a><h3>cogl_texture_get_format ()</h3>
553 <pre class="programlisting"><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="returnvalue">CoglPixelFormat</span></a>     cogl_texture_get_format             (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);</pre>
554 <p>
555 Queries the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> of a cogl texture.
556 </p>
557 <div class="variablelist"><table border="0">
558 <col align="left" valign="top">
559 <tbody><tr>
560 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
561 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> of the GPU side texture</td>
562 </tr></tbody>
563 </table></div>
564 </div>
565 <hr>
566 <div class="refsect2">
567 <a name="cogl-texture-get-rowstride"></a><h3>cogl_texture_get_rowstride ()</h3>
568 <pre class="programlisting">unsigned <span class="returnvalue">int</span>        cogl_texture_get_rowstride          (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);</pre>
569 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
570 <h3 class="title">Warning</h3>
571 <p><code class="literal">cogl_texture_get_rowstride</code> has been deprecated since version 1.10 and should not be used in newly-written code. There's no replacement for the API but there's
572                   also no known need for API either. It was just
573                   a mistake that it was ever published.</p>
574 </div>
575 <p>
576 Determines the bytes-per-pixel for the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> retrieved
577 from <a class="link" href="cogl-Textures.html#cogl-texture-get-format" title="cogl_texture_get_format ()"><code class="function">cogl_texture_get_format()</code></a> and multiplies that by the texture's
578 width.
579 </p>
580 <p>
581 </p>
582 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
583 <h3 class="title">Note</h3>It's very unlikely that anyone would need to use this API to
584 query the internal rowstride of a <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> which can just be
585 considered an implementation detail. Actually it's not even useful
586 internally since underlying drivers are free to use a different
587 format</div>
588 <p>
589 </p>
590 <p>
591 </p>
592 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
593 <h3 class="title">Note</h3>This API is only here for backwards compatibility and
594 shouldn't be used in new code. In particular please don't be
595 mislead to pass the returned value to <a class="link" href="cogl-Textures.html#cogl-texture-get-data" title="cogl_texture_get_data ()"><code class="function">cogl_texture_get_data()</code></a> for
596 the rowstride, since you should be passing the rowstride you desire
597 for your destination buffer not the rowstride of the source
598 texture.</div>
599 <p>
600 </p>
601 <div class="variablelist"><table border="0">
602 <col align="left" valign="top">
603 <tbody><tr>
604 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
605 <td>The bytes-per-pixel for the current format
606 multiplied by the texture's width</td>
607 </tr></tbody>
608 </table></div>
609 </div>
610 <hr>
611 <div class="refsect2">
612 <a name="cogl-texture-get-max-waste"></a><h3>cogl_texture_get_max_waste ()</h3>
613 <pre class="programlisting"><span class="returnvalue">int</span>                 cogl_texture_get_max_waste          (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);</pre>
614 <p>
615 Queries the maximum wasted (unused) pixels in one dimension of a GPU side
616 texture.
617 </p>
618 <div class="variablelist"><table border="0">
619 <col align="left" valign="top">
620 <tbody><tr>
621 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
622 <td>the maximum waste</td>
623 </tr></tbody>
624 </table></div>
625 </div>
626 <hr>
627 <div class="refsect2">
628 <a name="cogl-texture-is-sliced"></a><h3>cogl_texture_is_sliced ()</h3>
629 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            cogl_texture_is_sliced              (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>);</pre>
630 <p>
631 Queries if a texture is sliced (stored as multiple GPU side tecture
632 objects).
633 </p>
634 <div class="variablelist"><table border="0">
635 <col align="left" valign="top">
636 <tbody><tr>
637 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
638 <td>
639 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the texture is sliced, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the texture
640 is stored as a single GPU texture</td>
641 </tr></tbody>
642 </table></div>
643 </div>
644 <hr>
645 <div class="refsect2">
646 <a name="cogl-texture-get-gl-texture"></a><h3>cogl_texture_get_gl_texture ()</h3>
647 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            cogl_texture_get_gl_texture         (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>,
648                                                          <em class="parameter"><code><span class="type">GLuint</span> *out_gl_handle</code></em>,
649                                                          <em class="parameter"><code><span class="type">GLenum</span> *out_gl_target</code></em>);</pre>
650 <p>
651 Queries the GL handles for a GPU side texture through its <a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a>.
652 </p>
653 <p>
654 If the texture is spliced the data for the first sub texture will be
655 queried.
656 </p>
657 <div class="variablelist"><table border="0">
658 <col align="left" valign="top">
659 <tbody>
660 <tr>
661 <td><p><span class="term"><em class="parameter"><code>out_gl_handle</code></em> :</span></p></td>
662 <td>pointer to return location for the
663 textures GL handle, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
664 </td>
665 </tr>
666 <tr>
667 <td><p><span class="term"><em class="parameter"><code>out_gl_target</code></em> :</span></p></td>
668 <td>pointer to return location for the
669 GL target type, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
670 </td>
671 </tr>
672 <tr>
673 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
674 <td>
675 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the handle was successfully retrieved, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
676 if the handle was invalid</td>
677 </tr>
678 </tbody>
679 </table></div>
680 </div>
681 <hr>
682 <div class="refsect2">
683 <a name="cogl-texture-get-data"></a><h3>cogl_texture_get_data ()</h3>
684 <pre class="programlisting"><span class="returnvalue">int</span>                 cogl_texture_get_data               (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>,
685                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>,
686                                                          <em class="parameter"><code>unsigned <span class="type">int</span> rowstride</code></em>,
687                                                          <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint8"><span class="type">guint8</span></a> *data</code></em>);</pre>
688 <p>
689 Copies the pixel data from a cogl texture to system memory.
690 </p>
691 <p>
692 </p>
693 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
694 <h3 class="title">Note</h3>Don't pass the value of <a class="link" href="cogl-Textures.html#cogl-texture-get-rowstride" title="cogl_texture_get_rowstride ()"><code class="function">cogl_texture_get_rowstride()</code></a> as the
695 <em class="parameter"><code>rowstride</code></em> argument, the rowstride should be the rowstride you
696 want for the destination <em class="parameter"><code>data</code></em> buffer not the rowstride of the
697 source texture</div>
698 <p>
699 </p>
700 <div class="variablelist"><table border="0">
701 <col align="left" valign="top">
702 <tbody>
703 <tr>
704 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
705 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> to store the texture as.</td>
706 </tr>
707 <tr>
708 <td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
709 <td>the rowstride of <em class="parameter"><code>data</code></em> in bytes or pass 0 to calculate
710 from the bytes-per-pixel of <em class="parameter"><code>format</code></em> multiplied by the
711 <em class="parameter"><code>texture</code></em> width.</td>
712 </tr>
713 <tr>
714 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
715 <td>memory location to write the <em class="parameter"><code>texture</code></em>'s contents, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
716 to only query the data size through the return value.</td>
717 </tr>
718 <tr>
719 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
720 <td>the size of the texture data in bytes</td>
721 </tr>
722 </tbody>
723 </table></div>
724 </div>
725 <hr>
726 <div class="refsect2">
727 <a name="cogl-texture-set-region"></a><h3>cogl_texture_set_region ()</h3>
728 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            cogl_texture_set_region             (<em class="parameter"><code><a href="../cogl-2.0-experimental/cogl-2.0-experimental-The-Texture-Interface.html#CoglTexture"><span class="type">CoglTexture</span></a> *texture</code></em>,
729                                                          <em class="parameter"><code><span class="type">int</span> src_x</code></em>,
730                                                          <em class="parameter"><code><span class="type">int</span> src_y</code></em>,
731                                                          <em class="parameter"><code><span class="type">int</span> dst_x</code></em>,
732                                                          <em class="parameter"><code><span class="type">int</span> dst_y</code></em>,
733                                                          <em class="parameter"><code>unsigned <span class="type">int</span> dst_width</code></em>,
734                                                          <em class="parameter"><code>unsigned <span class="type">int</span> dst_height</code></em>,
735                                                          <em class="parameter"><code><span class="type">int</span> width</code></em>,
736                                                          <em class="parameter"><code><span class="type">int</span> height</code></em>,
737                                                          <em class="parameter"><code><a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> format</code></em>,
738                                                          <em class="parameter"><code>unsigned <span class="type">int</span> rowstride</code></em>,
739                                                          <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>);</pre>
740 <p>
741 Sets the pixels in a rectangular subregion of <em class="parameter"><code>texture</code></em> from an in-memory
742 buffer containing pixel data.
743 </p>
744 <p>
745 </p>
746 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
747 <h3 class="title">Note</h3>The region set can't be larger than the source <em class="parameter"><code>data</code></em>
748 </div>
749 <p>
750 </p>
751 <div class="variablelist"><table border="0">
752 <col align="left" valign="top">
753 <tbody>
754 <tr>
755 <td><p><span class="term"><em class="parameter"><code>src_x</code></em> :</span></p></td>
756 <td>upper left coordinate to use from source data.</td>
757 </tr>
758 <tr>
759 <td><p><span class="term"><em class="parameter"><code>src_y</code></em> :</span></p></td>
760 <td>upper left coordinate to use from source data.</td>
761 </tr>
762 <tr>
763 <td><p><span class="term"><em class="parameter"><code>dst_x</code></em> :</span></p></td>
764 <td>upper left destination horizontal coordinate.</td>
765 </tr>
766 <tr>
767 <td><p><span class="term"><em class="parameter"><code>dst_y</code></em> :</span></p></td>
768 <td>upper left destination vertical coordinate.</td>
769 </tr>
770 <tr>
771 <td><p><span class="term"><em class="parameter"><code>dst_width</code></em> :</span></p></td>
772 <td>width of destination region to write. (Must be less
773 than or equal to <em class="parameter"><code>width</code></em>)</td>
774 </tr>
775 <tr>
776 <td><p><span class="term"><em class="parameter"><code>dst_height</code></em> :</span></p></td>
777 <td>height of destination region to write. (Must be less
778 than or equal to <em class="parameter"><code>height</code></em>)</td>
779 </tr>
780 <tr>
781 <td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
782 <td>width of source data buffer.</td>
783 </tr>
784 <tr>
785 <td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
786 <td>height of source data buffer.</td>
787 </tr>
788 <tr>
789 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
790 <td>the <a class="link" href="cogl-General-API.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> used in the source buffer.</td>
791 </tr>
792 <tr>
793 <td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
794 <td>rowstride of source buffer (computed from width if none
795 specified)</td>
796 </tr>
797 <tr>
798 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
799 <td>the actual pixel data.</td>
800 </tr>
801 <tr>
802 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
803 <td>
804 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the subregion upload was successful, and
805 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
806 </tr>
807 </tbody>
808 </table></div>
809 </div>
810 </div>
811 </div>
812 <div class="footer">
813 <hr>
814           Generated by GTK-Doc V1.18.1</div>
815 </body>
816 </html>