14个版本
0.2.13 | 2024年6月17日 |
---|---|
0.2.10 | 2023年11月17日 |
0.2.8 | 2023年7月4日 |
0.2.7 | 2022年5月4日 |
0.2.1 | 2020年11月26日 |
#15 in 图形API
81,570 每月下载量
在 66 个crate中(17个直接) 使用
88KB
2K SLoC
Étagère
使用货架装箱算法的动态纹理图集分配器。
动机
动态地将纹理组合在一起的能力对于某些图形渲染场景非常重要(例如 WebRender)。
当存在大量尺寸相似的项目时,货架装箱算法效果非常好,例如动态字形图集。
另见 guillotière,另一个基于不同算法的动态图集分配器,具有不同的装箱和性能特征。
示例
use etagere::*;
let mut atlas = AtlasAllocator::new(size2(1000, 1000));
let a = atlas.allocate(size2(100, 1000)).unwrap();
let b = atlas.allocate(size2(900, 200)).unwrap();
atlas.deallocate(a.id);
let c = atlas.allocate(size2(300, 200)).unwrap();
assert_eq!(c.rectangle, atlas.get(c.id));
atlas.deallocate(c.id);
atlas.deallocate(b.id);
许可证
根据您的要求,许可协议为以下之一
- Apache License,版本2.0 (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT许可证 (LICENSE-MIT 或 https://opensource.org/licenses/MIT)
。
依赖关系
~0.6–0.8MB
~19K SLoC