pub struct Ktx<D> { /* private fields */ }Expand description
KTX texture storage format data stored in a complete slice.
Provides KtxInfo.
See the specification.
§Example
let image: Ktx<_> = include_ktx!("../tests/babg-bc3.ktx");
let texture_levels: Vec<&[u8]> = image.textures().collect();Implementations§
Trait Implementations§
impl<D: Copy> Copy for Ktx<D>
Auto Trait Implementations§
impl<D> Freeze for Ktx<D>where
D: Freeze,
impl<D> RefUnwindSafe for Ktx<D>where
D: RefUnwindSafe,
impl<D> Send for Ktx<D>where
D: Send,
impl<D> Sync for Ktx<D>where
D: Sync,
impl<D> Unpin for Ktx<D>where
D: Unpin,
impl<D> UnsafeUnpin for Ktx<D>where
D: UnsafeUnpin,
impl<D> UnwindSafe for Ktx<D>where
D: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> KtxInfo for T
impl<T> KtxInfo for T
Source§fn big_endian(&self) -> bool
fn big_endian(&self) -> bool
endianness contains the number 0x04030201 written as a 32 bit integer. If the file is little
endian then this is represented as the bytes 0x01 0x02 0x03 0x04. If the file is big endian
then this is represented as the bytes 0x04 0x03 0x02 0x01. When reading endianness as a 32
bit integer produces the value 0x04030201 then the endianness of the file matches the the
endianness of the program that is reading the file and no conversion is necessary. When
reading endianness as a 32 bit integer produces the value 0x01020304 then the endianness of
the file is opposite the endianness of the program that is reading the file, and in that
case the program reading the file must endian convert all header bytes and, if glTypeSize >
1, all texture data to the endianness of the program (i.e. a little endian program must
convert from big endian, and a big endian program must convert to little endian).
Source§fn gl_type(&self) -> u32
fn gl_type(&self) -> u32
For compressed textures, glType must equal 0. For uncompressed textures, glType specifies the
type parameter passed to glTex{,Sub}Image*D, usually one of the values from table 8.2 of the
OpenGL 4.4 specification OPENGL44 (UNSIGNED_BYTE, UNSIGNED_SHORT_5_6_5, etc.)
Source§fn gl_type_size(&self) -> u32
fn gl_type_size(&self) -> u32
glTypeSize specifies the data type size that should be used when endianness conversion is
required for the texture data stored in the file. If glType is not 0, this should be the
size in bytes corresponding to glType. For texture data which does not depend on platform
endianness, including compressed texture data, glTypeSize must equal 1.
Source§fn gl_format(&self) -> u32
fn gl_format(&self) -> u32
For compressed textures, glFormat must equal 0. For uncompressed textures, glFormat specifies
the format parameter passed to glTex{,Sub}Image*D, usually one of the values from table 8.3
of the OpenGL 4.4 specification OPENGL44 (RGB, RGBA, BGRA, etc.)
Source§fn gl_internal_format(&self) -> u32
fn gl_internal_format(&self) -> u32
For compressed textures, glInternalFormat must equal the compressed internal format, usually
one of the values from table 8.14 of the OpenGL 4.4 specification OPENGL44. For
uncompressed textures, glInternalFormat specifies the internalformat parameter passed to
glTexStorageD or glTexImageD, usually one of the sized internal formats from tables 8.12 &
8.13 of the OpenGL 4.4 specification OPENGL44. The sized format should be chosen to match
the bit depth of the data provided. glInternalFormat is used when loading both compressed
and uncompressed textures, except when loading into a context that does not support sized
formats, such as an unextended OpenGL ES 2.0 context where the internalformat parameter is
required to have the same value as the format parameter.
Source§fn gl_base_internal_format(&self) -> u32
fn gl_base_internal_format(&self) -> u32
For both compressed and uncompressed textures, glBaseInternalFormat specifies the base
internal format of the texture, usually one of the values from table 8.11 of the OpenGL 4.4
specification OPENGL44 (RGB, RGBA, ALPHA, etc.). For uncompressed textures, this value
will be the same as glFormat and is used as the internalformat parameter when loading into a
context that does not support sized formats, such as an unextended OpenGL ES 2.0 context.
Source§fn pixel_width(&self) -> u32
fn pixel_width(&self) -> u32
The width of the texture image for level 0, in pixels. No rounding to block sizes should be
applied for block compressed textures.
Source§fn pixel_height(&self) -> u32
fn pixel_height(&self) -> u32
The height of the texture image for level 0, in pixels. No rounding to block sizes should be
applied for block compressed textures. Read more
Source§fn pixel_depth(&self) -> u32
fn pixel_depth(&self) -> u32
The depth of the texture image for level 0, in pixels. No rounding to block sizes should be
applied for block compressed textures. Read more
Source§fn array_elements(&self) -> u32
fn array_elements(&self) -> u32
numberOfArrayElements specifies the number of array elements. If the texture is not an array
texture, numberOfArrayElements must equal 0.
Source§fn faces(&self) -> u32
fn faces(&self) -> u32
numberOfFaces specifies the number of cubemap faces. For cubemaps and cubemap arrays this
should be 6. For non cubemaps this should be 1. Cube map faces are stored in the order: +X,
-X, +Y, -Y, +Z, -Z. Read more
Source§fn mipmap_levels(&self) -> u32
fn mipmap_levels(&self) -> u32
numberOfMipmapLevels must equal 1 for non-mipmapped textures. For mipmapped textures, it
equals the number of mipmaps. Mipmaps are stored in order from largest size to smallest
size. The first mipmap level is always level 0. A KTX file does not need to contain a
complete mipmap pyramid. If numberOfMipmapLevels equals 0, it indicates that a full mipmap
pyramid should be generated from level 0 at load time (this is usually not allowed for
compressed formats).
Source§fn bytes_of_key_value_data(&self) -> u32
fn bytes_of_key_value_data(&self) -> u32
keyAndValueByteSize is the number of bytes of combined key and value data in one key/value
pair following the header. This includes the size of the key, the NUL byte terminating the
key, and all the bytes of data in the value. If the value is a UTF-8 string it should be NUL
terminated and the keyAndValueByteSize should include the NUL character (but code that reads
KTX files must not assume that value fields are NUL terminated). keyAndValueByteSize does
not include the bytes in valuePadding.