pub unsafe trait ImageView:
Sync
+ Send
+ Sized {
type Pixel: InnerPixel;
// Required methods
fn width(&self) -> u32;
fn height(&self) -> u32;
fn iter_rows(&self, start_row: u32) -> impl Iterator<Item = &[Self::Pixel]>;
// Provided methods
fn iter_2_rows(
&self,
start_y: u32,
max_rows: u32,
) -> ArrayChunks<impl Iterator<Item = &[Self::Pixel]>, 2> ⓘ { ... }
fn iter_4_rows(
&self,
start_y: u32,
max_rows: u32,
) -> ArrayChunks<impl Iterator<Item = &[Self::Pixel]>, 4> ⓘ { ... }
fn iter_rows_with_step(
&self,
start_y: f64,
step: f64,
max_rows: u32,
) -> impl Iterator<Item = &[Self::Pixel]> { ... }
fn split_by_height(
&self,
start_row: u32,
height: NonZeroU32,
num_parts: NonZeroU32,
) -> Option<Vec<impl ImageView<Pixel = Self::Pixel>>> { ... }
fn split_by_width(
&self,
start_col: u32,
width: NonZeroU32,
num_parts: NonZeroU32,
) -> Option<Vec<impl ImageView<Pixel = Self::Pixel>>> { ... }
}Expand description
A trait for getting access to image data.
§Safety
The length of the image rows returned by methods of this trait must be equal or greater than the image width.
Required Associated Types§
type Pixel: InnerPixel
Required Methods§
Provided Methods§
Sourcefn iter_2_rows(
&self,
start_y: u32,
max_rows: u32,
) -> ArrayChunks<impl Iterator<Item = &[Self::Pixel]>, 2> ⓘ
fn iter_2_rows( &self, start_y: u32, max_rows: u32, ) -> ArrayChunks<impl Iterator<Item = &[Self::Pixel]>, 2> ⓘ
Returns iterator by arrays with two image rows.
Sourcefn iter_4_rows(
&self,
start_y: u32,
max_rows: u32,
) -> ArrayChunks<impl Iterator<Item = &[Self::Pixel]>, 4> ⓘ
fn iter_4_rows( &self, start_y: u32, max_rows: u32, ) -> ArrayChunks<impl Iterator<Item = &[Self::Pixel]>, 4> ⓘ
Returns iterator by arrays with four image rows.
Sourcefn iter_rows_with_step(
&self,
start_y: f64,
step: f64,
max_rows: u32,
) -> impl Iterator<Item = &[Self::Pixel]>
fn iter_rows_with_step( &self, start_y: f64, step: f64, max_rows: u32, ) -> impl Iterator<Item = &[Self::Pixel]>
Returns iterator by slices with image rows selected from the image with the given step.
Sourcefn split_by_height(
&self,
start_row: u32,
height: NonZeroU32,
num_parts: NonZeroU32,
) -> Option<Vec<impl ImageView<Pixel = Self::Pixel>>>
fn split_by_height( &self, start_row: u32, height: NonZeroU32, num_parts: NonZeroU32, ) -> Option<Vec<impl ImageView<Pixel = Self::Pixel>>>
Takes a part of the image from the given start row with the given height
and divides it by height into num_parts of small images without
mutual intersections.
Sourcefn split_by_width(
&self,
start_col: u32,
width: NonZeroU32,
num_parts: NonZeroU32,
) -> Option<Vec<impl ImageView<Pixel = Self::Pixel>>>
fn split_by_width( &self, start_col: u32, width: NonZeroU32, num_parts: NonZeroU32, ) -> Option<Vec<impl ImageView<Pixel = Self::Pixel>>>
Takes a part of the image from the given start column with the given width
and divides it by width into num_parts of small images without
mutual intersections.
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.