Type Definition imgref::ImgRef [−][src]
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.
Implementations
impl<'a, T> ImgRef<'a, T>
[src]
#[must_use]pub fn sub_image(
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Self
[src]
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Self
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]
pub fn iter(&self) -> Iter<'_, T>
[src]
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: Clone> ImgRef<'a, T>
[src]
#[must_use]pub fn to_contiguous_buf(&self) -> (Cow<'_, [T]>, usize, usize)
[src]
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()
impl<'a, T: Copy> ImgRef<'a, T>
[src]
#[must_use]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;
[src]
Notable traits for PixelsIter<'a, T>
impl<'a, T: Copy + 'a> Iterator for PixelsIter<'a, T> type Item = T;
impl<'a, T> ImgRef<'a, T>
[src]
#[must_use]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;
[src]
Notable traits for PixelsRefIter<'a, T>
impl<'a, T: 'a> Iterator for PixelsRefIter<'a, T> type Item = &'a T;
Trait Implementations
impl<'a, T: Eq> Eq for ImgRef<'a, T>
[src]
impl<'a, T: Hash> Hash for ImgRef<'a, T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, 'b, T, U> PartialEq<Img<&'b [U]>> for ImgRef<'a, T> where
T: PartialEq<U>,
[src]
T: PartialEq<U>,
fn eq(&self, other: &ImgRef<'b, U>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b, T, U> PartialEq<Img<&'b mut [U]>> for ImgRef<'a, T> where
T: PartialEq<U>,
[src]
T: PartialEq<U>,
fn eq(&self, other: &ImgRefMut<'b, U>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, T, U> PartialEq<Img<Vec<U, Global>>> for ImgRef<'a, T> where
T: PartialEq<U>,
[src]
T: PartialEq<U>,