Struct asefile::Tileset

source ·
pub struct Tileset<P = Pixels> { /* private fields */ }
Expand description

A set of tiles of the same size.

In the GUI, this is the collection of tiles that you build up in the side bar. Each tile has the same size and is identified by an Id.

See official docs for tilemaps and tilesets for details.

Implementations§

source§

impl<P> Tileset<P>

source

pub fn id(&self) -> u32

Tileset id.

source

pub fn empty_tile_is_id_zero(&self) -> bool

From the Aseprite file spec: When true, tilemaps using this tileset use tile ID=0 as empty tile. In rare cases this is false, the empty tile will be equal to 0xffffffff (used in internal versions of Aseprite).

source

pub fn tile_count(&self) -> u32

Number of tiles.

source

pub fn tile_size(&self) -> TileSize

Tile width and height.

source

pub fn base_index(&self) -> i16

Number to show in the UI for the tile with index=0. Default is 1. Only used for Aseprite UI purposes. Not used for data representation.

source

pub fn name(&self) -> &str

Tileset name. May not be unique among tilesets.

source

pub fn external_file(&self) -> Option<&ExternalTilesetReference>

When non-empty, describes a link to an external file.

source§

impl Tileset<Pixels>

source

pub fn tile_image(&self, tile_index: u32) -> RgbaImage

Get the image for the given tile.

source

pub fn image(&self) -> RgbaImage

Collect all tiles into one long vertical image.

The image has width equal to the tile width and height equal to tile_size().width() * tile_count().

Trait Implementations§

source§

impl<P: Debug> Debug for Tileset<P>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P> Freeze for Tileset<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Tileset<P>
where P: RefUnwindSafe,

§

impl<P> Send for Tileset<P>
where P: Send,

§

impl<P> Sync for Tileset<P>
where P: Sync,

§

impl<P> Unpin for Tileset<P>
where P: Unpin,

§

impl<P> UnwindSafe for Tileset<P>
where P: UnwindSafe,

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.