Crate tex_packer_core

Crate tex_packer_core 

Source
Expand description

Core library for packing textures into atlases.

  • Algorithms: Skyline (BL/MW + optional Waste Map), MaxRects (BAF/BSSF/BLSF/BL/CP), Guillotine (choice + split)
  • Pipeline: pack_images takes in-memory images and returns pages + metadata
  • Data model is serde-serializable; exporters are provided in helpers and the CLI crate.

Quick example:

use image::ImageReader;
use tex_packer_core::{InputImage, PackerConfig, pack_images};
let img1 = ImageReader::open("a.png")?.decode()?;
let img2 = ImageReader::open("b.png")?.decode()?;
let inputs = vec![
  InputImage { key: "a".into(), image: img1 },
  InputImage { key: "b".into(), image: img2 },
];
let cfg = PackerConfig { max_width: 1024, max_height: 1024, ..Default::default() };
let out = pack_images(inputs, cfg)?;
println!("pages: {}", out.pages.len());

Re-exports§

pub use config::*;
pub use error::*;
pub use export::*;
pub use export_plist::*;
pub use model::*;
pub use packer::*;
pub use pipeline::*;

Modules§

compositing
config
error
export
export_plist
model
packer
pipeline
prelude
Convenience prelude for common types and functions. Importing tex_packer_core::prelude::* brings the primary APIs into scope.
runtime
runtime_atlas