Struct libktx_rs::texture::Ktx2[][src]

pub struct Ktx2<'a, 'b: 'a> { /* fields omitted */ }
Expand description

KTX2-specific Texture functionality.

Implementations

Returns a pointer to the underlying (C-allocated) sys::ktxTexture2.

SAFETY: Pointers are harmless. Dereferencing them is not!

Returns the Vulkan format of the texture’s data (e.g. VK_R8G8B8A8_UNORM).

Returns the supercompression scheme in use for this texture’s data.

Is this a video texture?

Returns the duration of the video texture (if Self::is_video).

Returns the timescale of the video texture (if Self::is_video).

Returns the loop count of the video texture (if Self::is_video).

Will this KTX2 need transcoding?

Compresses a uncompressed KTX2 texture with Basis Universal.
quality is 1-255; 0 -> the default quality, 128. Lower quality means better (but slower) compression.

Compresses the KTX2 texture’s data with ZStandard compression.
level is 1-22; lower is faster (hence, worse compression).
Values over 20 may consume significant memory.

Compresses the KTX2’s image data with ASTC.
This is a simplified version of Ktx2::compress_astc_ex.

Compresses the KTX2’s image data with ASTC.
This is an extended version of Ktx2::compress_astc.

Returns the number of components of the KTX2 and the size in bytes of each components.

Returns the number of components of the KTX2, also considering compression.

This may differ from values returned by Self::component_info:

  • For uncompressed formats: this is the number of image components, as from Self::component_info.
  • For block-compressed formats: 1 or 2, according to the DFD color model.
  • For Basis Universal-compressed textures: obtained by parsing channel IDs before any encoding and deflation.

See sys::ktxTexture2_GetNumComponents.

Does this KTX2 have premultiplied alpha?

Transcodes this KTX2 to the given format by using ETC1S (from Basis Universal) or UASTC.

  • BasisLZ supercompressed textures are turned back to ETC1S, then transcoded.
  • UASTC-compressed images are inflated (possibly, even deflating any ZStandard supercompression), then transcoded.
  • All internal data of the texture may change, including the DFD!

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.