Struct tiny_skia::PixmapMut [−][src]
pub struct PixmapMut<'a> { /* fields omitted */ }
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 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:
- 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 separatePath
, that can be 2-3x larger then the original path. - 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.