Struct rlottie::Surface

source ·
pub struct Surface { /* private fields */ }
Expand description

A surface has a fixed size and contains pixel data for it. You can render frames onto the surface.

Implementations§

source§

impl Surface

source

pub fn new(size: Size) -> Self

Create a new surface with a fixed size.

source

pub fn size(&self) -> Size

Return the size of the surface.

source

pub fn width(&self) -> usize

Return the width of the surface.

source

pub fn height(&self) -> usize

Return the height of the surface.

source

pub fn data(&self) -> &[Bgra]

Return the pixel data of the surface.

source

pub fn into_data(self) -> Vec<Bgra>

Return the pixel data of the surface. You should prefer [data()] unless you absolutely need owned access to the data.

source

pub fn data_as_bytes(&self) -> &[u8]

Return the raw pixel data of the surface.

source

pub fn pixels(&self) -> impl Iterator<Item = (usize, usize, Bgra)> + '_

Returns an iterator over the pixels of the surface.

Trait Implementations§

source§

impl AsRef<[u8]> for Surface

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.