Trait machine_vision_formats::ImageData

source ·
pub trait ImageData<F> {
    // Required methods
    fn width(&self) -> u32;
    fn height(&self) -> u32;
    fn buffer_ref(&self) -> ImageBufferRef<'_, F>;
    fn buffer(self) -> ImageBuffer<F>;

    // Provided method
    fn image_data(&self) -> &[u8]  { ... }
}
Expand description

An image.

The pixel format is specified as the type F.

Required Methods§

source

fn width(&self) -> u32

Number of pixel columns in the image. Note: this is not the stride.

source

fn height(&self) -> u32

Number of pixel rows in the image.

source

fn buffer_ref(&self) -> ImageBufferRef<'_, F>

Returns the image buffer specified by pixel format F.

Ideally, prefer using this over image_data().

This does not copy the data but returns a view of it.

source

fn buffer(self) -> ImageBuffer<F>

Returns the image buffer specified by pixel format F.

Implementations should move the data without copying it if possible. The implementation may copy the data if needed. To guarantee a move with no copy, use the Into<Vec<u8>> trait required by the OwnedImage trait.

Provided Methods§

source

fn image_data(&self) -> &[u8]

Returns the raw image data as specified by pixel format F.

This does not copy the data but returns a view of it.

This method may be deprecated in factor of buffer_ref.

Implementors§