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

A container that references mutable 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 PixmapMut 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 a container that references Pixmap’s data.

Returns pixmap’s width.

Returns pixmap’s height.

Fills the entire pixmap with a specified color.

Returns the mutable internal data.

Byteorder: RGBA

Returns a mutable slice of pixels.

Draws a filled rectangle onto the pixmap.

This function is usually slower than filling a rectangular path, but it produces better results. Mainly it doesn’t suffer from weird clipping of horizontal/vertical edges.

Used mainly to render a pixmap onto a pixmap.

Returns None when there is nothing to fill or in case of a numeric overflow.

Draws a filled path onto the pixmap.

Returns None when there is nothing to fill or in case of a numeric overflow.

Strokes a path.

Stroking is implemented using two separate algorithms:

  1. If a stroke width is wider than 1px (after applying the transformation), a path will be converted into a stroked path and then filled using fill_path. Which means that we have to allocate a separate Path, that can be 2-3x larger then the original path.
  2. If a stroke width is thinner than 1px (after applying the transformation), we will use hairline stroking, which doesn’t involve a separate path allocation.

Also, if a stroke has a dash array, then path will be converted into a dashed path first and then stroked. Which means a yet another allocation.

Draws a Pixmap on top of the current Pixmap.

We basically filling a rectangle with a pixmap pattern.

Trait Implementations

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 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.