6 releases (3 breaking)

0.4.1 Apr 7, 2024
0.4.0 Mar 17, 2024
0.3.0 Nov 3, 2023
0.2.0 Oct 12, 2023
0.1.1 Oct 8, 2023

#499 in Game dev

Download history 4/week @ 2024-02-21 5/week @ 2024-02-28 1/week @ 2024-03-06 168/week @ 2024-03-13 17/week @ 2024-03-20 7/week @ 2024-03-27 115/week @ 2024-04-03 12/week @ 2024-04-10

154 downloads per month

MIT license

26KB
526 lines

image-atlas

crates.io doc.rs

This library provides a general-purpose texture atlas generator with a focus on ease of use and simplicity.

There are multiple generation methods and mip map options.

  • No padding between elements
  • With padding between elements
  • With smart padding between elements for mip map generation.

This library uses image crate for image processing and rectangle-pack crate for computing element layout.

Examples

use image_atlas::*;

let atlas = create_atlas(&AtlasDescriptor {
    max_page_count: 8,
    size: 2048,
    mip: AtlasMipOption::MipWithBlock(AtlasMipFilter::Lanczos3, 32),
    entries: &[AtlasEntry {
        texture: image::RgbImage::new(512, 512),
        mip: AtlasEntryMipOption::Clamp,
    }],
})
.unwrap();

let texcoord = &atlas.texcoords[0];
let texture = &atlas.textures[texcoord.page as usize].mip_maps[0];

Dependencies

~10MB
~31K SLoC