[−][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.
Example
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);
Structs
Bucket | Contains a set of |
Id | Represents an item tracked by Packos. |
InputItem | An input to the rectangle packing routines. |
OutputItem | An item that was placed by a packing function. |
PackOutput | The results from running a packing function. |
SimplePacker | A configurable rectangle packer using a simple packing algorithm. |