Type Definition imgref::ImgRef [−][src]
type ImgRef<'a, Pixel> = Img<&'a [Pixel]>;
Expand description
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.
Implementations
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.)
Returns a reference to the buffer, width, height. Guarantees that the buffer is contiguous,
i.e. it’s width*height
elements long, and [x + y*width]
addresses each pixel.
It will create a copy if the buffer isn’t contiguous (width != stride).
For a more efficient version, see into_contiguous_buf()
pub fn pixels(&self) -> PixelsIter<'_, T>ⓘNotable traits for PixelsIter<'a, T>
impl<'a, T: Copy + 'a> Iterator for PixelsIter<'a, T> type Item = T;
pub fn pixels(&self) -> PixelsIter<'_, T>ⓘNotable traits for PixelsIter<'a, T>
impl<'a, T: Copy + 'a> Iterator for PixelsIter<'a, T> type Item = T;
pub fn pixels_ref(&self) -> PixelsRefIter<'_, T>ⓘNotable traits for PixelsRefIter<'a, T>
impl<'a, T: 'a> Iterator for PixelsRefIter<'a, T> type Item = &'a T;
pub fn pixels_ref(&self) -> PixelsRefIter<'_, T>ⓘNotable traits for PixelsRefIter<'a, T>
impl<'a, T: 'a> Iterator for PixelsRefIter<'a, T> type Item = &'a T;