[][src]Struct piet::ImageBuf

pub struct ImageBuf { /* fields omitted */ }

An in-memory pixel buffer.

Contains raw bytes, dimensions, and image format (piet::ImageFormat).

Implementations

impl ImageBuf[src]

pub fn empty() -> Self[src]

Create an empty image buffer.

pub fn from_raw(
    pixels: impl Into<Arc<[u8]>>,
    format: ImageFormat,
    width: usize,
    height: usize
) -> ImageBuf
[src]

Creates a new image buffer from an array of bytes.

format specifies the pixel format of the pixel data, which must have length width * height * format.bytes_per_pixel().

Panics

Panics if the pixel data has the wrong length.

pub fn raw_pixels(&self) -> &[u8][src]

Returns the raw pixel data of this image buffer.

pub fn raw_pixels_shared(&self) -> Arc<[u8]>[src]

Returns a shared reference to the raw pixel data of this image buffer.

pub fn format(&self) -> ImageFormat[src]

Returns the format of the raw pixel data.

pub fn width(&self) -> usize[src]

The width, in pixels, of this image.

pub fn height(&self) -> usize[src]

The height, in pixels, of this image.

pub fn size(&self) -> Size[src]

The size of this image, in pixels.

pub fn pixel_colors<'a>(
    &'a self
) -> impl Iterator<Item = impl Iterator<Item = Color> + 'a> + 'a
[src]

Returns an iterator over the pixels in this image.

The return value is an iterator over "rows", where each "row" is an iterator over the color of the pixels in that row.

pub fn to_image<Ctx: RenderContext>(&self, ctx: &mut Ctx) -> Ctx::Image[src]

Converts this buffer an image that is optimized for drawing into a RenderContext.

Trait Implementations

impl Clone for ImageBuf[src]

impl Debug for ImageBuf[src]

impl Default for ImageBuf[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.