ImageView

Trait ImageView 

Source
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§

Required Methods§

Source

fn width(&self) -> u32

Source

fn height(&self) -> u32

Source

fn iter_rows(&self, start_row: u32) -> impl Iterator<Item = &[Self::Pixel]>

Returns iterator by slices with image rows.

Provided Methods§

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§