Skip to main content

Crate tex_packer_core

Crate tex_packer_core 

Source
Expand description

Core texture-atlas packing library.

The crate exposes validated offline and runtime workflow facades. Placement, compositing, and preparation details remain implementation-private.

use image::{DynamicImage, RgbaImage};
use tex_packer_core::config::OfflineConfig;
use tex_packer_core::error::Result;
use tex_packer_core::offline::{InputImage, OfflinePacker};

let packer = OfflinePacker::new(OfflineConfig::default());
let output = packer.pack_images(vec![InputImage {
    key: "hero".into(),
    image: DynamicImage::ImageRgba8(RgbaImage::new(16, 16)),
}])?;
assert_eq!(output.atlas().stats().num_frames, 1);

Re-exports§

pub use config::OfflineConfig;
pub use config::PackingStrategy;
pub use config::PageConfig;
pub use config::RuntimeConfig;
pub use error::Result;
pub use error::TexPackerError;
pub use model::Atlas;
pub use model::AtlasDocument;
pub use model::Frame;
pub use model::FrameId;
pub use model::Page;
pub use model::PageId;
pub use model::Rect;
pub use model::Region;
pub use model::RegionId;
pub use model::ResolvedFrame;
pub use offline::InputImage;
pub use offline::LayoutItem;
pub use offline::OfflinePacker;
pub use offline::PackOutput;
pub use offline::RenderedPage;
pub use runtime::AtlasSession;
pub use runtime::RuntimeAtlas;
pub use runtime::RuntimeImageUpdate;
pub use runtime::RuntimePlacement;
pub use runtime::RuntimeStats;
pub use runtime::UpdateRegion;

Modules§

config
error
export
model
offline
runtime