Classes

CL_RectPacker Class Reference
[clanDisplay 2D]

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

#include <rect_packer.h>

List of all members.

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.
 CL_RectPacker (const CL_Size &max_group_size, AllocationPolicy policy=create_new_group)
 Constructs a rect group.
 ~CL_RectPacker ()
Attributes

bool is_null () const
 Returns true if this object is invalid.
void throw_if_null () const
 Throw an exception if this object is invalid.
AllocationPolicy get_allocation_policy () const
 Returns the allocation policy.
CL_Size get_max_group_size () const
 Returns the max group size.
int get_total_rect_count () const
 Returns the total amount of rects.
int get_rect_count (unsigned int group_index=0) const
 Returns the amount of rects in a group.
int get_group_count () const
 Returns the amount of rects used by group.
Operations

void set_allocation_policy (AllocationPolicy policy)
 Set the allocation policy.
AllocatedRect add (const CL_Size &size)
 Allocate space for another rect.

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 

Constructor & Destructor Documentation

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 (  ) 

Member Function Documentation

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.

bool CL_RectPacker::is_null (  )  const [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.


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