Crates.io | stb_rect_pack |
lib.rs | stb_rect_pack |
version | 0.3.0 |
source | src |
created_at | 2022-10-17 11:27:05.04883 |
updated_at | 2024-03-04 11:50:46.119974 |
description | Wrapper over stb_rect_pack_sys, offering a cleaner abstraction than the bindgen generated interface |
homepage | |
repository | https://github.com/voysys/stb_rect_pack |
max_upload_size | |
id | 690101 |
size | 17,207 |
Wrapper over stb_rect_pack_sys, offering a cleaner abstraction than the bindgen generated interface.
let mut rects = vec![Rect::new(1280, 720); 4];
pack(&mut rects, 2560, 1440).unwrap();
assert_eq!(rects[0].packed_top_left_x, 1280);
assert_eq!(rects[0].packed_top_left_y, 720);
assert_eq!(rects[1].packed_top_left_x, 0);
assert_eq!(rects[1].packed_top_left_y, 0);
assert_eq!(rects[2].packed_top_left_x, 1280);
assert_eq!(rects[2].packed_top_left_y, 0);
assert_eq!(rects[3].packed_top_left_x, 0);
assert_eq!(rects[3].packed_top_left_y, 720);