#rect #pack #stb #abstraction #bindgen #offering #generated

stb_rect_pack

Wrapper over stb_rect_pack_sys, offering a cleaner abstraction than the bindgen generated interface

3 releases (breaking)

0.3.0 Mar 4, 2024
0.2.0 Mar 31, 2023
0.1.0 Oct 17, 2022

#1 in #offering

Download history 293/week @ 2023-12-18 132/week @ 2023-12-25 353/week @ 2024-01-01 301/week @ 2024-01-08 197/week @ 2024-01-15 323/week @ 2024-01-22 195/week @ 2024-01-29 365/week @ 2024-02-05 252/week @ 2024-02-12 366/week @ 2024-02-19 156/week @ 2024-02-26 393/week @ 2024-03-04 28/week @ 2024-03-11 22/week @ 2024-03-25 34/week @ 2024-04-01

93 downloads per month

MIT/Apache

7KB
94 lines

stb_rect_pack

Wrapper over stb_rect_pack_sys, offering a cleaner abstraction than the bindgen generated interface.

stb

Example

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);

Dependencies

~0.3–2.7MB
~55K SLoC