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]

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]

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]

Auto Trait Implementations

impl RefUnwindSafe for DensePacker

impl Send for DensePacker

impl Sync for DensePacker

impl Unpin for DensePacker

impl UnwindSafe for DensePacker

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.