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