Skip to main content

tex_packer_core/
lib.rs

1//! Core texture-atlas packing library.
2//!
3//! The crate exposes validated offline and runtime workflow facades. Placement,
4//! compositing, and preparation details remain implementation-private.
5//!
6//! ```
7//! use image::{DynamicImage, RgbaImage};
8//! use tex_packer_core::config::OfflineConfig;
9//! use tex_packer_core::error::Result;
10//! use tex_packer_core::offline::{InputImage, OfflinePacker};
11//!
12//! # fn main() -> Result<()> {
13//! let packer = OfflinePacker::new(OfflineConfig::default());
14//! let output = packer.pack_images(vec![InputImage {
15//!     key: "hero".into(),
16//!     image: DynamicImage::ImageRgba8(RgbaImage::new(16, 16)),
17//! }])?;
18//! assert_eq!(output.atlas().stats().num_frames, 1);
19//! # Ok(())
20//! # }
21//! ```
22
23mod compositing;
24pub mod config;
25pub mod error;
26pub mod export;
27mod export_manifest;
28mod export_plist;
29mod free_space;
30mod geometry;
31pub mod model;
32pub mod offline;
33mod packer;
34mod packing_plan;
35mod pipeline;
36mod preparation;
37pub mod runtime;
38mod runtime_atlas;
39mod runtime_placement;
40
41pub use config::{OfflineConfig, PackingStrategy, PageConfig, RuntimeConfig};
42pub use error::{Result, TexPackerError};
43pub use model::{
44    Atlas, AtlasDocument, Frame, FrameId, Page, PageId, Rect, Region, RegionId, ResolvedFrame,
45};
46pub use offline::{InputImage, LayoutItem, OfflinePacker, PackOutput, RenderedPage};
47pub use runtime::{
48    AtlasSession, RuntimeAtlas, RuntimeImageUpdate, RuntimePlacement, RuntimeStats, UpdateRegion,
49};