pub type ImgVec<Pixel> = Img<Vec<Pixel>>;Expand description
Image owning its pixels.
A 2D array of pixels. The pixels are oriented top-left first and rows are stride pixels wide.
If size of the buf is larger than width*height, then any excess space is a padding (see width_padded()/height_padded()).
Aliased Type§
pub struct ImgVec<Pixel> {
    pub buf: Vec<Pixel>,
    pub stride: usize,
    pub width: u32,
    pub height: u32,
}Fields§
§buf: Vec<Pixel>Storage for the pixels. Usually Vec<Pixel> or &[Pixel]. See ImgVec and ImgRef.
Note that future version will make this field private. Use .rows() and .pixels() iterators where possible, or buf()/buf_mut()/into_buf().
stride: usizeNumber of pixels to skip in the container to advance to the next row.
Note: pixels between width and stride may not be usable, and may not even exist in the last row.
width: u32Width of the image in pixels.
Note that this isn’t same as the width of the row in the buf, see stride
height: u32Height of the image in pixels.
Implementations§
Source§impl<T> ImgVec<T>
 
impl<T> ImgVec<T>
Sourcepub fn pixels_mut(&mut self) -> PixelsIterMut<'_, T> ⓘ
 
pub fn pixels_mut(&mut self) -> PixelsIterMut<'_, T> ⓘ
Source§impl<T> ImgVec<T>
 
impl<T> ImgVec<T>
Sourcepub fn sub_image_mut(
    &mut self,
    left: usize,
    top: usize,
    width: usize,
    height: usize,
) -> ImgRefMut<'_, T>
 
pub fn sub_image_mut( &mut self, left: usize, top: usize, width: usize, height: usize, ) -> ImgRefMut<'_, T>
Create a mutable view into a region within the image. See sub_image() for read-only views.
§Panics
If the coordinates are out of bounds
Sourcepub fn sub_image(
    &self,
    left: usize,
    top: usize,
    width: usize,
    height: usize,
) -> ImgRef<'_, T>
 
pub fn sub_image( &self, left: usize, top: usize, width: usize, height: usize, ) -> ImgRef<'_, T>
Make a reference for a part of the image, without copying any pixels.
Sourcepub fn as_ref(&self) -> ImgRef<'_, T>
 
pub fn as_ref(&self) -> ImgRef<'_, T>
Make a reference to this image to pass it to functions without giving up ownership
The reference should be passed by value (ImgRef, not &ImgRef).
If you need a mutable reference, see as_mut() and sub_image_mut()
Sourcepub fn as_mut(&mut self) -> ImgRefMut<'_, T>
 
pub fn as_mut(&mut self) -> ImgRefMut<'_, T>
Make a mutable reference to the entire image
The reference should be passed by value (ImgRefMut, not &mut ImgRefMut).
See also sub_image_mut() and rows_mut()
Sourcepub fn rows(&self) -> RowsIter<'_, T> ⓘ
 
pub fn rows(&self) -> RowsIter<'_, T> ⓘ
Iterate over rows of the image as slices
Each slice is guaranteed to be exactly width pixels wide.
This iterator is a good candidate for parallelization (e.g. rayon’s par_bridge())
Sourcepub fn rows_mut(&mut self) -> RowsIterMut<'_, T> ⓘ
 
pub fn rows_mut(&mut self) -> RowsIterMut<'_, T> ⓘ
Iterate over rows of the image as mutable slices
Each slice is guaranteed to be exactly width pixels wide.
This iterator is a good candidate for parallelization (e.g. rayon’s par_bridge())