Class TAdCustomImage

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TAdCustomImage = class(TAdRenderingObject)

Description

TAdCustomImage is the base image class. Images are objects, that manage drawing operations of texturized planes. TAdCustomImage doesn't generate its own texture object. If you want to use a bitmap texture, use TAdImage instead. TAdCustomImage is able to draw the image stretched, rotated, blended. You are also able to draw an excerpt of the image.

See also
TAdImage
A image class that contains a bitmap texture.
TAdTexture
TAdTexture extends TAdCustomTexture and contains a bitmap texture.
TAdCustomTexture
TAdCustomTexture is the base, abstract texture class.

Hierarchy

Overview

Fields

Public AdMesh:TAd2DMesh;

Methods

Public constructor Create(AAdDraw:TAdDraw); virtual;
Public destructor Destroy; override;
Public procedure Draw(Dest:TAdSurface;X,Y,PatternIndex:integer);
Public procedure StretchDraw(Dest:TAdSurface; const DestRect:TAdRect; PatternIndex:integer);
Public procedure DrawAdd(Dest: TAdSurface; const DestRect: TAdRect; PatternIndex: Integer; Alpha: Integer);
Public procedure DrawAlpha(Dest: TAdSurface; const DestRect: TAdRect; PatternIndex: Integer; Alpha: Integer);
Public procedure DrawMask(Dest: TAdSurface; const DestRect: TAdRect; PatternIndex: Integer; Alpha: Integer);
Public procedure DrawRotate(Dest: TAdSurface; X, Y, Width, Height: Integer; PatternIndex: Integer; CenterX, CenterY: Double; Angle: Integer);
Public procedure DrawRotateAdd(Dest: TAdSurface; X, Y, Width, Height: Integer; PatternIndex: Integer; CenterX, CenterY: Double; Angle: Integer; Alpha: Integer);
Public procedure DrawRotateAlpha(Dest: TAdSurface; X, Y, Width, Height: integer; PatternIndex: integer; CenterX, CenterY: double; Angle: integer; Alpha: integer);
Public procedure DrawRotateMask(Dest: TAdSurface; X, Y, Width, Height: integer; PatternIndex: integer; CenterX, CenterY: double; Angle: integer; Alpha: integer);
Public procedure DrawEx(Dest: TAdSurface; SourceRect, DestRect: TAdRect; CenterX, CenterY: double; Angle: integer; Alpha: integer; BlendMode: TAd2dBlendMode);
Public procedure Restore;
Public procedure Finalize;
Public procedure Initialize;
Public function GetPatternRect(ANr: integer):TAdRect;

Properties

Public property Parent: TAdDraw read FParent write FParent;
Public property Width: integer read GetWidth;
Public property Height: integer read GetHeight;
Public property PatternWidth: integer read FPatternWidth write SetPatternWidth;
Public property PatternHeight: integer read FPatternHeight write SetPatternHeight;
Public property SkipWidth: integer read FSkipWidth write SetSkipWidth;
Public property SkipHeight: integer read FSkipHeight write SetSkipHeight;
Public property Texture: TAdCustomTexture read FTexture write SetTexture;
Public property PatternCount: integer read GetPatternCount;
Public property PatternStop: integer read FPatternStop write FPatternStop;
Public property Color: longint read FColor write FColor;
Public property Details: integer read FDetails write SetDetails;
Public property Filter: TAd2dTextureFilter read GetFilter write SetFilter;

Description

Fields

Public AdMesh:TAd2DMesh;

The underlying mesh object used to display the image.

Methods

Public constructor Create(AAdDraw:TAdDraw); virtual;

Creates a new instance of TAdCustomImage.

Parameters
AAdDraw
specifies the parent TAdDraw component. This is not the surface drawing operations should be performed on. If you want to draw an image on another surface use the "Dest" parameter instead.
Public destructor Destroy; override;

Destroys the instance of TAdCustomImage.

Public procedure Draw(Dest:TAdSurface;X,Y,PatternIndex:integer);

Draws the image at a specified position. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
X
specifies the X-Position of the image.
Y
specifies the Y-Position of the image.
PatternIndex
specifies the index of the image pattern.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure StretchDraw(Dest:TAdSurface; const DestRect:TAdRect; PatternIndex:integer);

