Generic rect packer class. Implements an algorithm to pack rects into groups efficiently. More...
#include <rect_packer.h>
Classes | |
| struct | AllocatedRect |
Public Types | |
| enum | AllocationPolicy { create_new_group , search_previous_groups , fail_if_full } |
| Allocation policy. More... | |
Public Member Functions | |
| RectPacker () | |
| Constructs a null instance. | |
| RectPacker (const Size &max_group_size, AllocationPolicy policy=create_new_group) | |
| Constructs a rect group. | |
| ~RectPacker () | |
| AllocatedRect | add (const Size &size) |
| Allocate space for another rect. | |
| AllocationPolicy | get_allocation_policy () const |
| Returns the allocation policy. | |
| int | get_group_count () const |
| Returns the amount of rects used by group. | |
| Size | get_max_group_size () const |
| Returns the max group size. | |
| int | get_rect_count (unsigned int group_index=0) const |
| Returns the amount of rects in a group. | |
| int | get_total_rect_count () const |
| Returns the total amount of rects. | |
| bool | is_null () const |
| Returns true if this object is invalid. | |
| void | set_allocation_policy (AllocationPolicy policy) |
| Set the allocation policy. | |
| void | throw_if_null () const |
| Throw an exception if this object is invalid. | |
Generic rect packer class. Implements an algorithm to pack rects into groups efficiently.
| clan::RectPacker::RectPacker | ( | ) |
Constructs a null instance.
| clan::RectPacker::RectPacker | ( | const Size & | max_group_size, |
| AllocationPolicy | policy = create_new_group ) |
Constructs a rect group.
| clan::RectPacker::~RectPacker | ( | ) |
| AllocatedRect clan::RectPacker::add | ( | const Size & | size | ) |
Allocate space for another rect.
| AllocationPolicy clan::RectPacker::get_allocation_policy | ( | ) | const |
Returns the allocation policy.
| int clan::RectPacker::get_group_count | ( | ) | const |
Returns the amount of rects used by group.
| Size clan::RectPacker::get_max_group_size | ( | ) | const |
Returns the max group size.
| int clan::RectPacker::get_rect_count | ( | unsigned int | group_index = 0 | ) | const |
Returns the amount of rects in a group.
| int clan::RectPacker::get_total_rect_count | ( | ) | const |
Returns the total amount of rects.
|
inline |
Returns true if this object is invalid.
| void clan::RectPacker::set_allocation_policy | ( | AllocationPolicy | policy | ) |
Set the allocation policy.
| void clan::RectPacker::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.