Skip to main content

ImgRef

Type Alias ImgRef 

Source
pub type ImgRef<'slice, Pixel> = Img<&'slice [Pixel]>;
Expand description

Image reference type (from imgref).

Zero-copy view into an image buffer. 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.

Aliased Type§

pub struct ImgRef<'slice, Pixel> {
    pub buf: &'slice [Pixel],
    pub stride: usize,
    pub width: u32,
    pub height: u32,
}

Fields§

§buf: &'slice [Pixel]
👎Deprecated: Don’t access struct fields directly. Use buf(), buf_mut() or into_buf()

Storage for the pixels. Usually Vec<Pixel> or &[Pixel]. See ImgVec and ImgRef.

Note that future version will make this field private. Use .rows() and .pixels() iterators where possible, or buf()/buf_mut()/into_buf().

§stride: usize
👎Deprecated: Don’t access struct fields directly. Use stride()

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
👎Deprecated: Don’t access struct fields directly. Use width()

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
👎Deprecated: Don’t access struct fields directly. Use height()

Height of the image in pixels.