  Platform eXtended Library (PXL)Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TAtlasImage
Unit
PXL.Images
Declaration
type TAtlasImage = class(TCustomCanvasImage)
Description
Atlas image may contain one or more textures and multiple regions, which can be selected when rendering on canvas.
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
constructor Create(const ADevice: TCustomDevice; const ASubscribedTextures: Boolean = True); |
|
Creates new instance of TAtlasImage class bound to the specified device. ASubscribedTextures indicates whether the textures contained in this image should be subscribed to handle "lost device" events. If this image is part of TAtlasImages list, which provides its own notification events regarding device status, then ASubscribedTextures should be set to False.
|
 |
function DeviceRestore: Boolean; virtual; |
|
Restores the image after its texture surfaces have been lost (that is, after DeviceRelease call). Note that this method should only be called when ASubscribedTextures has been set to False during creation.
|
 |
function IndexOfTexture(const Texture: TCustomLockableTexture): Integer; |
|
Returns index of the specified texture in the list. If no such texture is found, -1 is returned.
|
 |
function InsertTexture(const InitWidth, InitHeight: Integer): TCustomLockableTexture; overload; |
|
Inserts a new texture to the list of existing textures and tries to initialize with the given width and height, returning its index. If initialization fails, then Nil is returned and the texture is not added to the list.
|
 |
function InsertTexture: Integer; overload; |
|
Inserts a new texture (not initialized) to the list of existing textures and returns its index.
|
 |
function LoadFromAsset(const AssetName: StdString; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; |
|
Loads image with the specified file name from /assets sub-folder on Android platform. This uses image format manager reference from the associated device. Returns True when succeeded and False otherwise. The method is unsupported on non-Android platforms.
|
 |
function LoadFromFile(const FileName: StdString; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; |
|
Loads image with the specified file name from disk. This uses image format manager reference from the associated device. Returns True when succeeded and False otherwise.
|
 |
function LoadFromStream(const Extension: StdString; const Stream: TStream; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; |
|
Loads image with format corresponding to the given extension from the stream. This uses image format manager reference from the associated device. Returns True when succeeded and False otherwise.
|
 |
function GetRegion(const Index: Integer): TIntRectList.PItem; override; |
|
Retrieves the region specified by its index with information regarding texture number and margins. If the index is outside of valid range, Nil is returned.
|
 |
function GetTexture(const Index: Integer): TCustomBaseTexture; override; |
|
Provides access to individual textures in the image based on the specified index. If the index is outside of valid range, Nil is returned.
|
 |
function GetTextureCount: Integer; override; |
|
Returns the number of textures present in the image.
|
 |
procedure ClearTextures; |
|
Removes any existing textures from the list.
|
 |
procedure DeviceRelease; virtual; |
|
Releases the image's texture surfaces when the device has been lost. Note that this method should only be called when ASubscribedTextures has been set to False during creation.
|
 |
procedure RemoveTexture(const Index: Integer); |
|
Removes texture with the specified index from the list.
|
 |
procedure SetupRegionPatterns(const PatternSize: TPoint2i; VisibleSize: TPoint2i; const PatternCount: Integer = 0); overload; |
|
Configures the list of regions as if they were rectangular patterns in the image tiled horizontally in series of rows and columns. This fills Regions with new data.
Parameters
- PatternSize
- Defines the size of individual pattern.
- VisibleSize
- Defines the "visible" size inside each individual pattern. This should either match
PatternSize or be smaller.
- PatternCount
- Determines the total number of patterns inside the image. The total number of resulting regions will be equal or smaller than this number.
|
 |
procedure SetupRegionPatterns(const PatternSize: TPoint2i); overload; inline; |
|
Configures the list of regions as if they were rectangular patterns in the image tiled horizontally in series of rows and columns. This fills Regions with new data.
|
Properties
 |
property Device: TCustomDevice read FDevice; |
|
The device to which this image is bound to.
|
 |
property DynamicImage: Boolean read FDynamicImage write FDynamicImage; |
|
Determines whether this image requires frequent access to its pixel data. If this parameter is set to True, dynamic textures will be used, where pixel data can be updated frequently. This should be used when image pixels need to be updated at least once per frame.
|
 |
property MipMapping: Boolean read FMipMapping write FMipMapping; |
|
Determines whether the image should contain mipmap data. This can increase memory consumption and slow down the loading of images, but produces better visual results when the image is shrunk to smaller sizes.
|
 |
property Name: StdString read FName write FName; |
|
Unique name of the image by which it can be referenced in TAtlasImages list.
|
 |
property PixelFormat: TPixelFormat read FPixelFormat write FPixelFormat; |
|
The pixel format that will be used in all image's textures. This parameter is merely a hint and different format may be used in the textures, depending on hardware support; if this format is not supported, usually the closest format will be chosen in textures. When loading pixel data, the conversion will be done automatically, if the texture format does not match the stored pixel format.
|
 |
property PremultipliedAlpha: Boolean read FPremultipliedAlpha write FPremultipliedAlpha; |
|
Indicates whether the pixels in this image have premultiplied or non-premultiplied alpha. This does not affect the actual pixels, it is merely a hint for rendering canvas.
|
 |
property Regions: TIntRectList read FRegions; |
|
This list contains rectangles (with texture number stored as extra pointer value) that define individual sub-images located on one or several textures.
|
 |
property SubscribedTextures: Boolean read FSubscribedTextures; |
|
Indicates whether this class has textures subscribed to device events, handling scenarios such as "device lost". If this is set to False, likely the handling is provided by parent list class such as TAtlasImages through use of DeviceRestore and DeviceRelease events.
|
 |
property Texture[constIndex:Integer]: TCustomLockableTexture read GetLockableTexture; |
|
Provides access to each texture present in the image by its index. If the index is specified outside of valid range, then Nil is returned.
|
 |
property TextureCount: Integer read GetTextureCount; |
|
Total number of textures present in this image.
|
Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.
|