Trait ImagePixelFormat

Source
pub trait ImagePixelFormat: Copy {
    // Required methods
    fn num_channel_in_memory(self) -> usize;
    fn channel_size_in_bytes(self) -> usize;

    // Provided method
    fn pixel_size_in_bytes(self) -> usize { ... }
}

Required Methods§

Source

fn num_channel_in_memory(self) -> usize

Returns the number of channels that an image of this format would have in memory. For example, while a normal map of format [NormalMapFormat::R8g8TangentSpaceReconstructedZ] would still have 3 channels when sampled, in memory it will have 2 channels.

Source

fn channel_size_in_bytes(self) -> usize

Returns the size of a single value channel, in bytes.

Provided Methods§

Source

fn pixel_size_in_bytes(self) -> usize

Returns the size in bytes of a single pixel. Generally this will be equal to channel_size_in_bytes() * num_channel_in_memory().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§