pub struct PixmapRef<'a> { /* private fields */ }
Expand description

A container that references premultiplied RGBA pixels.

Can be created from Pixmap or from a user provided data.

The data is not aligned, therefore width == stride.

Implementations

Creates a new PixmapRef from bytes.

The size must be at least size.width() * size.height() * BYTES_PER_PIXEL. Zero size in an error. Width is limited by i32::MAX/4.

The data is assumed to have premultiplied RGBA pixels (byteorder: RGBA).

Creates a new Pixmap from the current data.

Clones the underlying data.

Returns pixmap’s width.

Returns pixmap’s height.

Returns the internal data.

Byteorder: RGBA

Returns a pixel color.

Returns None when position is out of bounds.

Returns a slice of pixels.

Returns a copy of the pixmap that intersects the rect.

Returns None when Pixmap’s rect doesn’t contain rect.

Encodes pixmap into a PNG data.

Saves pixmap as a PNG file.

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.