Struct AsepriteFile

Source
pub struct AsepriteFile<'a> {
    pub file: File<'a>,
    pub layers: Vec<Layer>,
    pub frames: Vec<Frame>,
    pub tags: Vec<Tag>,
    pub images: Vec<Image<'a>>,
}
Expand description

This can be used to load an Aseprite file.

Fields§

§file: File<'a>§layers: Vec<Layer>

All layers in the file in order

§frames: Vec<Frame>

All frames in the file in order

§tags: Vec<Tag>

All tags in the file

§images: Vec<Image<'a>>

All images in the file

Implementations§

Source§

impl AsepriteFile<'_>

Source

pub fn load(data: &[u8]) -> Result<AsepriteFile<'_>, LoadSpriteError>

Load a aseprite file from a byte slice

Source

pub fn size(&self) -> (u16, u16)

Get size of the sprite (width, height)

Source

pub fn tags(&self) -> &[Tag]

Get tag names

Source

pub fn layers(&self) -> &[Layer]

Get layer names

Source

pub fn frames(&self) -> &[Frame]

Get the image indices for a given tag and layer

Source

pub fn image_count(&self) -> usize

Get image count

Source

pub fn combined_frame_image( &self, frame_index: usize, target: &mut [u8], ) -> Result<u64, LoadImageError>

Get image loader for a given frame index This will combine all layers into a single image returns a hash describing the image, since cels can be reused in multiple frames

Source

pub fn load_image( &self, index: usize, target: &mut [u8], ) -> Result<(), LoadImageError>

Get image loader for a given image index

Source

pub fn slices(&self) -> &[SliceChunk<'_>]

Trait Implementations§

Source§

impl<'a> Debug for AsepriteFile<'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 AsepriteFile<'a>

§

impl<'a> RefUnwindSafe for AsepriteFile<'a>

§

impl<'a> Send for AsepriteFile<'a>

§

impl<'a> Sync for AsepriteFile<'a>

§

impl<'a> Unpin for AsepriteFile<'a>

§

impl<'a> UnwindSafe for AsepriteFile<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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

Source§

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.