Struct piet::ImageBuf

source ·
pub struct ImageBuf { /* private fields */ }
Expand description

An in-memory pixel buffer.

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

Implementations§

Create an empty image buffer.

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.

Returns the raw pixel data of this image buffer.

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

Returns the format of the raw pixel data.

The width, in pixels, of this image.

The height, in pixels, of this image.

The size of this image, in pixels.

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.

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

Returns true if the two ImageBufs refer to the same memory location.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.