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.
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.
Returns the Opto-Electrical Transfer Function (OETF) for this KTX2, in KHR_DF format.
See https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.inline.html#_emphasis_role_strong_emphasis_transferfunction_emphasis_emphasis.
Does this KTX2 have premultiplied alpha?
pub fn transcode_basis(
&mut self,
format: TranscodeFormat,
flags: TranscodeFlags
) -> Result<(), KtxError>
pub fn transcode_basis(
&mut self,
format: TranscodeFormat,
flags: TranscodeFlags
) -> Result<(), KtxError>
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!