Trait ddsfile::DataFormat

source ·
pub trait DataFormat {
    // Required methods
    fn get_pitch(&self, width: u32) -> Option<u32>;
    fn get_bits_per_pixel(&self) -> Option<u8>;
    fn get_block_size(&self) -> Option<u32>;
    fn get_fourcc(&self) -> Option<FourCC>;
    fn requires_extension(&self) -> bool;

    // Provided methods
    fn get_pitch_height(&self) -> u32 { ... }
    fn get_minimum_mipmap_size_in_bytes(&self) -> Option<u32> { ... }
}

Required Methods§

source

fn get_pitch(&self, width: u32) -> Option<u32>

This gets the number of bytes required to store one row of data

source

fn get_bits_per_pixel(&self) -> Option<u8>

This gets the number of bits required to store a single pixel. It is only defined for uncompressed formats

source

fn get_block_size(&self) -> Option<u32>

This gets a block compression format’s block size, and is only defined for compressed formats

source

fn get_fourcc(&self) -> Option<FourCC>

Get the fourcc code for this format, if known

source

fn requires_extension(&self) -> bool

Returns true if the DX10 extention is required to use this format.

Provided Methods§

source

fn get_pitch_height(&self) -> u32

This gets the height of each row of data. Normally it is 1, but for block compressed textures, each row is 4 pixels high.

source

fn get_minimum_mipmap_size_in_bytes(&self) -> Option<u32>

This gets the minimum mipmap size in bytes. Even if they go all the way down to 1x1, there is a minimum number of bytes based on bits per pixel or blocksize.

Implementors§