Class TGPUCompressedImage
Unit
Declaration
type TGPUCompressedImage = class(TEncodedImage)
Description
Image compressed using one of the GPU texture compression algorithms.
Source: images/castleimages_class_gpu_compressed.inc (line 19).
Hierarchy
- TObject
- TEncodedImage
- TGPUCompressedImage
Overview
Fields
| Protected | FRawPixels: Pointer; |
Methods
| Public | destructor Destroy; override; |
| Public | function Dimensions: TVector3Cardinal; |
| Public | function IsEmpty: boolean; |
| Public | function Rect: TRectangle; |
| Public | function ToFpImage: TInternalCastleFpImage; virtual; deprecated 'interoperability with FpImage may be dropped in the future'; |
| Public | constructor Create(const AWidth, AHeight, ADepth: Cardinal; const ACompression: TTextureCompression); |
| Public | function Size: Cardinal; override; |
| Public | function HasAlpha: boolean; override; |
| Public | function AlphaChannel( const AlphaTolerance: Byte): TAlphaChannel; override; |
| Public | procedure FlipVertical; override; |
| Public | function Decompress: TCastleImage; |
| Public | function MakeCopy: TGPUCompressedImage; |
| Public | function CreateCopy: TEncodedImage; override; |
Properties
| Public | property Url: String read FUrl write FUrl; |
| Public | property Width: Cardinal read FWidth; |
| Public | property Height: Cardinal read FHeight; |
| Public | property Depth: Cardinal read FDepth; |
| Public | property RawPixels: Pointer read FRawPixels; |
| Public | property Compression: TTextureCompression read FCompression; |
Description
Fields
| Protected | FRawPixels: Pointer; |
|
This item is declared in ancestor TEncodedImage. Operate on this by Get/Realloc/FreeMem. It's always freed and nil'ed in destructor. | |
Methods
| Public | destructor Destroy; override; |
|
This item is declared in ancestor TEncodedImage. This item has no description. | |
| Public | function Dimensions: TVector3Cardinal; |
|
This item is declared in ancestor TEncodedImage. | |
| Public | function IsEmpty: boolean; |
|
This item is declared in ancestor TEncodedImage. Is an image empty.
| |
| Public | function Rect: TRectangle; |
|
This item is declared in ancestor TEncodedImage. Rectangle representing the inside of this image. Always (Left,Bottom) are zero, and (Width,Height) correspond to image sizes. | |
| Public | function ToFpImage: TInternalCastleFpImage; virtual; deprecated 'interoperability with FpImage may be dropped in the future'; |
|
This item is declared in ancestor TEncodedImage. Warning: this symbol is deprecated: interoperability with FpImage may be dropped in the future Convert image contents to FpImage instance. The resulting instance is owned by the caller. | |
| Public | constructor Create(const AWidth, AHeight, ADepth: Cardinal; const ACompression: TTextureCompression); |
|
This item has no description. Source: images/castleimages_class_gpu_compressed.inc (line 24). | |
| Public | function Size: Cardinal; override; |
|
Size of the whole image data inside RawPixels, in bytes. Source: images/castleimages_class_gpu_compressed.inc (line 30). | |
| Public | function HasAlpha: boolean; override; |
|
This item has no description. Showing description inherited from TEncodedImage.HasAlpha. Does an image have an alpha channel. You may also be interested in the AlphaChannel that can make a distinction between alpha channel for blending and for alpha test. AlphaChannel answers always atNone if Descendants implementors notes: in this class, TCastleImage, this returns Source: images/castleimages_class_gpu_compressed.inc (line 32). | |
| Public | function AlphaChannel( const AlphaTolerance: Byte): TAlphaChannel; override; |
|
This item has no description. Showing description inherited from TEncodedImage.AlphaChannel. Analyze image contents to determine if, and what kind, of alpha channel it has. This may be a time-consuming operation. When the image has alpha channel and we need to decide whether it's suitable for "alpha test" (only fully opaque or fully transparent pixels) or "alpha blending" (any alpha value makes sense) then this method needs to iterate over image pixels. For this reason, the result of this operation is cached at various levels, e.g. TImageTextureNode and TDrawableImage cache it internally. We determine "alpha test - simple yes/no alpha channel" if all the alpha values (for every pixel) are 0, or 255, or (when AlphaTolerance <> 0) are close to them by AlphaTolerance. So, to be precise, alpha value must be <= AlphaTolerance, or >= 255 - AlphaTolerance. If any alpha value is between [AlphaTolerance + 1, 255 - AlphaTolerance - 1] then we return "alpha blending - full range alpha channel". Note that big values of AlphaTolerance make it easier to quality image as "alpha test - simple yes/no alpha channel". When AlphaTolerance >= 128, all images are treated as "simple yes/no alpha". Usually, you want to keep AlphaTolerance small. Descendants implementors notes: in this class, this simply always returns atNone. For descendants that have alpha channel, implement it, honouring AlphaTolerance as described. Source: images/castleimages_class_gpu_compressed.inc (line 33). | |
| Public | procedure FlipVertical; override; |
|
Flip compressed image vertically, losslessly. This works only for S3TC images, and only when their height is 1, 2, 3 or a multiple of 4. Note that this is always satisfied if image height is a power of two (as common for textures). It uses the knowledge of how S3TC compression works to losslessly flip the image, without re-compressing it. The idea is described here [http://users.telenet.be/tfautre/softdev/ddsload/explanation.htm]. Source: images/castleimages_class_gpu_compressed.inc (line 45). | |
| Public | function Decompress: TCastleImage; |
|
Decompress the image. This uses DecompressTexture routine. By default, it is assigned only when OpenGL(ES) context is available and can decompress textures with the help of OpenGL(ES). Exceptions raised
Source: images/castleimages_class_gpu_compressed.inc (line 56). | |
| Public | function MakeCopy: TGPUCompressedImage; |
|
Create a new image object that has exactly the same class and the same data (size, pixels) as this image. Source: images/castleimages_class_gpu_compressed.inc (line 60). | |
| Public | function CreateCopy: TEncodedImage; override; |
|
Create a new image object that has exactly the same class and the same data (size, pixels) as this image. Equivalent to MakeCopy, but virtual and declared as returning TEncodedImage class. Source: images/castleimages_class_gpu_compressed.inc (line 66). | |
Properties
| Public | property Url: String read FUrl write FUrl; |
|
This item is declared in ancestor TEncodedImage. Url from which this image was loaded, if any. | |
| Public | property Width: Cardinal read FWidth; |
|
This item is declared in ancestor TEncodedImage. This item has no description. | |
| Public | property Height: Cardinal read FHeight; |
|
This item is declared in ancestor TEncodedImage. This item has no description. | |
| Public | property Depth: Cardinal read FDepth; |
|
This item is declared in ancestor TEncodedImage. Depth of the image. For 2D images (most common) this is just 1. All images in CastleImages can be potentially 3D, which means they can have Depth > 1. A 3D image is just a 3-dimensional array of pixels, and you can use it e.g. as a texture with 3D texture coordinates. A sample use-cases for 3D textures are:
| |
| Public | property RawPixels: Pointer read FRawPixels; |
|
This item is declared in ancestor TEncodedImage. Image data. The layout of this memory is defined by descendants. For example, for TCastleImage it's a simple array of pixels (see TCastleImage docs for exact description of the memory layout), for TGPUCompressedImage it's a compressed data for GPU. Note that this may be | |
| Public | property Compression: TTextureCompression read FCompression; |
|
This item has no description. Source: images/castleimages_class_gpu_compressed.inc (line 27). | |
Generated by PasDoc 0.17.0.snapshot.