[][src]Type Definition imgref::ImgRef

type ImgRef<'a, Pixel> = Img<&'a [Pixel]>;

Reference to pixels inside another image. Pass this structure by value (i.e. ImgRef, not &ImgRef).

Only width of pixels of every stride can be modified. The buf may be longer than height*stride, but the extra space should be ignored.

Methods

impl<'a, T> ImgRef<'a, T>[src]

#[must_use]pub fn sub_image(
    &self,
    left: usize,
    top: usize,
    width: usize,
    height: usize
) -> Self
[src]

Make a reference for a part of the image, without copying any pixels.

Panics

It will panic if sub_image is outside of the image area (left + width must be <= container width, etc.)

#[must_use]pub fn rows(&self) -> RowsIter<T>[src]

Iterate over whole rows of pixels as slices

Panics

If stride is 0

See also pixels()

pub fn iter(&self) -> Iter<T>[src]

Deprecated:

Size of this buffer is unpredictable. Use .rows() instead

Deprecated

Note: it iterates all pixels in the underlying buffer, not just limited by width/height.

impl<'a, T: Copy> ImgRef<'a, T>[src]

#[must_use]pub fn pixels(&self) -> PixelsIter<T>[src]

Panics

if width is 0