Expand description
Parser for the ktx2 texture container format.
§Features
- Async reading
- Parsing
- Validating
- Data format description
- Key/value data
§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§
- Color
Model - Color model from the Khronos Data Format specification.
- Color
Primaries - Color primaries from the Khronos Data Format specification.
- Format
- Vulkan
VkFormatvalues 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.
- KeyValue
Data Iterator - Iterator over KTX2 key/value metadata pairs.
- Level
- A single mip level’s data, returned by
Reader::levels. - Level
Index - Offsets dictating the location of a
Levelwithin a file. - Reader
- Parses and validates a KTX2 texture container from an in-memory buffer.
- Supercompression
Scheme - Supercompression applied to mip level data.
- Transfer
Function - Transfer function (OETF/EOTF) from the Khronos Data Format specification.
Enums§
- Parse
Error - 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.