Class TAtlasImages

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TAtlasImages = class(TObject)

Description

The list that may contain one or more instances of TAtlasImage and provide facilities to search for images by their unique names, image loading and handling "device lost" scenario.

Hierarchy

  • TObject
  • TAtlasImages

Overview

Methods

Public constructor Create(const ADevice: TCustomDevice);
Public function AddFromAsset(const AssetName: StdString; const ImageName: StdString = ''; const MipMapping: Boolean = True; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer;
Public function AddFromFile(const FileName: StdString; const ImageName: StdString = ''; const MipMapping: Boolean = True; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer;
Public function AddFromStream(const Extension: StdString; const Stream: TStream; const ImageName: StdString = ''; const MipMapping: Boolean = True; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer;
Public function Include(const Element: TAtlasImage): Integer;
Public function IndexOf(const ImageName: StdString): Integer; overload;
Public function IndexOf(const Element: TAtlasImage): Integer; overload;
Public function Insert(const Image: TAtlasImage): Integer;
Public procedure Clear;
Public procedure MarkSearchDirty;
Public procedure Remove(const Index: Integer);

Properties

Public property Device: TCustomDevice read FDevice;
Public property Image[constName:StdString]: TAtlasImage read GetImage;
Public property ItemCount: Integer read GetItemCount;
Public property Items[constIndex:Integer]: TAtlasImage read GetItem;

Description

Methods

Public constructor Create(const ADevice: TCustomDevice);

Creates new instance of TAtlasImages class bound to the specified device. Elements inside this list should be bound to the same device (and if they are created by this class, they automatically are).

Public function AddFromAsset(const AssetName: StdString; const ImageName: StdString = ''; const MipMapping: Boolean = True; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer;

Loads image from the specified file located in /assets sub-folder. This function only works on Android platform. This uses image format manager reference from the associated device.

Parameters
FileName
A valid file name (with extension) that represents the image.
ImageName
New name of the image that should be added to the list.
AlphaFormatRequest
The preference for premultipled or non-premultiplied alpha that should be used while loading the image.
PixelFormat
The preference for certain pixel format when loading the image. It may or may not be followed, depending on platform and support and a closest match may potentially be selected.
Returns

Image index in the list or -1 on error.

Public function AddFromFile(const FileName: StdString; const ImageName: StdString = ''; const MipMapping: Boolean = True; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer;

Loads image from the specified file on disk. This uses image format manager reference from the associated device.

Parameters
FileName
A valid file name (with extension) that includes full path that represents the image.
ImageName
New name of the image that should be added to the list.
AlphaFormatRequest
The preference for premultipled or non-premultiplied alpha that should be used while loading the image.
PixelFormat
The preference for certain pixel format when loading the image. It may or may not be followed, depending on platform and support and a closest match may potentially be selected.
Returns

Image index in the list or -1 on error.

Public function AddFromStream(const Extension: StdString; const Stream: TStream; const ImageName: StdString = ''; const MipMapping: Boolean = True; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer;

Loads image with format corresponding to the given extension from the stream. This uses image format manager reference from the associated device.

Parameters
Extension
Extension (including dot, e.g. ".png") that represents the format in which the image is stored in the stream.
Stream
Stream which will be used for reading the image from. The current position of the stream will be used and after the call it will be adjusted to be right at the end of image data.
ImageName
New name of the image that should be added to the list.
AlphaFormatRequest
The preference for premultipled or non-premultiplied alpha that should be used while loading the image.
PixelFormat
The preference for certain pixel format when loading the image. It may or may not be followed, depending on platform and support and a closest match may potentially be selected.
Returns

Image index in the list or -1 on error.

Public function Include(const Element: TAtlasImage): Integer;

Includes the specified image to the list, if it wasn't included previously. This implies searching the list before adding the element, which may impact performance.

Public function IndexOf(const ImageName: StdString): Integer; overload;

Returns index of the specified image element by its name in the list. If no image is found, -1 is returned.

Public function IndexOf(const Element: TAtlasImage): Integer; overload;

Returns index of the specified image element in the list. If no image is found, -1 is returned.

Public function Insert(const Image: TAtlasImage): Integer;

Inserts the specified image to the list.

Public procedure Clear;

Removes all existing images from the list.

Public procedure MarkSearchDirty;

Indicates that one of the images had its name changed, so the list needs to be refreshed to make searching by name (IndexOf function and Image property) work properly.

Public procedure Remove(const Index: Integer);

Removes image with the specified index from the list.

Properties

Public property Device: TCustomDevice read FDevice;

The device to which this list is bound to.

Public property Image[constName:StdString]: TAtlasImage read GetImage;

Provides access to individual images in the list by unique image name (not case-sensitive). If no image with such name is found, Nil is returned.

Public property ItemCount: Integer read GetItemCount;

The total number of images in the list.

Public property Items[constIndex:Integer]: TAtlasImage read GetItem;

Provides access to individual images in the list by the corresponding index. If the index is outside of valid range, Nil is returned.


Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.