Struct mss_saliency::Img
[−]
[src]
pub struct Img<Container> { pub buf: Container, pub stride: usize, pub width: u32, pub height: u32, }
Basic struct used for both owned (alias ImgVec
) and borrowed (alias ImgRef
) image fragments.
Fields
buf: Container
Storage for the pixels. Usually Vec<Pixel>
or &[Pixel]
. See ImgVec
and ImgRef
.
stride: usize
Number 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: u32
Width of the image in pixels.
Note that this isn't same as the width of the row in the buf
, see stride
height: u32
Height of the image in pixels.
Methods
impl<'a, T> Img<&'a [T]>
[src]
impl<T> Img<Vec<T>>
[src]
fn sub_image_mut(
&mut self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Img<&mut [T]>
&mut self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Img<&mut [T]>
Create a mutable view into a region within the image. See sub_image()
for read-only views.
fn sub_image(
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Img<&[T]>
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Img<&[T]>
fn as_ref(&self) -> Img<&[T]>
If you need a mutable reference, see sub_image_mut()
impl<T> Img<T>
[src]
fn new_stride(buf: T, width: usize, height: usize, stride: usize) -> Img<T>
fn new(buf: T, width: usize, height: usize) -> Img<T>
impl<OldContainer> Img<OldContainer>
[src]
fn new_buf<NewContainer, OldPixel, NewPixel>(
&self,
new_buf: NewContainer
) -> Img<NewContainer> where
NewContainer: AsRef<[NewPixel]>,
OldContainer: AsRef<[OldPixel]>,
&self,
new_buf: NewContainer
) -> Img<NewContainer> where
NewContainer: AsRef<[NewPixel]>,
OldContainer: AsRef<[OldPixel]>,
Trait Implementations
impl<'a, T> Copy for Img<&'a [T]>
[src]
impl<Pixel, Container> ImgExt<Pixel> for Img<Container> where
Container: AsRef<[Pixel]>,
[src]
Container: AsRef<[Pixel]>,
fn width(&self) -> usize
fn height(&self) -> usize
fn stride(&self) -> usize
fn height_padded(&self) -> usize
impl<Container> Clone for Img<Container> where
Container: Clone,
[src]
Container: Clone,