Draws the image to the specified rectangular region. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
DestRect
specifies the destination region the image should be drawn to. You can flip the image if you replace the top/bottom and the left/right coordinates. Remember to turn culling of if you want to do this.
PatternIndex
specifies the index of the image pattern.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawAdd(Dest: TAdSurface; const DestRect: TAdRect; PatternIndex: Integer; Alpha: Integer);

Draws the image to the specified rectangular region using additive blending. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
DestRect
specifies the destination region the image should be drawn to. You can flip the image if you replace the top/bottom and the left/right coordinates. Remember to turn culling of if you want to do this.
PatternIndex
specifies the index of the image pattern.
Alpha
specifies the transparency of the image.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawAlpha(Dest: TAdSurface; const DestRect: TAdRect; PatternIndex: Integer; Alpha: Integer);

Draws the image to the specified rectangular region using alpha blending. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
DestRect
specifies the destination region the image should be drawn to. You can flip the image if you replace the top/bottom and the left/right coordinates. Remember to turn culling of if you want to do this.
PatternIndex
specifies the index of the image pattern.
Alpha
specifies the transparency of the image.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawMask(Dest: TAdSurface; const DestRect: TAdRect; PatternIndex: Integer; Alpha: Integer);

Draws the image to the specified rectangular region. This special blend mode draws the alpha channel only. So this blend mode can be used for drawing shadows. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
DestRect
specifies the destination region the image should be drawn to. You can flip the image if you replace the top/bottom and the left/right coordinates. Remember to turn culling of if you want to do this.
PatternIndex
specifies the index of the image pattern.
Alpha
specifies the transparency of the image.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawRotate(Dest: TAdSurface; X, Y, Width, Height: Integer; PatternIndex: Integer; CenterX, CenterY: Double; Angle: Integer);

Draws the image to the specified rectangular region. The image can be rotated around a user defined rotation center. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
X
specifies the X-Position of the image.
Y
specifies the Y-Position of the image.
Width
specifies the width of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
Height
specifies the height of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
PatternIndex
specifies the index of the image pattern.
CenterX
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
CenterY
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
Angle
is the rotation angle in degrees.
Alpha
specifies the transparency of the image.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawRotateAdd(Dest: TAdSurface; X, Y, Width, Height: Integer; PatternIndex: Integer; CenterX, CenterY: Double; Angle: Integer; Alpha: Integer);

Draws the image to the specified rectangular region. The image can be rotated around a user defined rotation center. The image is drawn using additive blending. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
X
specifies the X-Position of the image.
Y
specifies the Y-Position of the image.
Width
specifies the width of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
Height
specifies the height of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
PatternIndex
specifies the index of the image pattern.
CenterX
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
CenterY
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
Angle
is the rotation angle in degrees.
Alpha
specifies the transparency of the image.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawRotateAlpha(Dest: TAdSurface; X, Y, Width, Height: integer; PatternIndex: integer; CenterX, CenterY: double; Angle: integer; Alpha: integer);

Draws the image to the specified rectangular region. The image can be rotated around a user defined rotation center. The image is drawn using aplha blending. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
X
specifies the X-Position of the image.
Y
specifies the Y-Position of the image.
Width
specifies the width of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
Height
specifies the height of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
PatternIndex
specifies the index of the image pattern.
CenterX
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
CenterY
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
Angle
is the rotation angle in degrees.
Alpha
specifies the transparency of the image.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawRotateMask(Dest: TAdSurface; X, Y, Width, Height: integer; PatternIndex: integer; CenterX, CenterY: double; Angle: integer; Alpha: integer);

Draws the image to the specified rectangular region. The image can be rotated around a user defined rotation center. The image is drawn using the so called "mask" mode. This special blend mode draws the alpha channel only. So this blend mode can be used for drawing shadows. All positions are relative to the coordinate system of the scene of the surface.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
X
specifies the X-Position of the image.
Y
specifies the Y-Position of the image.
Width
specifies the width of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
Height
specifies the height of the image. If this value is negative the image will be flipped. If you want to do this, remember to turn culling off.
PatternIndex
specifies the index of the image pattern.
CenterX
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
CenterY
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
Angle
is the rotation angle in degrees.
Alpha
specifies the transparency of the image.
See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public procedure DrawEx(Dest: TAdSurface; SourceRect, DestRect: TAdRect; CenterX, CenterY: double; Angle: integer; Alpha: integer; BlendMode: TAd2dBlendMode);

