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