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