Skip to main content

Crate ktx2

Crate ktx2 

Source
Expand description

Parser for the ktx2 texture container format.

§Features

§Example

// Crate instance of reader. This validates the header
let mut reader = ktx2::Reader::new(file).expect("Can't create reader"); // Crate instance of reader.

// Get general texture information.
let header = reader.header();

// Read iterator over slices of each mipmap level.
let levels = reader.levels().collect::<Vec<_>>();

§MSRV

The minimum supported Rust version is 1.56. MSRV bumps are treated as breaking changes.

Modules§

dfd
Data Format Descriptor (DFD) for KTX2 textures.

Structs§

ColorModel
Color model from the Khronos Data Format specification.
ColorPrimaries
Color primaries from the Khronos Data Format specification.
Format
Vulkan VkFormat values for the texture’s texel format.
Header
Container-level metadata (dimensions, format, layout) from the 80-byte KTX2 file header.
Index
Byte offsets and lengths (from start of file) for the DFD, KVD, and SGD sections.
KeyValueDataIterator
Iterator over KTX2 key/value metadata pairs.
Level
A single mip level’s data, returned by Reader::levels.
LevelIndex
Offsets dictating the location of a Level within a file.
Reader
Parses and validates a KTX2 texture container from an in-memory buffer.
SupercompressionScheme
Supercompression applied to mip level data.
TransferFunction
Transfer function (OETF/EOTF) from the Khronos Data Format specification.

Enums§

ParseError
Error, that happened when data doesn’t satisfy expected parameters.

Constants§

MAGIC
12-byte file identifier: «KTX 20»\r\n\x1A\n. Must appear at offset 0.