Struct rect_packer::Packer [−][src]
pub struct Packer { /* fields omitted */ }
Packer
is the main structure in this crate. It holds packing context.
Implementations
impl Packer
[src]
impl Packer
[src]pub fn new(config: Config) -> Packer
[src]
Create new empty Packer
with the provided parameters.
pub fn config(&self) -> Config
[src]
Get config that this packer was created with.
pub fn pack(
&mut self,
width: i32,
height: i32,
allow_rotation: bool
) -> Option<Rect>
[src]
&mut self,
width: i32,
height: i32,
allow_rotation: bool
) -> Option<Rect>
Pack new rectangle. Returns position of the newly added rectangle. If there is not enough space returns None
.
If it returns None
you can still try to add smaller rectangles.
allow_rotation
- allow 90° rotation of the input rectangle. You can detect whether rectangle was rotated by comparing
returned width
and height
with the supplied ones.
pub fn can_pack(&self, width: i32, height: i32, allow_rotation: bool) -> bool
[src]
Check if rectangle with the specified size can be added.