File: CastleControls.TCastleImageControl.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 (315 lines) | stat: -rw-r--r-- 20,811 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
<!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: CastleControls: Class TCastleImageControl</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="TCastleImageControl"></a><h1 class="cio">Class TCastleImageControl</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><a class="section" href="#PasDoc-Properties">Properties</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a  href="CastleControls.html">CastleControls</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TCastleImageControl = class(<a class="normal" href="CastleUIControls.TUIRectangularControl.html">TUIRectangularControl</a>)</code></p>
<h2 class="description">Description</h2>
<p>
Image control inside OpenGL context. Size is automatically adjusted to the image size, if <a class="normal" href="CastleControls.TCastleImageControl.html#Stretch">Stretch</a> is <code>False</code> (default). You should set TCastleImageControl.Left, TCastleImageControl.Bottom properties, and load your image by setting <a class="normal" href="CastleControls.TCastleImageControl.html#URL">TCastleImageControl.URL</a> property or straight <a class="normal" href="CastleControls.TCastleImageControl.html#Image">TCastleImageControl.Image</a>.

<p>We automatically use alpha test or alpha blending based on loaded image alpha channel (see <a class="normal" href="CastleGLImages.TGLImage.html#Alpha">TGLImage.Alpha</a>). You can influence this by <a class="normal" href="CastleControls.TCastleImageControl.html#AlphaChannel">AlphaChannel</a> property.</p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TComponent</li>
<li class="ancestor"><a class="normal" href="CastleUIControls.TInputListener.html">TInputListener</a></li>
<li class="ancestor"><a class="normal" href="CastleUIControls.TUIControl.html">TUIControl</a></li>
<li class="ancestor"><a class="normal" href="CastleUIControls.TUIRectangularControl.html">TUIRectangularControl</a></li>
<li class="thisitem">TCastleImageControl</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="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a  href="CastleControls.TCastleImageControl.html#Create">Create</a></b>(AOwner: TComponent); 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>destructor <b><a  href="CastleControls.TCastleImageControl.html#Destroy">Destroy</a></b>; override;</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="CastleControls.TCastleImageControl.html#Render">Render</a></b>; 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="CastleControls.TCastleImageControl.html#PositionInside">PositionInside</a></b>(const Position: <a  href="CastleVectors.html#TVector2Single">TVector2Single</a>): boolean; override;</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="CastleControls.TCastleImageControl.html#GLContextOpen">GLContextOpen</a></b>; 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>procedure <b><a  href="CastleControls.TCastleImageControl.html#GLContextClose">GLContextClose</a></b>; override;</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="CastleControls.TCastleImageControl.html#Rect">Rect</a></b>: <a  href="CastleRectangles.TRectangle.html">TRectangle</a>; 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>procedure <b><a  href="CastleControls.TCastleImageControl.html#ImageChanged">ImageChanged</a></b>;</code></td>
</tr>
</table>
<a name="PasDoc-Properties"></a><h3 class="summary">Properties</h3>
<table class="summary 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"><code>property <b><a  href="CastleControls.TCastleImageControl.html#Image">Image</a></b>: <a  href="CastleImages.TCastleImage.html">TCastleImage</a> read FImage write SetImage;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#URL">URL</a></b>: string read FURL write SetURL;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#FileName">FileName</a></b>: string read FURL write SetURL; deprecated;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#AlphaChannel">AlphaChannel</a></b>: <a  href="CastleImages.html#TAutoAlphaChannel">TAutoAlphaChannel</a>
      read FAlphaChannel write SetAlphaChannel default acAuto;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#Blending">Blending</a></b>: boolean read GetBlending write SetBlending stored false; deprecated;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#Stretch">Stretch</a></b>: boolean read FStretch write SetStretch default false;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#Width">Width</a></b>: Cardinal read FWidth write SetWidth default 0;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#Height">Height</a></b>: Cardinal read FHeight write SetHeight default 0;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#FullSize">FullSize</a></b>: boolean read FFullSize write SetFullSize default false;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a  href="CastleControls.TCastleImageControl.html#Proportional">Proportional</a></b>: boolean read FProportional write SetProportional default false;</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="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>(AOwner: TComponent); override;</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="Destroy"></a><code>destructor <b>Destroy</b>; override;</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="Render"></a><code>procedure <b>Render</b>; override;</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="PositionInside"></a><code>function <b>PositionInside</b>(const Position: <a  href="CastleVectors.html#TVector2Single">TVector2Single</a>): boolean; override;</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="GLContextOpen"></a><code>procedure <b>GLContextOpen</b>; override;</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="GLContextClose"></a><code>procedure <b>GLContextClose</b>; override;</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="Rect"></a><code>function <b>Rect</b>: <a  href="CastleRectangles.TRectangle.html">TRectangle</a>; override;</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="ImageChanged"></a><code>procedure <b>ImageChanged</b>;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<h3 class="detail">Properties</h3>
