stb_rect_pack

Crates.iostb_rect_pack
lib.rsstb_rect_pack
version0.3.0
sourcesrc
created_at2022-10-17 11:27:05.04883
updated_at2024-03-04 11:50:46.119974
descriptionWrapper over stb_rect_pack_sys, offering a cleaner abstraction than the bindgen generated interface
homepage
repositoryhttps://github.com/voysys/stb_rect_pack
max_upload_size
id690101
size17,207
Torkel Danielsson (torkeldanielsson)

documentation

https://docs.rs/stb_rect_pack

README

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);
Commit count: 3

cargo fmt