The DrawEx function can be used to draw a specific part of an image with a user definded rotation and in every available blendmode. All other drawing functions can be done using this function. If you want to do animations you can use the "GetPatternRect" function of TAdCustomImage and pass it to SourceRect.

Parameters
Dest
specifies the target surface. If "Dest" is Nil, the active surface will be used.
SourceRect
specifies the rectangle, from which image data is copied. The coordinates are absolute. If they are bigger or smaller than the texture sizes, the image will be tiled. Due to hardware limitations all textures are internally scaled to a power of two texture. If you want to draw your texture tiled and it isn't in a power of two size, you'll see strange gaps between the tiles.
DestRect
specifies the destination region the image should be drawn to. You can flip the image if you replace the top/bottom and the left/right coordinates. Remember to turn culling of if you want to do this.
CenterX
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
CenterY
specifies the relative center of the rotation. A value of 0.5 is the center of the image.
Angle
is the rotation angle in degrees.
Alpha
specifies the transparency of the image.
BlendMode
spcifies how the image should be blended over the existing surface content.
See also
TAd2dBlendMode
Declares, how a mesh is blended
GetPatternRect
Returns the texture rectangle of a pattern.
Public procedure Restore;

If you make any changes to the texture or set a new one, call restore to assing the new texture to the mesh and recalculates the pattern rects and the vertex grid.

Public procedure Finalize;

Frees the mesh object. Finalize is normally automatically called when the main TAdDraw is finalized.

See also
Restore
If you make any changes to the texture or set a new one, call restore to assing the new texture to the mesh and recalculates the pattern rects and the vertex grid.
Initialize
Initialize creates a new mesh object.
Public procedure Initialize;

Initialize creates a new mesh object.

Public function GetPatternRect(ANr: integer):TAdRect;

Returns the texture rectangle of a pattern. ANr is clamped to [0;PatternCount]

Properties

Public property Parent: TAdDraw read FParent write FParent;

Returns the parent TAdDraw you've set in the constructor.

Public property Width: integer read GetWidth;

Returns the width of the image. If pattern width and pattern height is set, this size is returned.

Public property Height: integer read GetHeight;

Returns the height of the image. If pattern width and pattern height is set, this size is returned.

Public property PatternWidth: integer read FPatternWidth write SetPatternWidth;

Set the width of one animation pattern.

Public property PatternHeight: integer read FPatternHeight write SetPatternHeight;

Set the height of one animation pattern.

Public property SkipWidth: integer read FSkipWidth write SetSkipWidth;

The horizontal space between the animation patterns.

Public property SkipHeight: integer read FSkipHeight write SetSkipHeight;

The vertical space between the animation patterns.

Public property Texture: TAdCustomTexture read FTexture write SetTexture;

The texture assigned to the image. Call restore after you've set a new texture.

See also
Restore
If you make any changes to the texture or set a new one, call restore to assing the new texture to the mesh and recalculates the pattern rects and the vertex grid.
Public property PatternCount: integer read GetPatternCount;

Returns the count of animation patterns.

See also
PatternWidth
Set the width of one animation pattern.
PatternHeight
Set the height of one animation pattern.
SkipWidth
The horizontal space between the animation patterns.
SkipHeight
The vertical space between the animation patterns.
Public property PatternStop: integer read FPatternStop write FPatternStop;

If you have empty patterns, you may set PatternStop. PatternCount will be decrased by PatternStop.

See also
PatternStop
If you have empty patterns, you may set PatternStop.
Public property Color: longint read FColor write FColor;

Defines the color the image is drawn in. The color is in BGR order and compatible to the color constants in the VCL/LCL.

Public property Details: integer read FDetails write SetDetails;

Important for using lights: How many grid cols and rows does the image have. Grid count is Details*Details.

Public property Filter: TAd2dTextureFilter read GetFilter write SetFilter;

The filter that should be used when a texture is mini- or magnified. Setting this property will cause in overriding the filter of the texture.

See also
TAd2dTextureFilter
Specifies the way textures are filtered.

SourceForge.net Logo


Generated by PasDoc 0.11.0 on 2008-12-31 14:31:59