Struct tiny_skia::Pixmap[][src]

pub struct Pixmap { /* fields omitted */ }

A container that owns premultiplied RGBA pixels.

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

Implementations

impl Pixmap[src]

pub fn new(width: u32, height: u32) -> Option<Self>[src]

Allocates a new pixmap.

A pixmap is filled with transparent black by default, aka (0, 0, 0, 0).

Zero size in an error.

Pixmap’s width is limited by i32::MAX/4.

pub fn decode_png(data: &[u8]) -> Result<Self, DecodingError>[src]

Decodes a PNG data into a Pixmap.

Only 8-bit images are supported. Index PNGs are not supported.

pub fn load_png<P: AsRef<Path>>(path: P) -> Result<Self, DecodingError>[src]

Loads a PNG file into a Pixmap.

Only 8-bit images are supported. Index PNGs are not supported.

pub fn encode_png(&self) -> Result<Vec<u8>, EncodingError>[src]

Encodes pixmap into a PNG data.

pub fn save_png<P: AsRef<Path>>(&self, path: P) -> Result<(), EncodingError>[src]

Saves pixmap as a PNG file.

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

Returns a container that references Pixmap’s data.

pub fn as_mut(&mut self) -> PixmapMut<'_>[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(&self) -> &[u8][src]

Returns the internal data.

Byteorder: RGBA

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

Returns the mutable internal data.

Byteorder: RGBA

pub fn pixel(&self, x: u32, y: u32) -> Option<PremultipliedColorU8>[src]

Returns a pixel color.

Returns None when position is out of bounds.

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

Returns a mutable slice of pixels.

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

Returns a slice of pixels.

pub fn take(self) -> Vec<u8>[src]

Consumes the internal data.

Byteorder: RGBA

pub fn clone_rect(&self, rect: IntRect) -> Option<Pixmap>[src]

Returns a copy of the pixmap that intersects the rect.

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

impl Pixmap[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.

See PixmapMut::fill_rect for details.

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.

See PixmapMut::fill_path for details.

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

Strokes a path.

See PixmapMut::stroke_path for details.

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.

See PixmapMut::draw_pixmap for details.

Trait Implementations

impl Clone for Pixmap[src]

impl Debug for Pixmap[src]

impl PartialEq<Pixmap> for Pixmap[src]

impl StructuralPartialEq for Pixmap[src]

Auto Trait Implementations

impl RefUnwindSafe for Pixmap

impl Send for Pixmap

impl Sync for Pixmap

impl Unpin for Pixmap

impl UnwindSafe for Pixmap

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.