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

virtual AllocatedRect add (const Size &size)=0
 Allocate space for another rect. More...
 
virtual AllocationPolicy allocation_policy () const =0
 Returns the allocation policy. More...
 
virtual int group_count () const =0
 Returns the amount of rects used by group. More...
 
virtual Size max_group_size () const =0
 Returns the max group size. More...
 
virtual int rect_count (unsigned int group_index=0) const =0
 Returns the amount of rects in a group. More...
 
virtual int total_rect_count () const =0
 Returns the total amount of rects. More...
 

Static Public Member Functions

static std::shared_ptr< RectPackercreate (const Size &max_group_size, AllocationPolicy policy=create_new_group)
 Constructs a rect group. More...
 

Detailed Description

Generic rect packer class. Implements an algorithm to pack rects into groups efficiently.

Member Enumeration Documentation

Allocation policy.

Enumerator
create_new_group 
search_previous_groups 
fail_if_full 

Member Function Documentation

virtual AllocatedRect uicore::RectPacker::add ( const Size size)
pure virtual

Allocate space for another rect.

virtual AllocationPolicy uicore::RectPacker::allocation_policy ( ) const
pure virtual

Returns the allocation policy.

static std::shared_ptr<RectPacker> uicore::RectPacker::create ( const Size max_group_size,
AllocationPolicy  policy = create_new_group 
)
static

Constructs a rect group.

virtual int uicore::RectPacker::group_count ( ) const
pure virtual

Returns the amount of rects used by group.

virtual Size uicore::RectPacker::max_group_size ( ) const
pure virtual

Returns the max group size.

virtual int uicore::RectPacker::rect_count ( unsigned int  group_index = 0) const
pure virtual

Returns the amount of rects in a group.

virtual int uicore::RectPacker::total_rect_count ( ) const
pure virtual

Returns the total amount of rects.


The documentation for this class was generated from the following file: