Castle Game Engine: CastleControls: Class TCastleImageControl

# Class TCastleImageControl
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleControls ## Declaration `type TCastleImageControl = class(TUIRectangularControl)` ## Description Image control inside OpenGL context. Size is automatically adjusted to the image size, if Stretch is `False` (default). You should set TCastleImageControl.Left, TCastleImageControl.Bottom properties, and load your image by setting TCastleImageControl.URL property or straight TCastleImageControl.Image. We automatically use alpha test or alpha blending based on loaded image alpha channel (see TGLImage.Alpha). You can influence this by AlphaChannel property. ## Hierarchy TComponent TInputListener TUIControl TUIRectangularControl TCastleImageControl ## Overview ### Methods
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `procedure Render; override;`
| `function PositionInside(const Position: TVector2Single): boolean; override;`
| `procedure GLContextOpen; override;`
| `procedure GLContextClose; override;`
| `function Rect: TRectangle; override;`
| `procedure ImageChanged;`
### Properties
| `property Image: TCastleImage read FImage write SetImage;`
| `property URL: string read FURL write SetURL;`
| `property FileName: string read FURL write SetURL; deprecated;`
| `property AlphaChannel: TAutoAlphaChannel read FAlphaChannel write SetAlphaChannel default acAuto;`
| `property Blending: boolean read GetBlending write SetBlending stored false; deprecated;`
| `property Stretch: boolean read FStretch write SetStretch default false;`
| `property Width: Cardinal read FWidth write SetWidth default 0;`
| `property Height: Cardinal read FHeight write SetHeight default 0;`
| `property FullSize: boolean read FFullSize write SetFullSize default false;`
| `property Proportional: boolean read FProportional write SetProportional default false;`
## Description ### Methods
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `procedure Render; override;`
| `function PositionInside(const Position: TVector2Single): boolean; override;`
| `procedure GLContextOpen; override;`
| `procedure GLContextClose; override;`
| `function Rect: TRectangle; override;`
| `procedure ImageChanged;`
### Properties
| `property Image: TCastleImage read FImage write SetImage;`
Image displayed, or `Nil` if none. This image is owned by this component. If you set this property to your custom TCastleImage instance you should leave memory management of this instance to this component. If necessary, you can always create a copy by TCastleImage.MakeCopy if you want to give here only a copy. It is allowed to modify the contents or even size of this image. Just make sure to call ImageChanged after the modifications are done to update the actual rendered image. The control size will be updated immediately (respecing current Stretch and related properties).
| `property URL: string read FURL write SetURL;`
`URL` of the image. Setting this also sets Image. Set this to '' to clear the image.
| `property FileName: string read FURL write SetURL; deprecated;`
Warning: this symbol is deprecated. Deprecated name for URL.
| `property AlphaChannel: TAutoAlphaChannel read FAlphaChannel write SetAlphaChannel default acAuto;`
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.
| `property Blending: boolean read GetBlending write SetBlending stored false; deprecated;`
Warning: this symbol is deprecated. Deprecated, use more flexible AlphaChannel instead.
| `property Stretch: boolean read FStretch write SetStretch default false;`
Size of the image control. If `Stretch` = `False`, then values you set for Width, Height, FullSize, Proportional 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 Rect function) always corresponds to the underlying image size. The Left and Bottom properties work as usual, they allow you to move the control. If `Stretch` = `True`, then the image will be stretched to fill the requested area. If `Stretch` = `True` and FullSize = `True` then values of Width, Height, Left, Bottom do not matter: image always fills the whole container (Rect corresponds to the container area). Otherwise, if `Stretch` = `True` and Proportional = `True`, 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. Otherwise, if `Stretch` = `True` but no other condition (so FullSize = `False` and Proportional = `False`) then the image will be scaled to exactly fill the requested Width and Height (without paying attention to the aspect ratio of the image). 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. Note that you can always look at Rect value to know the current calculated size and position of the image control on screen.
| `property Width: Cardinal read FWidth write SetWidth default 0;`
| `property Height: Cardinal read FHeight write SetHeight default 0;`
| `property FullSize: boolean read FFullSize write SetFullSize default false;`
| `property Proportional: boolean read FProportional write SetProportional default false;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:09