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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: CastleImages</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<h1 class="unit">Unit CastleImages</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Uses">Uses</a></td><td><a class="section" href="#PasDoc-Classes">Classes, Interfaces, Objects and Records</a></td><td><a class="section" href="#PasDoc-FuncsProcs">Functions and Procedures</a></td><td><a class="section" href="#PasDoc-Types">Types</a></td><td><a class="section" href="#PasDoc-Constants">Constants</a></td><td><a class="section" href="#PasDoc-Variables">Variables</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="description">Description</h2>
<p>
Loading, saving, and processing of images (<a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> and friends). Storing images in the memory, loading and saving them from/to files in various formats, resizing, converting to grayscale, copying and merging, many other image operations — it's all here. We include here special image types useful with modern GPUs: image data compressed for GPU (<a class="normal" href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a>) and 3D image data (every image has <code>Depth</code> in addition to <code>Width</code> and <code>Height</code>).
<p>The most important class here is <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>. It represents an image as a simple uncompressed array of pixels. Descendants of <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> define what exactly is a "pixel". We have 8-bit color images (<a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>, <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>, <a class="normal" href="CastleImages.TGrayscaleAlphaImage.html">TGrayscaleAlphaImage</a> and <a class="normal" href="CastleImages.TGrayscaleImage.html">TGrayscaleImage</a>). We also have an image with floating-point precision and range: <a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a>.
<p>There is also a more abstract image class <a class="normal" href="CastleImages.TEncodedImage.html">TEncodedImage</a>, representing either uncompressed image (<a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>) or an image with data compressed for GPU (<a class="normal" href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a>).
<p>When reading and writing image files, we understand various image formats. (See TImageFormat in castleimages_file_formats.inc documentation for a current list of supported formats, with comments specific to particular formats.) The basic loading and saving procedures and <a class="normal" href="CastleImages.html#LoadImage">LoadImage</a> and <a class="normal" href="CastleImages.html#SaveImage">SaveImage</a>.
<p>Example usage of this unit:
<p></p>
<pre class="longcode">
<span class="pascal_keyword">var</span>
Image: TCastleImage;
<span class="pascal_keyword">begin</span>
Image := LoadImage(<span class="pascal_string">'image.png'</span>);
<span class="pascal_comment">{ scale the image to be 2x smaller }</span>
Image.Resize(Image.Width <span class="pascal_keyword">div</span> <span class="pascal_numeric">2</span>, Image.Height <span class="pascal_keyword">div</span> <span class="pascal_numeric">2</span>);
SaveImage(Image, <span class="pascal_string">'newimage.png'</span>);
<span class="pascal_keyword">end</span>;
</pre>
<p>
<p>This unit is not dependent on OpenGL or any other rendering library. See <a class="normal" href="CastleGLImages.html">CastleGLImages</a> for OpenGL image operations (for textures and others).</p>
<a name="PasDoc-Uses"></a><h2 class="uses">Uses</h2>
<ul class="useslist"><li>SysUtils</li><li>Classes</li><li>Math</li><li><a href="CastleUtils.html">CastleUtils</a></li><li><a href="CastleVectors.html">CastleVectors</a></li><li><a href="CastleRectangles.html">CastleRectangles</a></li><li>CastlePng</li><li><a href="CastleFileFilters.html">CastleFileFilters</a></li><li><a href="CastleClassUtils.html">CastleClassUtils</a></li><li><a href="CastleColors.html">CastleColors</a></li><li>FGL</li><li>FPImage</li><li>FPReadPCX</li><li>FPReadGIF</li><li>FPReadPSD</li><li>FPReadTGA</li><li>FPReadTiff</li><li>FPReadXPM</li><li>FPReadJPEG</li><li>FPWriteJPEG</li><li>FPReadPNM</li><li>FPReadPNG</li><li>CastleFPWritePNG</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Classes"></a><h3 class="cio">Classes, Interfaces, Objects and Records</h3>
<table class="classestable wide_list">
<tr class="listheader">
<th class="itemname">Name</th>
<th class="itemdesc">Description</th>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.EImagePosOutOfRange.html"><code>EImagePosOutOfRange</code></a></td>
<td class="itemdesc">Raised by <a class="normal" href="CastleImages.TCastleImage.html#MakeExtracted">TCastleImage.MakeExtracted</a> when coordinates on image are wrong.</td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageLerpError.html"><code>EImageLerpError</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageLerpInvalidClasses.html"><code>EImageLerpInvalidClasses</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageLerpDifferentSizes.html"><code>EImageLerpDifferentSizes</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageAssignmentError.html"><code>EImageAssignmentError</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageCannotConvertFpImage.html"><code>EImageCannotConvertFpImage</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.TEncodedImage.html"><code>TEncodedImage</code></a></td>
<td class="itemdesc">Abstract class for an image with unspecified, possibly compressed, memory format.</td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.TCastleImage.html"><code>TCastleImage</code></a></td>
<td class="itemdesc">An abstract class representing image as a simple array of pixels.</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.ECannotFlipCompressedImage.html"><code>ECannotFlipCompressedImage</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.TGPUCompressedImage.html"><code>TGPUCompressedImage</code></a></td>
<td class="itemdesc">Image compressed using one of the GPU texture compression algorithms.</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.ECannotDecompressTexture.html"><code>ECannotDecompressTexture</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.TRGBImage.html"><code>TRGBImage</code></a></td>
<td class="itemdesc">Image with pixel represented as a <a class="normal" href="CastleVectors.html#TVector3Byte">TVector3Byte</a> (red, green, blue).</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.TRGBAlphaImage.html"><code>TRGBAlphaImage</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.TRGBFloatImage.html"><code>TRGBFloatImage</code></a></td>
<td class="itemdesc">Image with high-precision RGB colors encoded as 3 floats.</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.TGrayscaleImage.html"><code>TGrayscaleImage</code></a></td>
<td class="itemdesc">Grayscale image.</td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.TGrayscaleAlphaImage.html"><code>TGrayscaleAlphaImage</code></a></td>
<td class="itemdesc">Grayscale image with an alpha channel.</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageLoadError.html"><code>EImageLoadError</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.EInvalidImageFormat.html"><code>EInvalidImageFormat</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.EUnableToLoadImage.html"><code>EUnableToLoadImage</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageFormatNotSupported.html"><code>EImageFormatNotSupported</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleImages.EImageSaveError.html"><code>EImageSaveError</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Object <a class="bold" href="CastleImages.TGPUCompressionInfo.html"><code>TGPUCompressionInfo</code></a></td>
<td class="itemdesc"> </td>
</tr>
</table>
<a name="PasDoc-FuncsProcs"></a><h3 class="summary">Functions and Procedures</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#EqualRGB">EqualRGB</a></b>(const Color1, Color2: <a href="CastleVectors.html#TVector3Byte">TVector3Byte</a>; Tolerance: Byte): boolean;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#InImageClasses">InImageClasses</a></b>(ImageClass: <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>; const ImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>): boolean; overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#InImageClasses">InImageClasses</a></b>(Image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const ImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>): boolean; overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#ImageClassesEqual">ImageClassesEqual</a></b>(const Ar1, Ar2: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>): boolean;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#Vector3ToRGBE">Vector3ToRGBE</a></b>(const v: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>): <a href="CastleVectors.html#TVector4Byte">TVector4Byte</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#VectorRGBETo3Single">VectorRGBETo3Single</a></b>(const v: <a href="CastleVectors.html#TVector4Byte">TVector4Byte</a>): <a href="CastleVectors.html#TVector3Single">TVector3Single</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#IsImageMimeType">IsImageMimeType</a></b>(const MimeType: string; const OnlyLoadable, OnlySaveable: boolean): boolean;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#ListImageExtsLong">ListImageExtsLong</a></b>(OnlyLoadable, OnlySaveable: boolean; const LinePrefix: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#ListImageExtsShort">ListImageExtsShort</a></b>(OnlyLoadable, OnlySaveable: boolean): string;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#ImageExtToMimeType">ImageExtToMimeType</a></b>(Ext: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#LoadImage">LoadImage</a></b>(Stream: TStream; const MimeType: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#LoadImage">LoadImage</a></b>(const URL: string): <a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#LoadImage">LoadImage</a></b>(const URL: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#LoadImage">LoadImage</a></b>(const URL: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>; const ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a> = riNearest): <a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#LoadEncodedImage">LoadEncodedImage</a></b>(Stream: TStream; const MimeType: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#LoadEncodedImage">LoadEncodedImage</a></b>(const URL: string): <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleImages.html#LoadEncodedImage">LoadEncodedImage</a></b>(URL: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>procedure <b><a href="CastleImages.html#SaveImage">SaveImage</a></b>(const img: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const MimeType: string; Stream: TStream); overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>procedure <b><a href="CastleImages.html#SaveImage">SaveImage</a></b>(const Img: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const URL: string); overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#ImageClassBestForSavingToFormat">ImageClassBestForSavingToFormat</a></b>(const URL: string): <a href="CastleImages.html#TCastleImageClass">TCastleImageClass</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>procedure <b><a href="CastleImages.html#AlphaMaxTo1st">AlphaMaxTo1st</a></b>(var A: <a href="CastleImages.html#TAlphaChannel">TAlphaChannel</a>; const B: <a href="CastleImages.html#TAlphaChannel">TAlphaChannel</a>);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleImages.html#StringToAlpha">StringToAlpha</a></b>(S: string; var WarningDone: boolean): <a href="CastleImages.html#TAutoAlphaChannel">TAutoAlphaChannel</a>;</code></td>
</tr>
</table>
<a name="PasDoc-Types"></a><h3 class="summary">Types</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#TAutoAlphaChannel">TAutoAlphaChannel</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#TAlphaChannel">TAlphaChannel</a></b> = acNone .. acFullRange;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#TResizeNiceInterpolation">TResizeNiceInterpolation</a></b> = (...);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#TCastleImageList">TCastleImageList</a></b> = specialize TFPGObjectList<<a href="CastleImages.TCastleImage.html">TCastleImage</a>>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#TEncodedImageList">TEncodedImageList</a></b> = specialize TFPGObjectList<<a href="CastleImages.TEncodedImage.html">TEncodedImage</a>>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#TGPUCompression">TGPUCompression</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#TGPUCompressions">TGPUCompressions</a></b> = set of <a href="CastleImages.html#TGPUCompression">TGPUCompression</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#TS3TCImage">TS3TCImage</a></b> = <a href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a> deprecated;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#TDecompressTextureFunction">TDecompressTextureFunction</a></b> = function (Image: <a href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#TCastleImageClass">TCastleImageClass</a></b> = class of <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a></b> = class of <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#TLoadImagePreprocessEvent">TLoadImagePreprocessEvent</a></b> = procedure (var ImageUrl: string);</code></td>
</tr>
</table>
<a name="PasDoc-Constants"></a><h3 class="summary">Constants</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#DefaultAlphaTolerance">DefaultAlphaTolerance</a></b> = 5;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#AlphaToString">AlphaToString</a></b>: array [<a href="CastleImages.html#TAutoAlphaChannel">TAutoAlphaChannel</a>] of string =
('AUTO', 'NONE', 'SIMPLE_YES_NO', 'FULL_RANGE');</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#GPUCompressionInfo">GPUCompressionInfo</a></b>: array [<a href="CastleImages.html#TGPUCompression">TGPUCompression</a>] of <a href="CastleImages.TGPUCompressionInfo.html">TGPUCompressionInfo</a> =
( (Name: 'DXT1 (no alpha)' ; RequiresPowerOf2: true ; AlphaChannel: acNone),
(Name: 'DXT1' ; RequiresPowerOf2: true ; AlphaChannel: acSimpleYesNo),
(Name: 'DXT3' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'DXT5' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'PVRTC1_4bpp_RGB' ; RequiresPowerOf2: true ; AlphaChannel: acNone),
(Name: 'PVRTC1_2bpp_RGB' ; RequiresPowerOf2: true ; AlphaChannel: acNone),
(Name: 'PVRTC1_4bpp_RGBA' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'PVRTC1_2bpp_RGBA' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'PVRTC2_4bpp' ; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'PVRTC2_2bpp' ; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'ATITC_RGB' ; RequiresPowerOf2: false; AlphaChannel: acNone),
(Name: 'ATITC_RGBA_ExplicitAlpha' ; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'ATITC_RGBA_InterpolatedAlpha'; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'ETC1' ; RequiresPowerOf2: true ; AlphaChannel: acNone)
);</code></td>
</tr>
</table>
<a name="PasDoc-Variables"></a><h3 class="summary">Variables</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#DecompressTexture">DecompressTexture</a></b>: <a href="CastleImages.html#TDecompressTextureFunction">TDecompressTextureFunction</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#LoadImage_FileFilters">LoadImage_FileFilters</a></b>: <a href="CastleFileFilters.TFileFilterList.html">TFileFilterList</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleImages.html#SaveImage_FileFilters">SaveImage_FileFilters</a></b>: <a href="CastleFileFilters.TFileFilterList.html">TFileFilterList</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleImages.html#LoadImagePreprocess">LoadImagePreprocess</a></b>: <a href="CastleImages.html#TLoadImagePreprocessEvent">TLoadImagePreprocessEvent</a>;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Functions and Procedures</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="EqualRGB"></a><code>function <b>EqualRGB</b>(const Color1, Color2: <a href="CastleVectors.html#TVector3Byte">TVector3Byte</a>; Tolerance: Byte): boolean;</code></td>
</tr>
<tr><td colspan="1">
<p>
Check if the two RGB colors are equal, ignoring small differences. All three color components may differ by at most Tolerance. When Tolerance is 0, this is a normal (exact) comparison.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="InImageClasses"></a><code>function <b>InImageClasses</b>(ImageClass: <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>; const ImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>): boolean; overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
Check is ImageClass one of the items in the ImageClasses array, or a descendant of one of them.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="InImageClasses"></a><code>function <b>InImageClasses</b>(Image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const ImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>): boolean; overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
Check is Image class one of the items in the ImageClasses array, or a descendant of one of them. This is a shortcut for <code>InImageClasses</code>(Image.ClassType, ImageClasses).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ImageClassesEqual"></a><code>function <b>ImageClassesEqual</b>(const Ar1, Ar2: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>): boolean;</code></td>
</tr>
<tr><td colspan="1">
<p>
Check if both arrays contain exactly the same classes in the same order.
<p>May be extended in the future to do better checks and return true also if both array contain the same classes but in different order, and one array may contain the same classes duplicated any times. So the intention is that you should treat both arrays as sets (i.e. order of elements is ignored).
<p>The problem is that this function should be lighting fast (as the main purpose of it is to use it in constructions like setting property values, e.g.
<p></p>
<pre class="longcode">
<span class="pascal_keyword">if</span> ImageClassesArraysEqual(Value, SomeProperty) <span class="pascal_keyword">then</span>
<span class="pascal_keyword">begin</span>
SomeProperty := Value;
<span class="pascal_comment">{ ... do some lengthy operations to update new value of SomeProperty ... }</span>
<span class="pascal_keyword">end</span>;
</pre>
<p> ), and doing smarter checks may cost us a little time.
<p>So for now this function returns </p>
<ul class="paragraph_spacing">
<li><p><code>True</code> if for sure both arrays contain the same classes and</p></li>
<li><p><code>False</code> if <i>possibly</i> they don't contain the same classes.</p></li>
</ul>
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="Vector3ToRGBE"></a><code>function <b>Vector3ToRGBE</b>(const v: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>): <a href="CastleVectors.html#TVector4Byte">TVector4Byte</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Encode RGB color as Red + Green + Blue + Exponent format. This allows you to encode high-precision colors in 4 bytes, see ifRGBE image format for pointers why this is useful.
<p>Each component of V (red, green, blue) must be from range [0, +infinity), not merely from [0, 1]. That is, V must have only nonnegative values.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="VectorRGBETo3Single"></a><code>function <b>VectorRGBETo3Single</b>(const v: <a href="CastleVectors.html#TVector4Byte">TVector4Byte</a>): <a href="CastleVectors.html#TVector3Single">TVector3Single</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Decode Red + Green + Blue + Exponent back into RGB (3 floats).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="IsImageMimeType"></a><code>function <b>IsImageMimeType</b>(const MimeType: string; const OnlyLoadable, OnlySaveable: boolean): boolean;</code></td>
</tr>
<tr><td colspan="1">
<p>
Does this MIME type correspond to image.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ListImageExtsLong"></a><code>function <b>ListImageExtsLong</b>(OnlyLoadable, OnlySaveable: boolean; const LinePrefix: string): string;</code></td>
</tr>
<tr><td colspan="1">
<p>
List available image file formats.
<p>This is basically for debug/info purposes, you can show this to user to let him know which formats are supported (and by which extensions they are recognized). Although almost always a better way to show this to user is just to use <a class="normal" href="CastleImages.html#SaveImage_FileFilters">SaveImage_FileFilters</a> with a save dialog like <a class="normal" href="CastleWindow.TCastleWindowCustom.html#FileDialog">TCastleWindowCustom.FileDialog</a>, this shows file types in the open/save dialog, so it's most natural and convenient to user.
<p><code>ListImageExtsLong</code> produces a multiline info (separated by <a class="normal" href="CastleUtils.html#NL">NL</a>, last line not terminated by <a class="normal" href="CastleUtils.html#NL">NL</a>), shows all extensions and FormatName for each file format. Each line starts with LinePrefix.
<p><a class="normal" href="CastleImages.html#ListImageExtsShort">ListImageExtsShort</a> writes all recognized extensions separated by comma (', ').
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ListImageExtsShort"></a><code>function <b>ListImageExtsShort</b>(OnlyLoadable, OnlySaveable: boolean): string;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ImageExtToMimeType"></a><code>function <b>ImageExtToMimeType</b>(Ext: string): string;</code></td>
</tr>
<tr><td colspan="1">
<p>
Guess MIME type from image extension. Empty string if cannot guess.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadImage"></a><code>function <b>LoadImage</b>(Stream: TStream; const MimeType: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
The ultimate procedure to load an image from a file or URL.
<p>URL is downloaded using <a class="normal" href="CastleDownload.html">CastleDownload</a> unit. As always, if you all you care about is loading normal files, then just pass a normal filename (absolute or relative to the current directory) as the URL parameter.
<p>Simple examples:
<p></p>
<pre class="longcode">
<span class="pascal_comment">{ When you don't care what TCastleImage descendant you get: }</span>
Image := LoadImage(<span class="pascal_string">'image.png'</span>);
<span class="pascal_comment">{ When you insist on getting TRGBImage, that is 8-bit color image
without an alpha channel. }</span>
ImageRGB := LoadImage(<span class="pascal_string">'image.png'</span>, [TRGBImage]) <span class="pascal_keyword">as</span> TRGBImage;
</pre>
<p>
<p>Image file format may be given explicitly (overloaded version with Format parameter), or guessed based on URL extension (which can be given explicitly by TypeExt, or automatically calculated from full URL). For now, we cannot guess the file format based on file contents or MIME type (the latter case would be sensible for http URLs).
<p>AllowedImageClasses says what image classes are allowed. As a special case, AllowedImageClasses = [] is equivalent to AllowedImageClasses = [<a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>] which says that all <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> descendants are allowed. Then this function will do everything it can to load any image into the best subclass of <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>, losing as little image information it can.
<p>Example: consider you're loading a PNG file. Let's suppose you're loading it with AllowedImageClasses = []. Then you can get <a class="normal" href="CastleImages.TGrayscaleImage.html">TGrayscaleImage</a>, <a class="normal" href="CastleImages.TGrayscaleAlphaImage.html">TGrayscaleAlphaImage</a>, <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>, <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>, depending on whether PNG file is grayscale or not and has alpha or not. Now let's suppose you specified AllowedImageClasses = [<a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>]. If PNG file will not be grayscale and not have alpha channel, <a class="normal" href="CastleImages.html#LoadImage">LoadImage</a> will return <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a> descendant, as before. But if PNG fill *will* have alpha channel then <a class="normal" href="CastleImages.html#LoadImage">LoadImage</a> will simply ignore (strip) alpha channel and return you <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>.
<p>Similar thing for grayscale: if image file was grayscale but you requested only <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>, then grayscale may be "expanded" into full three-channel RGB.
<p>There can also happen reverse situation: you e.g. insist that AllowedImageClasses = [<a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>] but given PNG image does not have alpha channel. In this case <a class="normal" href="CastleImages.html#LoadImage">LoadImage</a> may add "dummy" alpha channel (everywhere equal to 1.0 or High(Byte)). Similar thing when you e.g. gave AllowedImageClasses = [<a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a>] but you're loading from PNG image. In this case you want float precision, but image file cannot offer it. So <a class="normal" href="CastleImages.html#LoadImage">LoadImage</a> can simply convert discreet values to appropriating floating point values.
<p>If at any point <a class="normal" href="CastleImages.html#LoadImage">LoadImage</a> will find that it's unable to satisfy AllowedImageClasses, it will raise <a class="normal" href="CastleImages.EUnableToLoadImage.html">EUnableToLoadImage</a>.
<p>
<p>
<p>
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleImages.EUnableToLoadImage.html">EUnableToLoadImage</a></dt>
<dd>If Image cannot be loaded into allowed AllowedImageClasses.</dd>
<dt><a class="normal" href="CastleImages.EImageFormatNotSupported.html">EImageFormatNotSupported</a></dt>
<dd>If image file format cannot be loaded at all. This can happen if format is totally unknown (not recognized MIME type, derived from file extension in case of local files) or if this image format cannot be loaded at all.</dd>
</dl>
<h6 class="description_section">See also</h6>
<dl class="see_also">
<dt><a class="normal" href="CastleImages.html#LoadEncodedImage">LoadEncodedImage</a></dt>
<dd></dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadImage"></a><code>function <b>LoadImage</b>(const URL: string): <a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadImage"></a><code>function <b>LoadImage</b>(const URL: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadImage"></a><code>function <b>LoadImage</b>(const URL: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>; const ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a> = riNearest): <a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadEncodedImage"></a><code>function <b>LoadEncodedImage</b>(Stream: TStream; const MimeType: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
Load image to <a class="normal" href="CastleImages.TEncodedImage.html">TEncodedImage</a> format. This allows loading image compressed with GPU, which is good for optimally loading it to GPU. However, the operations on GPU-compressed image are very limited, we generally cannot do much with GPU-compressed date except rendering it.
<p>
<p></p>
<h6 class="description_section">See also</h6>
<dl class="see_also">
<dt><a class="normal" href="CastleImages.html#LoadImage">LoadImage</a></dt>
<dd></dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadEncodedImage"></a><code>function <b>LoadEncodedImage</b>(const URL: string): <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadEncodedImage"></a><code>function <b>LoadEncodedImage</b>(URL: string; const AllowedImageClasses: array of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a>) :<a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SaveImage"></a><code>procedure <b>SaveImage</b>(const img: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const MimeType: string; Stream: TStream); overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
Save image to a file. Takes URL as parameter, you can give <code>file</code> URL or just a normal filename.
<p>File format is determined by looking at URL (guessing MIME type using <a class="normal" href="CastleURIUtils.html#URIMimeType">URIMimeType</a>), or given explicitly as MimeType, or just given explicitly as Format parameter.
<p>Image class does <b>not</b> affect the created image file format, on the assumption that the "memory format" of the image (what <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> descendant is used) can be orthogonal to the actual "file format" used to save this file.
<p>Tries to write the image preserving it as closely as possible in this image format. When it's not possible, according conversions may be done: floating point precision of <a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a> may be lost (if saving to any file format besides RGBE file, although saving to OpenEXR may also preserve it once implemented), alpha channel may be lost, grayscale may be expanded and such.
<p>Although not absolutely all conversions are implemented for now. You can be sure that all image formats (that allow any saving at all) can be saved from <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>. Also <a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a> can be saved to RGBE file. Also PNG format supports full collection (grayscale/rgb, alpha/no alpha are all perfectly possible in PNG file; and <a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a> will be just converted to 8-bit RGB before saving to PNG).
<p>
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleImages.EImageSaveError.html">EImageSaveError</a></dt>
<dd>When it's not possible to save image, because of Img class (memory format) and/or image file format.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SaveImage"></a><code>procedure <b>SaveImage</b>(const Img: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const URL: string); overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ImageClassBestForSavingToFormat"></a><code>function <b>ImageClassBestForSavingToFormat</b>(const URL: string): <a href="CastleImages.html#TCastleImageClass">TCastleImageClass</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Choose <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> descendant best matching for this image file format. The only purpose of this for now is to pick <a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a> for RGBE files, chooses <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a> for anything else.
<p>For the overloaded version with URL, file format is determined by guessing based on file extension.
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="AlphaMaxTo1st"></a><code>procedure <b>AlphaMaxTo1st</b>(var A: <a href="CastleImages.html#TAlphaChannel">TAlphaChannel</a>; const B: <a href="CastleImages.html#TAlphaChannel">TAlphaChannel</a>);</code></td>
</tr>
<tr><td colspan="1">
<p>
Maximum alpha channel type. Chooses "full range" if anything is "full range", otherwise choose "simple yes/no" if anything is "simple yes/no", otherwise returns "no alpha channel".</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="StringToAlpha"></a><code>function <b>StringToAlpha</b>(S: string; var WarningDone: boolean): <a href="CastleImages.html#TAutoAlphaChannel">TAutoAlphaChannel</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<h3 class="detail">Types</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TAutoAlphaChannel"></a><code><b>TAutoAlphaChannel</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<h6 class="description_section">Values</h6>
<ul>
<li>
acAuto: </li>
<li>
acNone: </li>
<li>
acSimpleYesNo: </li>
<li>
acFullRange: </li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TAlphaChannel"></a><code><b>TAlphaChannel</b> = acNone .. acFullRange;</code></td>
</tr>
<tr><td colspan="1">
<p>
See TCastleImage.AlphaChannel.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TResizeInterpolation"></a><code><b>TResizeInterpolation</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<p>
Basic resize interpolation modes, fast and available for all image types.</p>
<h6 class="description_section">Values</h6>
<ul>
<li>
riNearest: </li>
<li>
riBilinear: </li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TResizeNiceInterpolation"></a><code><b>TResizeNiceInterpolation</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<p>
Resize interpolation modes for MakeResized with <code>TResizeNiceInterpolation</code> parameters. These are much slower than our <a class="normal" href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a>, as they are implemented by conversion to FpImage. However, they offer some extra quality.</p>
<h6 class="description_section">Values</h6>
<ul>
<li>
rniNearest: </li>
<li>
rniBilinear: </li>
<li>
rniMitchel: </li>
<li>
rniBlackman: </li>
<li>
rniBlackmanSinc: </li>
<li>
rniBlackmanBessel: </li>
<li>
rniGaussian: </li>
<li>
rniHermite: </li>
<li>
rniLanczos: </li>
<li>
rniQuadratic: </li>
<li>
rniCubic: </li>
<li>
rniCatrom: </li>
<li>
rniHanning: </li>
<li>
rniHamming: </li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TCastleImageList"></a><code><b>TCastleImageList</b> = specialize TFPGObjectList<<a href="CastleImages.TCastleImage.html">TCastleImage</a>>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TEncodedImageList"></a><code><b>TEncodedImageList</b> = specialize TFPGObjectList<<a href="CastleImages.TEncodedImage.html">TEncodedImage</a>>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TGPUCompression"></a><code><b>TGPUCompression</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<p>
Possible compression of textures for GPU.</p>
<h6 class="description_section">Values</h6>
<ul>
<li>
tcDxt1_RGB: S3TC DXT1 compression, for RGB images with no alpha or simple yes/no alpha. This compression format is often supported by desktop OpenGL implementations. See <a href="http://en.wikipedia.org/wiki/S3_Texture_Compression">http://en.wikipedia.org/wiki/S3_Texture_Compression</a> about S3TC. It is also supported by a small number of Android devices.
<p>tcDxt1_RGB and tcDxt1_RGBA are the same compression method, except in tcDxt1_RGB the alpha information is ignored while rendering, while in tcDxt1_RGBA the rendering assumes we have simple yes/no alpha.
<p>The difference is equivalent to OpenGL differences in treating </p>
<ul class="compact_spacing">
<li><p>GL_COMPRESSED_RGB_S3TC_DXT1_EXT and</p></li>
<li><p>GL_COMPRESSED_RGBA_S3TC_DXT1_EXT.</p></li>
</ul>
<p></li>
<li>
tcDxt1_RGBA: S3TC DXT1 compression, <b>for RGB images with no alpha or simple yes/no alpha</b>. See above tcDxt1_RGB description for details.</li>
<li>
tcDxt3: S3TC DXT3 compression, <b>for RGBA images with full alpha channel</b>, best for images with sharp alpha transitions. This compression format is often supported by desktop OpenGL implementations. See <a href="http://en.wikipedia.org/wiki/S3_Texture_Compression">http://en.wikipedia.org/wiki/S3_Texture_Compression</a> about S3TC.</li>
<li>
tcDxt5: S3TC DXT3 compression, <b>for RGBA images with full alpha channel</b>, best for images with smooth alpha transitions. This compression format is often supported by desktop OpenGL implementations. See <a href="http://en.wikipedia.org/wiki/S3_Texture_Compression">http://en.wikipedia.org/wiki/S3_Texture_Compression</a> about S3TC.</li>
<li>
tcPvrtc1_4bpp_RGB: PowerVR texture compression (PVRTC) format. Supported by some Android and iOS devices, using PowerVR GPU by Imagination Technologies. See <a href="http://en.wikipedia.org/wiki/PVRTC">http://en.wikipedia.org/wiki/PVRTC</a> .
<p>To generate such textures, PowerVR provides a nice tool PVRTexTool, see <a href="http://community.imgtec.com/developers/powervr/tools/pvrtextool/">http://community.imgtec.com/developers/powervr/tools/pvrtextool/</a> .</li>
<li>
tcPvrtc1_2bpp_RGB: </li>
<li>
tcPvrtc1_4bpp_RGBA: </li>
<li>
tcPvrtc1_2bpp_RGBA: </li>
<li>
tcPvrtc2_4bpp: </li>
<li>
tcPvrtc2_2bpp: </li>
<li>
tcATITC_RGB: ATI texture compression format, <b>without alpha</b>. Supported by some Android devices (Adreno GPU from Qualcomm).
<p>There is no perfect program to generate such texture, unfortunately. The only sensible choice is to use ATI compressonator from <a href="http://developer.amd.com/tools-and-sdks/archive/legacy-cpu-gpu-tools/the-compressonator/">http://developer.amd.com/tools-and-sdks/archive/legacy-cpu-gpu-tools/the-compressonator/</a> . Unfortunately, it's installation may fail on some Windows versions and wine (Linux). We've had most success installing it on 32-bit Windows, and them copying to wine. ATI deprecated this program.
<p>Adreno SDK contains library to compress to ATITC formats, but no useful program to actually convert files to this format (wrapped in ktx or dds).</li>
<li>
tcATITC_RGBA_ExplicitAlpha: ATI texture compression format, <b>with sharp alpha</b>. Supported by some Android devices (Adreno GPU from Qualcomm).</li>
<li>
tcATITC_RGBA_InterpolatedAlpha: ATI texture compression format, <b>with smooth alpha</b>. Supported by some Android devices (Adreno GPU from Qualcomm).</li>
<li>
tcETC1: ETC texture compression, <b>without alpha</b>. See <a href="http://en.wikipedia.org/wiki/Ericsson_Texture_Compression">http://en.wikipedia.org/wiki/Ericsson_Texture_Compression</a> . Available on almost all Android OpenGLES 2.0 devices, unfortunately it doesn't support alpha channel.
<p>It can be generated using various tools — dedicated etcpack, also PVRTexTool and ATI compressonator.</li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TGPUCompressions"></a><code><b>TGPUCompressions</b> = set of <a href="CastleImages.html#TGPUCompression">TGPUCompression</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TS3TCImage"></a><code><b>TS3TCImage</b> = <a href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a> deprecated;</code></td>
</tr>
<tr><td colspan="1">
<p class="hint_directive">Warning: this symbol is deprecated.</p><p>
Deprecated alias for <a class="normal" href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TDecompressTextureFunction"></a><code><b>TDecompressTextureFunction</b> = function (Image: <a href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TCastleImageClass"></a><code><b>TCastleImageClass</b> = class of <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TEncodedImageClass"></a><code><b>TEncodedImageClass</b> = class of <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TLoadImagePreprocessEvent"></a><code><b>TLoadImagePreprocessEvent</b> = procedure (var ImageUrl: string);</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<h3 class="detail">Constants</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="DefaultAlphaTolerance"></a><code><b>DefaultAlphaTolerance</b> = 5;</code></td>
</tr>
<tr><td colspan="1">
<p>
Default parameters for <a class="normal" href="CastleImages.TEncodedImage.html#AlphaChannel">TEncodedImage.AlphaChannel</a>, decide how to detect textures alpha channel.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="AlphaToString"></a><code><b>AlphaToString</b>: array [<a href="CastleImages.html#TAutoAlphaChannel">TAutoAlphaChannel</a>] of string =
('AUTO', 'NONE', 'SIMPLE_YES_NO', 'FULL_RANGE');</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="GPUCompressionInfo"></a><code><b>GPUCompressionInfo</b>: array [<a href="CastleImages.html#TGPUCompression">TGPUCompression</a>] of <a href="CastleImages.TGPUCompressionInfo.html">TGPUCompressionInfo</a> =
( (Name: 'DXT1 (no alpha)' ; RequiresPowerOf2: true ; AlphaChannel: acNone),
(Name: 'DXT1' ; RequiresPowerOf2: true ; AlphaChannel: acSimpleYesNo),
(Name: 'DXT3' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'DXT5' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'PVRTC1_4bpp_RGB' ; RequiresPowerOf2: true ; AlphaChannel: acNone),
(Name: 'PVRTC1_2bpp_RGB' ; RequiresPowerOf2: true ; AlphaChannel: acNone),
(Name: 'PVRTC1_4bpp_RGBA' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'PVRTC1_2bpp_RGBA' ; RequiresPowerOf2: true ; AlphaChannel: acFullRange),
(Name: 'PVRTC2_4bpp' ; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'PVRTC2_2bpp' ; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'ATITC_RGB' ; RequiresPowerOf2: false; AlphaChannel: acNone),
(Name: 'ATITC_RGBA_ExplicitAlpha' ; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'ATITC_RGBA_InterpolatedAlpha'; RequiresPowerOf2: false; AlphaChannel: acFullRange),
(Name: 'ETC1' ; RequiresPowerOf2: true ; AlphaChannel: acNone)
);</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<h3 class="detail">Variables</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="DecompressTexture"></a><code><b>DecompressTexture</b>: <a href="CastleImages.html#TDecompressTextureFunction">TDecompressTextureFunction</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Assign here texture decompression function that is available. This way the "decompressor" is pluggable, which means that you can even use OpenGL to decompress textures, if you're going to load images while some OpenGL context is active.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadImage_FileFilters"></a><code><b>LoadImage_FileFilters</b>: <a href="CastleFileFilters.TFileFilterList.html">TFileFilterList</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
File filters if you want to choose a file that can be loaded/saved by appropriate functions from Images unit.
<p>These objects should be treated as read-only outside this unit. Initialization / finalization of this unit automatically take care of them.
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SaveImage_FileFilters"></a><code><b>SaveImage_FileFilters</b>: <a href="CastleFileFilters.TFileFilterList.html">TFileFilterList</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadImagePreprocess"></a><code><b>LoadImagePreprocess</b>: <a href="CastleImages.html#TLoadImagePreprocessEvent">TLoadImagePreprocessEvent</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
If assigned, all URLs loaded by <a class="normal" href="CastleImages.html#LoadImage">LoadImage</a> and <a class="normal" href="CastleImages.html#LoadEncodedImage">LoadEncodedImage</a> are processed by this event. This allows to globally modify / observe your images paths, e.g. to use GPU compressed alternative versions.</p>
</td></tr>
</table>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:10</em>
</span>
</td></tr></table></body></html>
|