Struct libktx_rs::texture::Texture[][src]

pub struct Texture<'a> { /* fields omitted */ }
Expand description

A KTX (1 or 2) texture.

This wraps both a sys::ktxTexture handle, and the TextureSource it was created from.

Implementations

Attempts to create a new texture, consuming the given TextureSource.

Attempts to write the texture (in its native format, either KTX1 or KTX2) to sink.

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

SAFETY: Pointers are harmless. Dereferencing them is not!

Returns the total size of image data, in bytes.

Returns a read-only view on the image data.

Returns a read-write view on the image data.

Returns the pitch (in bytes) of an image row at the specified image level.
This is rounded up to 1 if needed.

Returns the size (in bytes) of an element of the image.

Attempts to return the offset (in bytes) into Self::data for the image at the given mip level, array layer, and slice.
slice is either a cubemap’s face or a 3D texture’s depth slice.

Attempts to return the size (in bytes) of the uncompressed image data.

Attempts to return the size (in bytes) of a certain mip level.

Attempts to [re]load this image’s data to its internal buffer. Also see Self::data().

Creating the image with [enums::TextureCreateFlags::LOAD_IMAGE_DATA] performs this step automatically on load.

Attempts to iterate all mip levels of the image, and all faces of cubemaps. This calls

callback(miplevel: i32, face: i32, width: i32, height: i32, depth: i32, pixel_data: &[u8]) -> Result<(), KtxError>

for each level/face. The image data passed to the callback is immutable. Note that image data should already have been loaded (see Self::load_image_data()).

Attempts to iterate all mip levels of the image, and all faces of cubemaps. This calls

callback(miplevel: i32, face: i32, width: i32, height: i32, depth: i32, pixel_data: &mut [u8]) -> Result<(), KtxError>

for each level/face. The image data passed to the callback is mutable. Note that image data should already have been loaded (see Self::load_image_data()).

If this Texture really is a KTX1, returns KTX1-specific functionalities for it.

If this Texture really is a KTX2, returns KTX2-specific functionalities for it.

Trait Implementations

Executes the destructor for this type. Read more

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.