Struct imgref::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]
fn sub_image(
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Self
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Self
fn iter(&self) -> Iter<T>
impl<T> Img<T>
[src]
fn new_stride(buf: T, width: usize, height: usize, stride: usize) -> Self
fn new(buf: T, width: usize, height: usize) -> Self
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<Container: Clone> Clone for Img<Container>
[src]
fn clone(&self) -> Img<Container>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<Pixel, Container> ImgExt<Pixel> for Img<Container> where
Container: AsRef<[Pixel]>,
[src]
Container: AsRef<[Pixel]>,
fn width(&self) -> usize
Width of the image in pixels. Read more
fn height(&self) -> usize
Height of the image in pixels.
fn stride(&self) -> usize
Number of pixels to skip in the container to advance to the next row. Note the last row may have fewer pixels than the stride. Read more
fn height_padded(&self) -> usize
Height in number of full strides. If the underlying buffer is not an even multiple of strides, the last row is ignored. Read more
fn width_padded(&self) -> usize
Maximum possible width of the data, including the stride. Read more
impl<'a, T> Copy for Img<&'a [T]>
[src]
impl<Container> IntoIterator for Img<Container> where
Container: IntoIterator,
[src]
Container: IntoIterator,