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§
sourcefn buffer_ref(&self) -> ImageBufferRef<'_, F>
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.
sourcefn buffer(self) -> ImageBuffer<F>
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§
sourcefn image_data(&self) -> &[u8] ⓘ
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
.