Struct rect_packer::DensePacker [−][src]
pub struct DensePacker { /* fields omitted */ }
Similar to Packer
but does not add any padding between rectangles.
Implementations
impl DensePacker
[src]
impl DensePacker
[src]pub fn new(width: i32, height: i32) -> DensePacker
[src]
Create new empty DensePacker
with the provided parameters.
pub fn size(&self) -> (i32, i32)
[src]
Get size that this packer was created with.
pub fn resize(&mut self, width: i32, height: i32)
[src]
Set new size for this packer.
New size should be not less than the current size.
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.
Trait Implementations
impl Clone for DensePacker
[src]
impl Clone for DensePacker
[src]