File: CastleImages.TCastleImage.html

package info (click to toggle)
castle-game-engine 5.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 185,428 kB
  • sloc: pascal: 260,781; cpp: 1,363; objc: 713; makefile: 537; xml: 496; sh: 480; php: 4
file content (846 lines) | stat: -rw-r--r-- 61,787 bytes parent folder | download
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
<!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: Class TCastleImage</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">
<a name="TCastleImage"></a><h1 class="cio">Class TCastleImage</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></td><td>Fields</td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td>Properties</td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a  href="CastleImages.html">CastleImages</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TCastleImage = class(<a class="normal" href="CastleImages.TEncodedImage.html">TEncodedImage</a>)</code></p>
<h2 class="description">Description</h2>
<p>
An abstract class representing image as a simple array of pixels. <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> is a pointer to Width * Height * Depth of pixels.

<p>What exactly is a &quot;pixel&quot; is undefined in this class. Each descendant of <code>TCastleImage</code> defines it's own pixel encoding and interpretation. The only requirement is that all pixels have the same size (<a class="normal" href="CastleImages.TCastleImage.html#PixelSize">PixelSize</a>). For example, for <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a> a &quot;pixel&quot; is a <a class="normal" href="CastleVectors.html#TVector3Byte">TVector3Byte</a> type representing a (red, green, blue) color value.

<p>When Depth &gt; 1, the image is actually a 3D (not just 2D!) image. We call the particular 2D layers then &quot;slices&quot;. Although some <code>TCastleImage</code> methods (and functions in other units, like <a class="normal" href="CastleGLImages.html">CastleGLImages</a>) still operate only on the 1st &quot;slice&quot;, that is the 2D image on Depth = 0 &mdash; be careful. But many methods correctly take the depth into consideration.

<p>Pixels in <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> are ordered in slices, each slice is ordered in rows, in each row pixels are specified from left to right, rows are specified starting from lower row to upper. This means that you can think of <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> as

<p></p>

<pre class="longcode">
  &circ;(<span class="pascal_keyword">packed</span> <span class="pascal_keyword">array</span>[<span class="pascal_numeric">0</span>..Depth - <span class="pascal_numeric">1</span>, <span class="pascal_numeric">0</span>..Height - <span class="pascal_numeric">1</span>, <span class="pascal_numeric">0</span>..Width - <span class="pascal_numeric">1</span>] <span class="pascal_keyword">of</span> TPixel)
</pre>

<p>

<p>Assuming the above definition, <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a>&circ;[z, y, x] is color of pixel at position z, x, y.

<p>Note that specifying rows from lower to upper follows an OpenGL standard, this makes using this unit with OpenGL straightforward.

<p>Don't ever operate on <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> pointer directly &mdash; allocating, reallocating, freeing memory pointed to by <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> is handled inside this class. You must only worry to always free created <code>TCastleImage</code> instances (like with any class).

