Skip to main content

Crate atlaspack

Crate atlaspack 

Source
Expand description

Deterministic sprite atlas packer.

Point at a folder of PNGs, get one atlas image and a JSON sheet.

§Example

use atlaspack::{pack_directory, PackConfig};

let packed = pack_directory(
    std::path::Path::new("./sprites"),
    &PackConfig::default(),
)?;
println!("{} frames", packed.json.frames.len());

Structs§

AtlasJson
JSON sidecar written next to the atlas PNG.
AtlasMeta
Metadata about the packed atlas image.
Frame
Where a sprite landed in the atlas.
PackConfig
Packer options.
PackedAtlas
Result of packing: image pixels plus JSON metadata.
Sprite
One input sprite after load.

Enums§

Error
Errors produced while loading or packing sprites.

Functions§

load_sprites
Load all .png files under dir (recursive).
pack_and_write
Pack sprites from input_dir and write the atlas image and JSON sheet.
pack_directory
Load PNGs from input_dir and pack them.
pack_images
Pack sprites already in memory into a single atlas.

Type Aliases§

Result
Crate-level result type.