clan::RectPacker Class Reference

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
 RectPacker ()
 Constructs a null instance. More...
 
 RectPacker (const Size &max_group_size, AllocationPolicy policy=create_new_group)
 Constructs a rect group. More...
 
 ~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...
 
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 Size &size)
 Allocate space for another rect. More...
 

Detailed Description

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


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