Struct rect_packer::Packer
[−]
[src]
pub struct Packer { // some fields omitted }
Packer
is the main structure in this crate. It holds packing context.
Methods
impl Packer
[src]
fn new(config: Config) -> Packer
Create new empty Packer
with the provided parameters.
fn pack(&mut self, width: i32, height: i32, allow_rotation: bool) -> Option<Rect>
Pack new rectangle. Returns position of 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.
fn can_pack(&self, width: i32, height: i32, allow_rotation: bool) -> bool
Check if rectangle with the specified size can be added. This is equivalent to .pack(width, height, allow_rotation).is_some()
but faster.
Trait Implementations
impl Clone for Packer
[src]
fn clone(&self) -> Packer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more