pub type ImageRef<'a, Color> = Image<Color, &'a [Color]>;Expand description
A borrowed image backed by a reference to a slice.
This type consists of a width, a height, and a pixel slice in row-major order.
The length of the pixel slice is guaranteed to match width * height and be less than or
equal to MAX_PIXELS.
See ImageBuf for an owned variant of an image and ImageMut for a mutable, borrowed image.
§Examples
Directly creating an ImageRef from a slice:
let (width, height) = (512, 512);
let pixels = vec![Srgb::new(0, 0, 0); (width * height) as usize];
let image = ImageRef::new(width, height, &pixels).unwrap();Converting a reference to a RgbImage from the image crate to an ImageRef:
let image = RgbImage::new(256, 256);
let image = ImageRef::try_from(&image)?;Aliased Type§
pub struct ImageRef<'a, Color> { /* private fields */ }