Class TCustomBaseTexture

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCustomBaseTexture = class abstract(TObject)

Description

Base definition of hardware-assisted texture. Each texture is typically bound to one specific device, which contains any hardware-specific context information.

Hierarchy

  • TObject
  • TCustomBaseTexture

Overview

Fields

Protected FHeight: Integer;
Protected FMipMapping: Boolean;
Protected FPixelFormat: TPixelFormat;
Protected FPremultipliedAlpha: Boolean;
Protected FState: TTextureState;
Protected FWidth: Integer;

Methods

Public constructor Create(const ADevice: TCustomDevice; const AutoSubscribe: Boolean); virtual;
Public function Bind(const Channel: Integer): Boolean; virtual;
Public function Clear: Boolean; virtual;
Public function CopyFrom(const Source: TCustomBaseTexture): Boolean; inline;
Public function CopyRect(DestPos: TPoint2i; const Source: TCustomBaseTexture; SourceRect: TIntRect): Boolean;
Public function DeviceRestore: Boolean; virtual;
Public function Initialize: Boolean;
Protected function DoCopyRect(const Source: TCustomBaseTexture; const SourceRect: TIntRect; const DestPos: TPoint2i): Boolean; virtual;
Protected function DoInitialize: Boolean; virtual;
Public procedure DeviceRelease; virtual;
Public procedure Finalize;
Protected procedure DoFinalize; virtual;

Properties

Public property Device: TCustomDevice read FDevice;
Public property Height: Integer read FHeight write SetHeight;
Public property MipMapping: Boolean read FMipMapping write SetMipMapping;
Public property PixelFormat: TPixelFormat read FPixelFormat write SetPixelFormat;
Public property PremultipliedAlpha: Boolean read FPremultipliedAlpha write SetPremultipliedAlpha;
Public property Size: TPoint2i read GetSize write SetSize;
Public property State: TTextureState read FState;
Public property Width: Integer read FWidth write SetWidth;

Description

Fields

Protected FHeight: Integer;

Current texture height.

Protected FMipMapping: Boolean;

Whether the current texture uses mipmapping or not.

Protected FPixelFormat: TPixelFormat;

Current format that texture pixels are represented in.

Protected FPremultipliedAlpha: Boolean;

Whether the current texture has RGB elements premultiplied by alpha-channel or not.

Protected FState: TTextureState;

Current state the texture is in.

Protected FWidth: Integer;

Current texture width.

Methods

Public constructor Create(const ADevice: TCustomDevice; const AutoSubscribe: Boolean); virtual;

Creates new instance of texture bound to the specific device.

Public function Bind(const Channel: Integer): Boolean; virtual;

Binds this texture to the specified hardware channel. The actual meaning and functionality of this method varies on different types of hardware and platforms.

Public function Clear: Boolean; virtual;

Clears the entire texture and fills pixels with zeros.

Public function CopyFrom(const Source: TCustomBaseTexture): Boolean; inline;

Copies the entire source texture area to this one. If the sizes of both textures do not match, then intersection of both will be copied. This function handles the clipping and possibly pixel format conversion. True is returned when the operation succeeds and False otherwise.

Public function CopyRect(DestPos: TPoint2i; const Source: TCustomBaseTexture; SourceRect: TIntRect): Boolean;

Copies a portion of source texture area to this one. This function handles the clipping and possibly pixel format conversion. True is returned when the operation succeeds and False otherwise.

Public function DeviceRestore: Boolean; virtual;

Restores the texture after its surface has been lost (that is, after DeviceRelease call). This should be implemented by derived classes to handle "device lost" scenario.

Public function Initialize: Boolean;

Initializes the texture with its currently set parameters and prepares for usage in rendering.

Protected function DoCopyRect(const Source: TCustomBaseTexture; const SourceRect: TIntRect; const DestPos: TPoint2i): Boolean; virtual;

This method is called by CopyRect and should provide copy mechanism between this and other textures available on given provider.

Protected function DoInitialize: Boolean; virtual;

This method is called by Initialize and should be implemented by derived classes to create necessary hardware elements, and initialize the texture.

Public procedure DeviceRelease; virtual;

Releases the texture's surface when the device has been lost. This should be implemented by derived classes to handle "device lost" scenario.

Public procedure Finalize;

Finalizes the texture and releases its resources that were used for rendering.

Protected procedure DoFinalize; virtual;

This method is called by Finalize and should be implemented by derived classes to release any remaining hardware elements, and finalize the texture.

Properties

Public property Device: TCustomDevice read FDevice;

Reference to the device class to which this texture is bound to.

Public property Height: Integer read FHeight write SetHeight;

Determines the texture height in pixels. This can be written to only before the texture is initialized, but can be read at any time.

Public property MipMapping: Boolean read FMipMapping write SetMipMapping;

Determines whether the texture uses mipmapping or not. Mipmapping can improve visual quality when the texture is drawn in different sizes, especially in smaller ones. This can be written to only before the texture is initialized, but can be read at any time.

Public property PixelFormat: TPixelFormat read FPixelFormat write SetPixelFormat;

Determines the pixel format in which to store texture's pixels. This can be written to only before the texture is initialized, but can be read at any time.

Public property PremultipliedAlpha: Boolean read FPremultipliedAlpha write SetPremultipliedAlpha;

Determines whether the texture has RGB components premultiplied by alpha-channel or not. Premultiplied alpha implies permanent loss of information as the components are multiplied by alpha value and stored (so, for example, pixels with alpha value of zero permanently lose all color information), however this can improve visual quality on mipmaps with translucent pixels. This parameter is merely a hint for rendering system, it does not change the actual pixels - this is something that should be done as a separate step. This parameter can only be changed before the texture is initialized, but can be read at any time.

Public property Size: TPoint2i read GetSize write SetSize;

Determines the texture size in pixels. This can be written to only before the texture is initialized, but can be read at any time.

Public property State: TTextureState read FState;

Indicates the state in which the texture currently is.

Public property Width: Integer read FWidth write SetWidth;

Determines the texture width in pixels. This can be written to only before the texture is initialized, but can be read at any time.


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