image-atlas

Crates.ioimage-atlas
lib.rsimage-atlas
version0.4.1
sourcesrc
created_at2023-10-08 08:07:16.279755
updated_at2024-04-07 08:32:57.847356
descriptionA texture atlas generator for generic purpose.
homepage
repositoryhttps://github.com/GossiperLoturot/image-atlas
max_upload_size
id996985
size46,768
Takumi Sugimoto (GossiperLoturot)

documentation

README

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];
Commit count: 20

cargo fmt