Class TCastleImageTransform

Unit

Declaration

type TCastleImageTransform = class(TCastleTransform)

Description

Image (that you can place within TCastleViewport) with configurable size and repeat. Positioned in XY plane by defalut, so most suitable for 2D games.

Hierarchy

Overview

Methods

Protected function InternalBuildNodeInside: TObject; override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;
Public procedure BeforeDestruction; override;
Public procedure ReloadUrl;

Properties

Public property Pivot: TVector2 read FPivot write SetPivot;
Public property Size: TVector2 read FSize write SetSize;
Public property RepeatImage: TVector2 read FRepeatImage write SetRepeatImage;
Public property Shift: TVector2 read FShift write SetShift;
Public property Color: TCastleColor read FColor write SetColor;
Public property ImageWidth: Cardinal read FImageWidth;
Public property ImageHeight: Cardinal read FImageHeight;
Published property SmoothScaling: Boolean read FSmoothScaling write SetSmoothScaling default true;
Published property AlphaChannel: TAutoAlphaChannel read FAlphaChannel write SetAlphaChannel default acAuto;
Published property Url: String read FUrl write SetUrl;
Published property Mipmaps: Boolean read FMipmaps write SetMipmaps default false;
Published property PivotPersistent: TCastleVector2Persistent read FPivotPersistent ;
Published property SizePersistent: TCastleVector2Persistent read FSizePersistent ;
Published property RepeatImagePersistent: TCastleVector2Persistent read FRepeatImagePersistent ;
Published property ShiftPersistent: TCastleVector2Persistent read FShiftPersistent ;
Published property ColorPersistent: TCastleColorPersistent read FColorPersistent ;

Description

Methods

Protected function InternalBuildNodeInside: TObject; override;

This item has no description. Showing description inherited from TCastleTransform.InternalBuildNodeInside.

Helper for InternalBuildNode. Result must be TAbstractChildNode or Nil.

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public function PropertySections(const PropertyName: String): TPropertySections; override;

This item has no description. Showing description inherited from TCastleComponent.PropertySections.

Section where to show property in the editor.

Public procedure BeforeDestruction; override;

This item has no description.

Public procedure ReloadUrl;

Load again the image from current URL. This makes sense to be used when underlying file on disk changed, and you want to reload it.

TODO: In case image is shared with other TCastleImageTransform instances, or TCastleScene (refering to the same image using TImageTextureNode), for now this method will not load new image from disk. That's because the previous image contents will "survive" in the cache.

Properties

Public property Pivot: TVector2 read FPivot write SetPivot;

How is the image placed within its own coordinate system. Default value (0.5, 0.5) means that the middle of the image is at (0,0,0). Value (0, 0) means that the left-bottom corner of the image is at (0,0,0).

Public property Size: TVector2 read FSize write SetSize;

Optionally resize the image. This is equivalent o using TCastleTransform.Scale to scale the image, except you can specify a value in terms of image size (in image pixels).

  • When both X and Y are zero, the image is not resized.

  • When only X is non-zero, the image is resized to given width, preserving the image aspect ratio (proportions).

  • When only Y is non-zero, the image is resized to given height, preserving the image aspect ratio (proportions).

  • When both X and Y are non-zero, the image is resized to given width and height, ignoring the image aspect ratio.

The size determines the size assuming that RepeatImage is (1,1). When RepeatImage is different – the size is actually multiplied by the RepeatImage. This makes it easy to create a continuous block of images by just increasing RepeatImage.

Public property RepeatImage: TVector2 read FRepeatImage write SetRepeatImage;

How many times to repeat the image, along X and Y. By default this is (1,1).

Public property Shift: TVector2 read FShift write SetShift;

How is the image shifted. This just shifts the texture coordinates, not moving the geometry. By default this is (0,0).

Public property Color: TCastleColor read FColor write SetColor;

Color to multiply by image. By default, opaque white.

Public property ImageWidth: Cardinal read FImageWidth;

Loaded image width.

This is not affected by any resizing done by Size or scaling done by TCastleTransform.Scale. This property reflects the underlying image size.

Zero if no image is loaded.

Public property ImageHeight: Cardinal read FImageHeight;

Loaded image height.

This is not affected by any resizing done by Size or scaling done by TCastleTransform.Scale. This property reflects the underlying image size.

Zero if no image is loaded.

Published property SmoothScaling: Boolean read FSmoothScaling write SetSmoothScaling default true;

How is the image scaled. Determines scaling done both by Size and TCastleTransform.Scale.

Published property AlphaChannel: TAutoAlphaChannel read FAlphaChannel write SetAlphaChannel default acAuto;

How to treat alpha channel of the image. By default, this is acAuto, which means that image contents together with current Color determine how the alpha of image is treated (opaque, alpha test, alpha blending). Set this property force specific treatment.

Published property Url: String read FUrl write SetUrl;

URL of the image to be loaded. When empty, no image is loaded and this is invisible.

Published property Mipmaps: Boolean read FMipmaps write SetMipmaps default false;

Mipmaps make the image look good when it scaled to be much smaller on the screen. Using mipmaps also forces the image to have power-of-2 size (it will be resized to power-of-2 if necessary).

Mipmaps typically make sense for 3D objects, when the camera may move arbitrarily far from the object. For 2D games, you usually don't want to use mipmaps, as you often want to avoid scaling the image to be power-of-2.

Published property PivotPersistent: TCastleVector2Persistent read FPivotPersistent ;

Pivot that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Pivot directly.

See also
Pivot
How is the image placed within its own coordinate system.
Published property SizePersistent: TCastleVector2Persistent read FSizePersistent ;

Size that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Size directly.

See also
Size
Optionally resize the image.
Published property RepeatImagePersistent: TCastleVector2Persistent read FRepeatImagePersistent ;

RepeatImage that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write RepeatImage directly.

See also
RepeatImage
How many times to repeat the image, along X and Y.
Published property ShiftPersistent: TCastleVector2Persistent read FShiftPersistent ;

Shift that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Shift directly.

See also
Shift
How is the image shifted.
Published property ColorPersistent: TCastleColorPersistent read FColorPersistent ;

Color that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Color directly.

See also
Color
Color to multiply by image.

Generated by PasDoc 0.16.0-snapshot.