<p>Note that the only valid states of instances of this class are when (Width * Height * Depth &gt; 0 and <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> &lt;&gt; nil) or (Width * Height * Depth = 0 and <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> = nil). Otherwise the fundamental assumption that <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> is a pointer to Width * Height * Depth pixels would be broken (as nil pointer cannot point to anything, and on the other side it's rather useless to have a pointer to 0 bytes (since you can never dereference it anyway) even if theoretically every PtrInt value can be treated as valid pointer to 0 bytes).

<p>Note about coordinates:

<p></p>

<ol class="paragraph_spacing">
  <li value="1"><p>All X, Y, Z coordinates of pixels are 0-based (X in range 0..Width-1, and Y in 0..Height-1, and Z in 0..Depth-1).</p></li>
  <li value="2"><p>If documentation for some method does not specify otherwise, correctness of coordinates is *not* checked in method, which can lead to various errors at runtime if you will pass incorrect coordinates to given routine.</p></li>
</ol>

<p></p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TObject</li>
<li class="ancestor"><a class="normal" href="CastleImages.TEncodedImage.html">TEncodedImage</a></li>
<li class="thisitem">TCastleImage</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Methods"></a><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#LerpSimpleCheckConditions">LerpSimpleCheckConditions</a></b>(SecondImage: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#DrawCore">DrawCore</a></b>(Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; X, Y, SourceX, SourceY, SourceWidth, SourceHeight: Integer); virtual;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a  href="CastleImages.TCastleImage.html#Create">Create</a></b>; overload; virtual;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a  href="CastleImages.TCastleImage.html#Create">Create</a></b>( const AWidth, AHeight: Cardinal; const ADepth: Cardinal = 1); overload; virtual;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Empty">Empty</a></b>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#SetSize">SetSize</a></b>( const AWidth, AHeight: Cardinal; const ADepth: Cardinal = 1);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#SetSize">SetSize</a></b>(const Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>class function <b><a  href="CastleImages.TCastleImage.html#PixelSize">PixelSize</a></b>: Cardinal; virtual; abstract;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#Size">Size</a></b>: Cardinal; override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#ImageSize">ImageSize</a></b>: Cardinal; deprecated;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>class function <b><a  href="CastleImages.TCastleImage.html#ColorComponentsCount">ColorComponentsCount</a></b>: Cardinal; virtual; abstract;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#PixelPtr">PixelPtr</a></b>(const X, Y: Cardinal; const Z: Cardinal = 0): Pointer;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#RowPtr">RowPtr</a></b>(const Y: Cardinal; const Z: Cardinal = 0): Pointer;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#InvertRGBColors">InvertRGBColors</a></b>; virtual;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#SetColorRGB">SetColorRGB</a></b>(const X, Y: Integer; const v: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>); virtual;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#MakeCopy">MakeCopy</a></b>: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Resize">Resize</a></b>(ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a  href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a> = riNearest; const ProgressTitle: string = '');</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Resize3x3">Resize3x3</a></b>(const ResizeWidth, ResizeHeight: Cardinal; var Corners: <a  href="CastleVectors.html#TVector4Integer">TVector4Integer</a>; const Interpolation: <a  href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a>);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#MakeResized">MakeResized</a></b>(ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a  href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a> = riNearest; const ProgressTitle: string = ''): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#MakeResized">MakeResized</a></b>(ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a  href="CastleImages.html#TResizeNiceInterpolation">TResizeNiceInterpolation</a>): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#FlipHorizontal">FlipHorizontal</a></b>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#FlipVertical">FlipVertical</a></b>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#MakeRotated">MakeRotated</a></b>(Angle: Integer): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Rotate">Rotate</a></b>(const Angle: Integer);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#MakeTiled">MakeTiled</a></b>(TileX, TileY: Cardinal): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#MakeExtracted">MakeExtracted</a></b>(X0, Y0, ExtractWidth, ExtractHeight: Cardinal): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Clear">Clear</a></b>(const Pixel: <a  href="CastleVectors.html#TVector4Byte">TVector4Byte</a>); overload; virtual;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Clear">Clear</a></b>(const Pixel: <a  href="CastleColors.html#TCastleColor">TCastleColor</a>); overload;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#IsClear">IsClear</a></b>(const Pixel: <a  href="CastleVectors.html#TVector4Byte">TVector4Byte</a>): boolean; virtual;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#TransformRGB">TransformRGB</a></b>(const Matrix: <a  href="CastleVectors.html#TMatrix3Single">TMatrix3Single</a>); virtual;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#ModulateRGB">ModulateRGB</a></b>(const ColorModulator: <a  href="CastleColors.html#TColorModulatorByteFunc">TColorModulatorByteFunc</a>); virtual;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#MakeModulatedRGB">MakeModulatedRGB</a></b>( const ColorModulator: <a  href="CastleColors.html#TColorModulatorByteFunc">TColorModulatorByteFunc</a>): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Grayscale">Grayscale</a></b>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#ConvertToChannelRGB">ConvertToChannelRGB</a></b>(Channel: Integer);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#StripToChannelRGB">StripToChannelRGB</a></b>(Channel: Integer);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#IsEqual">IsEqual</a></b>(Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>): boolean;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#ArePartsEqual">ArePartsEqual</a></b>( const SelfX0, SelfY0, SelfWidth, SelfHeight: Cardinal; Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const ImageX0, ImageY0, ImageWidth, ImageHeight: Cardinal): boolean; overload;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#ArePartsEqual">ArePartsEqual</a></b>( Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const ImageX0, ImageY0, ImageWidth, ImageHeight: Cardinal): boolean; overload;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a  href="CastleImages.TCastleImage.html#ArePartsEqual">ArePartsEqual</a></b>( const SelfX0, SelfY0, SelfWidth, SelfHeight: Cardinal; Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>): boolean; overload;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#DrawFrom">DrawFrom</a></b>(Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const X, Y: Integer);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#DrawFrom">DrawFrom</a></b>(Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; X, Y, SourceX, SourceY, SourceWidth, SourceHeight: Integer);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#DrawTo">DrawTo</a></b>(Destination: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const X, Y: Integer);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#LerpWith">LerpWith</a></b>(const Value: Single; SecondImage: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>); virtual;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>class procedure <b><a  href="CastleImages.TCastleImage.html#MixColors">MixColors</a></b>(const OutputColor: Pointer; const Weights: <a  href="CastleVectors.html#TVector4Single">TVector4Single</a>; const Colors: <a  href="CastleVectors.html#TVector4Pointer">TVector4Pointer</a>); virtual;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#Assign">Assign</a></b>(const Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>); virtual;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="CastleImages.TCastleImage.html#SaveToPascalCode">SaveToPascalCode</a></b>(const ImageName: string; const ShowProgress: boolean; var CodeInterface, CodeImplementation, CodeInitialization, CodeFinalization: string);</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="LerpSimpleCheckConditions"></a><code>procedure <b>LerpSimpleCheckConditions</b>(SecondImage: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Check that both images have the same sizes and Second image class descends from First image class. If not, raise appropriate ELerpXxx exceptions.

<p>Some implementation of <a class="normal" href="CastleImages.TRGBImage.html#LerpWith">TRGBImage.LerpWith</a> may require other checks (since <a class="normal" href="CastleImages.TCastleImage.html#LerpWith">LerpWith</a> may be sometimes allowed between unequal classes), so this doesn't have to be used by all <a class="normal" href="CastleImages.TRGBImage.html#LerpWith">TRGBImage.LerpWith</a> implementations (although it's comfortable for simple implementations).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="DrawCore"></a><code>procedure <b>DrawCore</b>(Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; X, Y, SourceX, SourceY, SourceWidth, SourceHeight: Integer); virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Like <a class="normal" href="CastleImages.TCastleImage.html#DrawFrom">DrawFrom</a>, but can assume that all coordinates and sizes are valid. Override this to add copying using some more sophisticated method than just memory copying.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>; overload; virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Constructor without parameters creates image with Width = Height = Depth = 0 and <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> = nil, so <a class="normal" href="CastleImages.TEncodedImage.html#IsEmpty">IsEmpty</a> will return <code>True</code>.

<p>Both constructors must be virtual, this allows to implement things like <a class="normal" href="CastleImages.TCastleImage.html#MakeCopy">TCastleImage.MakeCopy</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>( const AWidth, AHeight: Cardinal; const ADepth: Cardinal = 1); overload; virtual;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Empty"></a><code>procedure <b>Empty</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
This is equivalent to <a class="normal" href="CastleImages.TCastleImage.html#SetSize">SetSize</a>(0, 0, 0). It sets Width = Height = 0 and <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> = nil.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="SetSize"></a><code>procedure <b>SetSize</b>( const AWidth, AHeight: Cardinal; const ADepth: Cardinal = 1);</code></td>
</tr>
<tr><td colspan="2">
<p>
Change size (Width and Height and Depth). Previous pixel contents (<a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a>) are lost, and the contents of new pixels are undefined.

<p>Use other method, like <a class="normal" href="CastleImages.TCastleImage.html#Resize">Resize</a>, if you want to change image size preserving it's contents.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="SetSize"></a><code>procedure <b>SetSize</b>(const Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>);</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="PixelSize"></a><code>class function <b>PixelSize</b>: Cardinal; virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Size of TPixel in bytes for this <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> descendant.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Size"></a><code>function <b>Size</b>: Cardinal; override;</code></td>
</tr>
<tr><td colspan="2">
<p>
Size of image contents in bytes.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ImageSize"></a><code>function <b>ImageSize</b>: Cardinal; deprecated;</code></td>
</tr>
<tr><td colspan="2">
<p class="hint_directive">Warning: this symbol is deprecated.</p><p>
Deprecated name for <code>ImageSize</code>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ColorComponentsCount"></a><code>class function <b>ColorComponentsCount</b>: Cardinal; virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Number of color components in TPixel.

<p>E.g. RGB is 3 components and RGB+Alpha is 4 components, RGB+Exponent is 3 components (because it describes only Red, Green and Blue values (Exponent value is just used to correctly interpret these, it's not a 4th component)).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="PixelPtr"></a><code>function <b>PixelPtr</b>(const X, Y: Cardinal; const Z: Cardinal = 0): Pointer;</code></td>
</tr>
<tr><td colspan="2">
<p>
Pointer to the (x, y, z) pixel of image.

<p>Note that they don't check X, Y, Z correctness in any way, it's your responsibility to always pass 0 &lt;= X &lt; Width and 0 &lt;= Y &lt; Height and 0 &lt;= Z &lt; Depth.

<p>Note that this function <i>should</i> be reintroduced in descendants to return the same value but typecasted to something better then Pointer (something like &circ;TPixel).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="RowPtr"></a><code>function <b>RowPtr</b>(const Y: Cardinal; const Z: Cardinal = 0): Pointer;</code></td>
</tr>
<tr><td colspan="2">
<p>
Pointer to the first pixel in the Y row of the image. Same thing as <a class="normal" href="CastleImages.TCastleImage.html#PixelPtr">PixelPtr</a> but always with X = 0.

<p>Note that this function <i>should</i> be reintroduced in descendants to return the same value but typecasted to something better then Pointer, preferably something like &circ;(array of TPixel).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="InvertRGBColors"></a><code>procedure <b>InvertRGBColors</b>; virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
This inverts RGB colors (i.e. changes each RGB component's value to High(Byte)-value). Doesn't touch other components, e.g. alpha value in case of <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a> descendant.

<p>Note that this may be not overriden in every <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> descendant, then default implementation of this method in this class will raise <a class="normal" href="CastleUtils.EInternalError.html">EInternalError</a>. This also means that you must not call inherited in descendants when overriding this method.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="SetColorRGB"></a><code>procedure <b>SetColorRGB</b>(const X, Y: Integer; const v: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>); virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Set the RGB color portion of the pixel.

<p>In case of descendants that have more then RGB components, other color components are not touched (e.g. in case of <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a> alpha value of given pixel is not changed).

<p>In case of descendants that don't have anything like RGB encoded inside (e.g. <a class="normal" href="CastleImages.TGrayscaleImage.html">TGrayscaleImage</a>), this should not be overriden and then default implementation of this method in this class will raise <a class="normal" href="CastleUtils.EInternalError.html">EInternalError</a>. This also means that you must not call inherited in descendants when overriding this method.

<p>As usual, you are responsible for guaranting correctness of given X, Y coordinates because their correctness is not checked here.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MakeCopy"></a><code>function <b>MakeCopy</b>: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Create a new object that has exactly the same class and the same contents as this object. (note: no, this function is *not* constructor, because it's implemented in <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>, but it always returns some descendant of <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Resize"></a><code>procedure <b>Resize</b>(ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a  href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a> = riNearest; const ProgressTitle: string = '');</code></td>
</tr>
<tr><td colspan="2">
<p>
Change Width and Height and appropriately stretch image contents.

<p>If ResizeWidth or ResizeHeight is 0 then it means to take Width or Height, respectively. So e.g. using ResizeWidth = ResizeHeight = 0 is the same thing as using ResizeWidth = Width and ResizeHeight = Height and this is NOP.

<p>Remember that resizing may change <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a> pointer, so all pointers that you aquired using functions like <a class="normal" href="CastleImages.TEncodedImage.html#RawPixels">RawPixels</a>, RGBPixels, AlphaPixels, <a class="normal" href="CastleImages.TCastleImage.html#RowPtr">RowPtr</a>, <a class="normal" href="CastleImages.TCastleImage.html#PixelPtr">PixelPtr</a> may be invalid after calling Resize.

<p>If ProgressTitle &lt;&gt; '' this will call Progress.Init/Step/Fini from <a class="normal" href="CastleProgress.html">CastleProgress</a> to indicate progress of operation.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Resize3x3"></a><code>procedure <b>Resize3x3</b>(const ResizeWidth, ResizeHeight: Cardinal; var Corners: <a  href="CastleVectors.html#TVector4Integer">TVector4Integer</a>; const Interpolation: <a  href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Change Width and Height and appropriately stretch image contents.

<p>Preserves corners (provided in the same clockwise way as <a class="normal" href="CastleGLImages.TGLImage.html#Draw3x3">TGLImage.Draw3x3</a>: top, right, bottom, left), scaling the Corners parameter (proportially to image scaling), and making sure that filtering (especially bilinear) does not &quot;leak&quot; colors from one image area to another. Effectively, the image is scaled like a 9 separate parts, and colors cannot bleed from part to another.

<p>Both ResizeWidth, ResizeHeight parameters must be provided and non-zero.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MakeResized"></a><code>function <b>MakeResized</b>(ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a  href="CastleImages.html#TResizeInterpolation">TResizeInterpolation</a> = riNearest; const ProgressTitle: string = ''): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Create a new <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> instance with size ResizeWidth, ResizeHeight and pixels copied from us and appropriately stretched. Class of new instance is the same as our class.

<p>As with <a class="normal" href="CastleImages.TCastleImage.html#Resize">Resize</a>, ResizeTo* = 0 means to use current Width/Height. So e.g. using <a class="normal" href="CastleImages.TCastleImage.html#MakeResized">MakeResized</a>(0, 0) is the same thing as using <a class="normal" href="CastleImages.TCastleImage.html#MakeCopy">MakeCopy</a>.

<p>As with <a class="normal" href="CastleImages.TCastleImage.html#Resize">Resize</a>, if ProgressTitle &lt;&gt; '' this will call Progress.Init/Step/Fini from <a class="normal" href="CastleProgress.html">CastleProgress</a> to indicate progress of operation.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MakeResized"></a><code>function <b>MakeResized</b>(ResizeWidth, ResizeHeight: Cardinal; const Interpolation: <a  href="CastleImages.html#TResizeNiceInterpolation">TResizeNiceInterpolation</a>): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Create a new <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> instance with size ResizeWidth, ResizeHeight and pixels copied from us and appropriately stretched. It is not guaranteed that class of new instance is the same as our class.

<p>As with <a class="normal" href="CastleImages.TCastleImage.html#Resize">Resize</a>, ResizeTo* = 0 means to use current Width/Height.

<p>This uses slow but (potentially) pretty interpolation mode expressed as <a class="normal" href="CastleImages.html#TResizeNiceInterpolation">TResizeNiceInterpolation</a>. It is implemented only for some descendants &mdash; currently, <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a> and <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="FlipHorizontal"></a><code>procedure <b>FlipHorizontal</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Mirror image horizotally (that is right edge is swapped with left edge).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="FlipVertical"></a><code>procedure <b>FlipVertical</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Mirror image vertically.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MakeRotated"></a><code>function <b>MakeRotated</b>(Angle: Integer): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Make rotated version of the image. See <a class="normal" href="CastleImages.TCastleImage.html#Rotate">Rotate</a> for description of parameters.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Rotate"></a><code>procedure <b>Rotate</b>(const Angle: Integer);</code></td>
</tr>
<tr><td colspan="2">
<p>
Rotate image by Angle * 90 degrees, clockwise. For example, 0 does nothing. 1 rotates by 90 degrees, 2 rotates by 180, 3 rotates by 270. All other values (negative too) are circular (modulo), so e.g. 4 again does nothing, 5 rotates by 90 degrees and so on.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MakeTiled"></a><code>function <b>MakeTiled</b>(TileX, TileY: Cardinal): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Create a new instance with the same class, and size TileX * Width and TileY * Height and contents being our contents duplicated (tiled). Must be TileX, TileY &gt; 0.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MakeExtracted"></a><code>function <b>MakeExtracted</b>(X0, Y0, ExtractWidth, ExtractHeight: Cardinal): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Extract rectangular area of this image. X0 and Y0 are start position (lower-left corner), ExtractWidth, ExtractHeight specify size of area.

<p>This checks parameters for correctness &ndash; if start position in not good or ExtractWidth/Height are too large exception <a class="normal" href="CastleImages.EImagePosOutOfRange.html">EImagePosOutOfRange</a> is raised.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Clear"></a><code>procedure <b>Clear</b>(const Pixel: <a  href="CastleVectors.html#TVector4Byte">TVector4Byte</a>); overload; virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Set all image pixels to the same value. This is implemented only in descendants that represent a pixel as a <a class="normal" href="CastleVectors.html#TVector4Byte">TVector4Byte</a> (e.g. <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>) or <a class="normal" href="CastleVectors.html#TVector3Byte">TVector3Byte</a> (e.g. <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>, 4th component is ignored in this case).

<p>In this class this simply raises <a class="normal" href="CastleUtils.EInternalError.html">EInternalError</a> to say 'not implemented'. This also means that you must not call inherited in descendants when overriding this method.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Clear"></a><code>procedure <b>Clear</b>(const Pixel: <a  href="CastleColors.html#TCastleColor">TCastleColor</a>); overload;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="IsClear"></a><code>function <b>IsClear</b>(const Pixel: <a  href="CastleVectors.html#TVector4Byte">TVector4Byte</a>): boolean; virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Check do all image pixels have the same value Pixel. This is implemented only in descendants that represent a pixel as <a class="normal" href="CastleVectors.html#TVector4Byte">TVector4Byte</a> or <a class="normal" href="CastleVectors.html#TVector3Byte">TVector3Byte</a> (4th component is ignored in this case), just like method <a class="normal" href="CastleImages.TCastleImage.html#Clear">Clear</a>.

<p>In this class this simply raises <a class="normal" href="CastleUtils.EInternalError.html">EInternalError</a> to say 'not implemented'. This also means that you must not call inherited in descendants when overriding this method.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="TransformRGB"></a><code>procedure <b>TransformRGB</b>(const Matrix: <a  href="CastleVectors.html#TMatrix3Single">TMatrix3Single</a>); virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Multiply each RGB color by a matrix. This is a useful routine for many various conversions of image colors. Every pixel's RGB color is multiplied by given Matrix, i.e. PixelRGBColor := Matrix * PixelRGBColor.

<p>If some value in some channel will be &lt; 0, it will be set to 0. And if it will be &gt; High(Byte), it will be set to High(Byte).

<p>Examples: when Matrix = <a class="normal" href="CastleVectors.html#IdentityMatrix3Single">IdentityMatrix3Single</a>, this is NOOP. Matrix = ((2, 0, 0), (0, 1, 0), (0, 0, 1)) red channel is made lighter. Matrix = ((0, 0, 1), (0, 1, 0), (1, 0, 0)) swaps red and blue channel. Matrix = ((0.33, 0.33, 0.33), (0.33, 0.33, 0.33), (0.33, 0.33, 0.33)) is a simple conversion to grayscale (actually incorrect, even if often visually acceptable; actually instead of 0.33 one has to use GrayscaleFloat/ByteValues, this is already implemented in ImageTransformColorsTo1st function)

<p>Note: it's often more optimal to hard-code necessary color transformations as TColorModulatorFunc and use <a class="normal" href="CastleImages.TCastleImage.html#ModulateRGB">ModulateRGB</a>.

<p>This function is only implemented for images that represent Pixel as RGB values, for now this means <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a> and <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>. In case of <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a> (or any other class that represents colors as RGB + something more) alpha channel (i.e. &quot;something more&quot;) is ignored (i.e. left without any modification).

<p>In this class this simply raises <a class="normal" href="CastleUtils.EInternalError.html">EInternalError</a> to say 'not implemented'. This also means that you must not call inherited in descendants when overriding this method.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ModulateRGB"></a><code>procedure <b>ModulateRGB</b>(const ColorModulator: <a  href="CastleColors.html#TColorModulatorByteFunc">TColorModulatorByteFunc</a>); virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Process each pixel by given function. If ColorModulator = nil then this procedure does nothing. Else, every RGB color value of an image will be transformed using ColorModulator.

<p>Like <a class="normal" href="CastleImages.TCastleImage.html#TransformRGB">TransformRGB</a>: This function is only implemented for images that represent Pixel as RGB values, for now this means <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a> and <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>. In case of <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a> (or any other class that represents colors as RGB + something more) alpha channel (i.e. &quot;something more&quot;) is ignored (i.e. left without any modification).

<p>In this class this simply raises <a class="normal" href="CastleUtils.EInternalError.html">EInternalError</a> to say 'not implemented'. This also means that you must not call inherited in descendants when overriding this method.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MakeModulatedRGB"></a><code>function <b>MakeModulatedRGB</b>( const ColorModulator: <a  href="CastleColors.html#TColorModulatorByteFunc">TColorModulatorByteFunc</a>): <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Just like <a class="normal" href="CastleImages.TCastleImage.html#ModulateRGB">ModulateRGB</a>, but this returns new image, not changing initial image. This means that if ColorModulator = nil this is equivalent to <a class="normal" href="CastleImages.TCastleImage.html#MakeCopy">MakeCopy</a>.

<p>Implemented if and only if <a class="normal" href="CastleImages.TCastleImage.html#ModulateRGB">ModulateRGB</a> is implemented.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Grayscale"></a><code>procedure <b>Grayscale</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Convert image colors to grayscale.

<p>Implemented if and only if <a class="normal" href="CastleImages.TCastleImage.html#ModulateRGB">ModulateRGB</a> is implemented. When image has alpha channel, alpha channel value (or just anything beyond 3 rgb components) is ignored (not modified).

<p>This changes color to grayscale, but format of memory storage is the same. For example, for <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>, they are still kept in RGB format (just Red = Green = Blue). If you want to convert to true Grayscale format, you should use <a class="normal" href="CastleImages.TRGBImage.html#ToGrayscale">TRGBImage.ToGrayscale</a> that will create new <a class="normal" href="CastleImages.TGrayscaleImage.html">TGrayscaleImage</a> instance.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ConvertToChannelRGB"></a><code>procedure <b>ConvertToChannelRGB</b>(Channel: Integer);</code></td>
</tr>
<tr><td colspan="2">
<p>
Convert every image color using Color*Convert function from <a class="normal" href="CastleVectors.html">CastleVectors</a>. &quot;Channel&quot; parameter determines which Color*Convert function to use (Red, Green or Blue), must be 0, 1 or 2.

<p>Implemented if and only if <a class="normal" href="CastleImages.TCastleImage.html#ModulateRGB">ModulateRGB</a> is implemented.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="StripToChannelRGB"></a><code>procedure <b>StripToChannelRGB</b>(Channel: Integer);</code></td>
</tr>
<tr><td colspan="2">
<p>
Converts every image color using Color*Strip function from <a class="normal" href="CastleVectors.html">CastleVectors</a>. &quot;Channel&quot; parameter determines which Color*Strip function to use (Red, Green or Blue), must be 0, 1 or 2.

<p>Implemented if and only if <a class="normal" href="CastleImages.TCastleImage.html#ModulateRGB">ModulateRGB</a> is implemented.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="IsEqual"></a><code>function <b>IsEqual</b>(Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>): boolean;</code></td>
</tr>
<tr><td colspan="2">
<p>
Check if given Image has the same class, the same sizes (Width, Height) and contains exactly the same pixel values.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ArePartsEqual"></a><code>function <b>ArePartsEqual</b>( const SelfX0, SelfY0, SelfWidth, SelfHeight: Cardinal; Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const ImageX0, ImageY0, ImageWidth, ImageHeight: Cardinal): boolean; overload;</code></td>
</tr>
<tr><td colspan="2">
<p>
This is like <a class="normal" href="CastleImages.TCastleImage.html#IsEqual">IsEqual</a>, but is compares only given parts of the images. Note that it's your responsibility to make sure that given areas are really within the sizes of Self or Image.

<p>Overloaded version without SelfXxx parameters compares whole Self to given part of Image. Analogously, version without ImageXxx parameters compares whole Image to part of Self.

<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ArePartsEqual"></a><code>function <b>ArePartsEqual</b>( Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const ImageX0, ImageY0, ImageWidth, ImageHeight: Cardinal): boolean; overload;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ArePartsEqual"></a><code>function <b>ArePartsEqual</b>( const SelfX0, SelfY0, SelfWidth, SelfHeight: Cardinal; Image: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>): boolean; overload;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DrawFrom"></a><code>procedure <b>DrawFrom</b>(Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const X, Y: Integer);</code></td>
</tr>
<tr><td colspan="2">
<p>
Draw one image part on another image. X, Y is the lower-left position on the destination image where we draw. Optional SourceX, SourceY, SourceWidth, SourceHeight specify to use only a part of the source image (without them, we take whole source image). The pixel on source image (SourceX, SourceY) will be drawn on destination image on (X, Y).

<p>The coordinates and sizes are carefully checked, so that we do not try to take some pixels outside of the source or destination image.

<p>Note that the default implementation of this function in <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> can only directly copy the pixels, regardless of what information they have. This makes it very fast, but not suitable if the source image has some alpha channel and you want to apply it over a destination image with blending (adding scaled source to a destination color). Descendants with alpha channel should override <a class="normal" href="CastleImages.TCastleImage.html#DrawCore">DrawCore</a> to handle drawing with blending.

<p>

<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><code>Exception</code></dt>
<dd>When actual source/destination image classes are not equal. In this class, this method can only work when actual image classes are equal (that is because we directly move blocks of bytes).</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DrawFrom"></a><code>procedure <b>DrawFrom</b>(Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; X, Y, SourceX, SourceY, SourceWidth, SourceHeight: Integer);</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DrawTo"></a><code>procedure <b>DrawTo</b>(Destination: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>; const X, Y: Integer);</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="LerpWith"></a><code>procedure <b>LerpWith</b>(const Value: Single; SecondImage: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>); virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Makes linear interpolation of colors from this image and the SecondImage. Intuitively, every pixel in new image is set to

<p></p>

<pre class="preformatted">
  (1 - Value) * Self[pixel] + Value * SecondImage[pixel]
</pre>

<p>

<p>Both images need to have the exact same size. If they are not, <a class="normal" href="CastleImages.EImageLerpDifferentSizes.html">EImageLerpDifferentSizes</a> is raised.

<p>Not all <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> combinations are allowed. Every subclass is required to override this to at least handle Lerp between itself. That is, TRGBImage.Lerp has to handle Lerp with other <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>, TRGBAlphaImage.Lerp has to handle Lerp with other <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a> etc. Other combinations may be permitted, if useful and implemented. <a class="normal" href="CastleImages.EImageLerpInvalidClasses.html">EImageLerpInvalidClasses</a> is raised if given class combinations are not allowed.

<p>In this class, this simply always raises <a class="normal" href="CastleImages.EImageLerpInvalidClasses.html">EImageLerpInvalidClasses</a>.

<p> </p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleImages.EImageLerpDifferentSizes.html">EImageLerpDifferentSizes</a></dt>
<dd>When SecondImage size differs from this image.</dd>
<dt><a class="normal" href="CastleImages.EImageLerpInvalidClasses.html">EImageLerpInvalidClasses</a></dt>
<dd>When Lerp between this <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> descendant class and SecondImage class is not implemented.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="MixColors"></a><code>class procedure <b>MixColors</b>(const OutputColor: Pointer; const Weights: <a  href="CastleVectors.html#TVector4Single">TVector4Single</a>; const Colors: <a  href="CastleVectors.html#TVector4Pointer">TVector4Pointer</a>); virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Mix 4 colors, with 4 weights, into a resulting color. All 4 Colors and OutputColor must be pointers to a pixel of current image class, that is they must point to <a class="normal" href="CastleImages.TCastleImage.html#PixelSize">PixelSize</a> bytes of memory.

<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleImages.EImageLerpInvalidClasses.html">EImageLerpInvalidClasses</a></dt>
<dd>When mixing is not implemented for this image class.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Assign"></a><code>procedure <b>Assign</b>(const Source: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>); virtual;</code></td>
</tr>
<tr><td colspan="2">
<p>
Copy size and contents from Source. This sets our size (Width, Height and Depth) to match Source image, and copies pixels from the Source image, converting them as closely as possible. For example, converting RGBA to RGB will strip alpha channel, but copy RGB values.

<p>When implementing descendants: the base implementation of this method in <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> handles only the case when Image class equals our own class. And raises <a class="normal" href="CastleImages.EImageAssignmentError.html">EImageAssignmentError</a> in other cases. Override this method if you want to actually handle some convertions when assignning.

<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleImages.EImageAssignmentError.html">EImageAssignmentError</a></dt>
<dd>If it's not possible to convert from Source class to us. Not every possible convertion is implemented now.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="SaveToPascalCode"></a><code>procedure <b>SaveToPascalCode</b>(const ImageName: string; const ShowProgress: boolean; var CodeInterface, CodeImplementation, CodeInitialization, CodeFinalization: string);</code></td>
</tr>
<tr><td colspan="2">
<p>
Append code to embed this image inside Pascal source code.</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&amp;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>