Struct tiny_skia::PixmapMut[][src]

pub struct PixmapMut<'a> { /* fields omitted */ }

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

impl<'a> PixmapMut<'a>[src]

pub fn from_bytes(data: &'a mut [u8], width: u32, height: u32) -> Option<Self>[src]

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

pub fn to_owned(&self) -> Pixmap[src]

Creates a new Pixmap from the current data.

Clones the underlying data.

pub fn as_ref(&self) -> PixmapRef<'_>[src]

Returns a container that references Pixmap’s data.

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

Returns pixmap’s width.

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

Returns pixmap’s height.

pub fn fill(&mut self, color: Color)[src]

Fills the entire pixmap with a specified color.

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

Returns the mutable internal data.

Byteorder: RGBA

pub fn pixels_mut(&mut self) -> &mut [PremultipliedColorU8][src]

Returns a mutable slice of pixels.

impl PixmapMut<'_>[src]

pub fn fill_rect(
    &mut self,
    rect: Rect,
    paint: &Paint<'_>,
    transform: Transform,
    clip_mask: Option<&ClipMask>
) -> Option<()>
[src]

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.

pub fn fill_path(
    &mut self,
    path: &Path,
    paint: &Paint<'_>,
    fill_rule: FillRule,
    transform: Transform,
    clip_mask: Option<&ClipMask>
) -> Option<()>
[src]

Draws a filled path onto the pixmap.

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

pub fn stroke_path(
    &mut self,
    path: &Path,
    paint: &Paint<'_>,
    stroke: &Stroke,
    transform: Transform,
    clip_mask: Option<&ClipMask>
) -> Option<()>
[src]

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 Canvas::fill_path. Which means that we have to allocate a separate Path, that can be 2-3x larger then the original path. Canvas will reuse this allocation during subsequent strokes.
  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.

pub fn draw_pixmap(
    &mut self,
    x: i32,
    y: i32,
    pixmap: PixmapRef<'_>,
    paint: &PixmapPaint,
    transform: Transform,
    clip_mask: Option<&ClipMask>
) -> Option<()>
[src]

Draws a Pixmap on top of the current Pixmap.

We basically filling a rectangle with a pixmap pattern.

Trait Implementations

impl Debug for PixmapMut<'_>[src]

impl<'a> PartialEq<PixmapMut<'a>> for PixmapMut<'a>[src]

impl<'a> StructuralPartialEq for PixmapMut<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for PixmapMut<'a>

impl<'a> Send for PixmapMut<'a>

impl<'a> Sync for PixmapMut<'a>

impl<'a> Unpin for PixmapMut<'a>

impl<'a> !UnwindSafe for PixmapMut<'a>

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