<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="Image"></a><code>property <b>Image</b>: <a  href="CastleImages.TCastleImage.html">TCastleImage</a> read FImage write SetImage;</code></td>
</tr>
<tr><td colspan="2">
<p>
Image displayed, or <code>Nil</code> if none. This image is owned by this component. If you set this property to your custom <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> instance you should leave memory management of this instance to this component. If necessary, you can always create a copy by <a class="normal" href="CastleImages.TCastleImage.html#MakeCopy">TCastleImage.MakeCopy</a> if you want to give here only a copy.

<p>It is allowed to modify the contents or even size of this image. Just make sure to call <a class="normal" href="CastleControls.TCastleImageControl.html#ImageChanged">ImageChanged</a> after the modifications are done to update the actual rendered image. The control size will be updated immediately (respecing current <a class="normal" href="CastleControls.TCastleImageControl.html#Stretch">Stretch</a> and related properties).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="URL"></a><code>property <b>URL</b>: string read FURL write SetURL;</code></td>
</tr>
<tr><td colspan="2">
<p>
<code>URL</code> of the image. Setting this also sets <a class="normal" href="CastleControls.TCastleImageControl.html#Image">Image</a>. Set this to '' to clear the image.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="FileName"></a><code>property <b>FileName</b>: string read FURL write SetURL; deprecated;</code></td>
</tr>
<tr><td colspan="2">
<p class="hint_directive">Warning: this symbol is deprecated.</p><p>
Deprecated name for <a class="normal" href="CastleControls.TCastleImageControl.html#URL">URL</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="AlphaChannel"></a><code>property <b>AlphaChannel</b>: <a  href="CastleImages.html#TAutoAlphaChannel">TAutoAlphaChannel</a>
      read FAlphaChannel write SetAlphaChannel default acAuto;</code></td>
</tr>
<tr><td colspan="2">
<p>
How to treat alpha channel of the assigned image. By default, this is acAuto, which means that image contents determine how the alpha of image is treated (opaque, alpha test, alpha blending). Set this to force specific treatment.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Blending"></a><code>property <b>Blending</b>: boolean read GetBlending write SetBlending stored false; deprecated;</code></td>
</tr>
<tr><td colspan="2">
<p class="hint_directive">Warning: this symbol is deprecated.</p><p>
Deprecated, use more flexible <a class="normal" href="CastleControls.TCastleImageControl.html#AlphaChannel">AlphaChannel</a> instead.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Stretch"></a><code>property <b>Stretch</b>: boolean read FStretch write SetStretch default false;</code></td>
</tr>
<tr><td colspan="2">
<p>
Size of the image control.

<p>If <code>Stretch</code> = <code>False</code>, then values you set for Width, Height, <a class="normal" href="CastleControls.TCastleImageControl.html#FullSize">FullSize</a>, <a class="normal" href="CastleControls.TCastleImageControl.html#Proportional">Proportional</a> properties do not matter (they are still remembered though, so you can set properties in any order). The displayed size (you can check it through <a class="normal" href="CastleControls.TCastleImageControl.html#Rect">Rect</a> function) always corresponds to the underlying image size. The Left and Bottom properties work as usual, they allow you to move the control.

<p>If <code>Stretch</code> = <code>True</code>, then the image will be stretched to fill the requested area. </p>

<ul class="paragraph_spacing">
  <li><p>If <code>Stretch</code> = <code>True</code> and <a class="normal" href="CastleControls.TCastleImageControl.html#FullSize">FullSize</a> = <code>True</code> then values of Width, Height, Left, Bottom do not matter: image always fills the whole container (<a class="normal" href="CastleControls.TCastleImageControl.html#Rect">Rect</a> corresponds to the container area).</p></li>
  <li><p>Otherwise, if <code>Stretch</code> = <code>True</code> and <a class="normal" href="CastleControls.TCastleImageControl.html#Proportional">Proportional</a> = <code>True</code>, then the image will be proportionally scaled to fit within the requested Width and Height. If the aspect ratio of image will be different than aspect ratio of Width/Height, the scaled image will be centered inside the Width/Height.</p></li>
  <li><p>Otherwise, if <code>Stretch</code> = <code>True</code> but no other condition (so <a class="normal" href="CastleControls.TCastleImageControl.html#FullSize">FullSize</a> = <code>False</code> and <a class="normal" href="CastleControls.TCastleImageControl.html#Proportional">Proportional</a> = <code>False</code>) then the image will be scaled to exactly fill the requested Width and Height (without paying attention to the aspect ratio of the image).

<p>This is the case when you fully force the displayed size and position, regardless of image size. Displayed image will always exactly fill the requested area. </p></li>
</ul>

<p>

<p>Note that you can always look at <a class="normal" href="CastleControls.TCastleImageControl.html#Rect">Rect</a> value to know the current calculated size and position of the image control on screen.

<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Width"></a><code>property <b>Width</b>: Cardinal read FWidth write SetWidth default 0;</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="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Height"></a><code>property <b>Height</b>: Cardinal read FHeight write SetHeight default 0;</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="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="FullSize"></a><code>property <b>FullSize</b>: boolean read FFullSize write SetFullSize default false;</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="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Proportional"></a><code>property <b>Proportional</b>: boolean read FProportional write SetProportional default false;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</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:09</em>
</span>
</td></tr></table></body></html>