Struct asefile::Cel

source ·
pub struct Cel<'a> { /* private fields */ }
Expand description

A reference to a single Cel. A cel contains the image data at a specific layer and frame. In the timeline view these are the dots.

You can get a cel by going either via frame then layer or vice versa.

Official docs for cels.

Implementations§

source§

impl<'a> Cel<'a>

source

pub fn image(&self) -> RgbaImage

This cel as an image. Result has the same dimensions as the AsepriteFile. If the cel is empty, all image pixels will be transparent.

source

pub fn is_empty(&self) -> bool

Returns true if the cel contains no data.

source

pub fn frame(&self) -> u32

The frame coordinate of this cel.

source

pub fn layer(&self) -> u32

The layer coordinate of this cel.

source

pub fn user_data(&self) -> Option<&UserData>

Returns the cel’s user data, if any is present.

source

pub fn top_left(&self) -> (i32, i32)

Top-left corner of the non-empty rectangular area of the cel.

In other words, the first component is the smallest x coordinate of a non-empty pixel. And the second is the same for y.

These may be negative or outside of the visible area. This can happen if you drag a layer around.

source

pub fn is_tilemap(&self) -> bool

Does this cel include a tilemap.

Trait Implementations§

source§

impl<'a> Debug for Cel<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Cel<'a>

§

impl<'a> RefUnwindSafe for Cel<'a>

§

impl<'a> Send for Cel<'a>

§

impl<'a> Sync for Cel<'a>

§

impl<'a> Unpin for Cel<'a>

§

impl<'a> UnwindSafe for Cel<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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.