Skip to main content

Layout

Trait Layout 

Source
pub trait Layout {
    // Required method
    fn byte_len(&self) -> usize;
}
Expand description

A descriptor of the layout of image bytes.

There is no color space and no strict type interpretation here, just some mapping to required bytes for such a fixed buffer and a width and height of the described image. This means that the byte usage for a particular buffer needs to be independent of the content, in particular can not be based on compressibility.

There is one more thing that differentiates an image from an encoded format. It is expected that the image can be unfolded into some matrix of independent pixels (with potentially multiple channels) without any arithmetic or conversion function. Independent here means that, when supplied with the missing color space and type information, there should exist an Fn(U) -> T that can map these pixels independently into some linear color space.

This property holds for any packed, strided or planar RGB/YCbCr/HSV format as well as chroma subsampled YUV images and even raw Bayer filtered images.

Required Methods§

Source

fn byte_len(&self) -> usize

Implementations§

Source§

impl dyn Layout + '_

Source

pub fn fits_buf(&self, bytes: &buf) -> bool

Source

pub fn fits_atomic_buf(&self, bytes: &atomic_buf) -> bool

Source

pub fn fits_cell_buf(&self, bytes: &cell_buf) -> bool

Source

pub fn fits_data(&self, len: &impl ?Sized) -> bool

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'lt, T: Layout + ?Sized> Layout for &'lt T

Source§

fn byte_len(&self) -> usize

Source§

impl<'lt, T: Layout + ?Sized> Layout for &'lt mut T

Source§

fn byte_len(&self) -> usize

Source§

impl<L: Layout + ?Sized> Layout for Box<L>

Source§

fn byte_len(&self) -> usize

Implementors§

Source§

impl Layout for Bytes

Source§

impl Layout for MatrixBytes

Source§

impl Layout for StridedBytes

Source§

impl<P> Layout for Matrix<P>

Source§

impl<P> Layout for Strides<P>

Source§

impl<Pl, const N: usize> Layout for Planes<[Pl; N]>
where Pl: Layout,

Source§

impl<Pl> Layout for Planes<[Pl]>
where Pl: Layout,

Source§

impl<T, const N: usize> Layout for PlaneMatrices<T, N>

Source§

impl<T: Layout> Layout for Relocated<T>

Source§

impl<const N: usize> Layout for PlaneBytes<N>