Struct asefile::AsepriteFile
source · pub struct AsepriteFile { /* private fields */ }
Expand description
A parsed Aseprite file.
Implementations§
source§impl AsepriteFile
impl AsepriteFile
sourcepub fn read<R: Read>(input: R) -> Result<AsepriteFile>
pub fn read<R: Read>(input: R) -> Result<AsepriteFile>
Load Aseprite file from any input that implements std::io::Read
.
You can use this to read from an in-memory file.
sourcepub fn num_frames(&self) -> u32
pub fn num_frames(&self) -> u32
Number of animation frames.
sourcepub fn num_layers(&self) -> u32
pub fn num_layers(&self) -> u32
Number of layers.
sourcepub fn pixel_format(&self) -> PixelFormat
pub fn pixel_format(&self) -> PixelFormat
The pixel format used by the origal file. This library internally represents all images as RGBA.
sourcepub fn palette(&self) -> Option<&ColorPalette>
pub fn palette(&self) -> Option<&ColorPalette>
The color palette in the image.
For indexed color images, this includes all colors used by individual cels. However, the final image after layer blending may contain colors outside of this palette (or with different transparency levels).
sourcepub fn is_indexed_color(&self) -> bool
pub fn is_indexed_color(&self) -> bool
Does this file use indexed color format.
sourcepub fn transparent_color_index(&self) -> Option<u8>
pub fn transparent_color_index(&self) -> Option<u8>
The color index of the transparent pixel.
sourcepub fn layer_by_name(&self, name: &str) -> Option<Layer<'_>>
pub fn layer_by_name(&self, name: &str) -> Option<Layer<'_>>
Access a layer by name.
If multiple layers with the same name exist returns the layer with the lower ID.
sourcepub fn layers(&self) -> LayersIter<'_> ⓘ
pub fn layers(&self) -> LayersIter<'_> ⓘ
An iterator over all layers.
sourcepub fn external_files(&self) -> &ExternalFilesById
pub fn external_files(&self) -> &ExternalFilesById
A mapping from external file ids to external files.
sourcepub fn external_file_by_id(&self, id: &ExternalFileId) -> Option<&ExternalFile>
pub fn external_file_by_id(&self, id: &ExternalFileId) -> Option<&ExternalFile>
Get a reference to an external file by ID, if the file exists.
Total number of tags.
sourcepub fn tag_by_name(&self, name: &str) -> Option<&Tag>
pub fn tag_by_name(&self, name: &str) -> Option<&Tag>
Lookup tag by name.
If multiple tags with the same name exist, returns the one with the lower ID.
sourcepub fn tilesets(&self) -> &TilesetsById
pub fn tilesets(&self) -> &TilesetsById
Access the file’s Tilesets.
sourcepub fn tilemap(&self, layer_id: u32, frame: u32) -> Option<Tilemap<'_>>
pub fn tilemap(&self, layer_id: u32, frame: u32) -> Option<Tilemap<'_>>
Get the Tilemap at the given cel.
Returns None
if the cel is empty or if it is not a tilemap.
sourcepub fn sprite_user_data(&self) -> Option<&UserData>
pub fn sprite_user_data(&self) -> Option<&UserData>
The user data for the entire sprite, if any exists.