Skip to main content

DataFormat

Trait 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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§