[][src]Crate packos

Packos is a small library for packing rectangles. It was built for Tarmac, a tool that manages assets for Roblox projects, including packing images into spritesheets.

Packos currently exposes a single packing implementation, SimplePacker. More algorithms can be added in the future using the same basic types that Packos uses.


use packos::{InputItem, SimplePacker};

// First, transform the rectangles you want to pack into the Packos
// InputItem type.
let my_items = &[
    InputItem::new((128, 64)),
    InputItem::new((64, 64)),
    InputItem::new((1, 300)),

// Construct a packer and configure it with your constraints
let packer = SimplePacker::new().max_size((512, 512));

// Compute a solution.
// SimplePacker::pack accepts anything that can turn into an iterator of
// InputItem or &InputItem.
let output = packer.pack(my_items);



Contains a set of OutputItem values that were packed together into the same fixed-size containers.


Represents an item tracked by Packos.


An input to the rectangle packing routines.


An item that was placed by a packing function.


The results from running a packing function.


A configurable rectangle packer using a simple packing algorithm.