CrystalSpace

Public API Reference

csSubRectangles Class Reference
[Geometry utilities]

A class managing allocations of sub-rectangles. More...

#include <csgeom/subrec.h>

List of all members.

Public Member Functions

SubRectAlloc (int w, int h, csRect &rect)
 Allocate a new rectangle.
void Clear ()
 Free all rectangles in this region.
 csSubRectangles (const csRect &region)
 Allocate a new empty region with the given size.
void Dump ()
 For debugging: dump all free rectangles.
const csRectGetRectangle () const
 Get the rectangle for this region.
bool Grow (int newWidth, int newHeight)
 Increase the size of the region.
void Reclaim (SubRect *subrect)
 Reclaim a subrectangle, meaning, the space occupied by the subrect can be reused by subsequent Alloc() calls.
 ~csSubRectangles ()
 Remove this region and sub-regions.

Protected Member Functions

void AddLeaf (SubRect *sr)
SubRectAllocSubrect ()
void RemoveLeaf (SubRect *sr)

Protected Attributes

SubRect::SubRectAlloc alloc
csArray< SubRect * > leaves
 Leaves of the region tree.
csRect region
 Dimensions of this region.
SubRectroot
 Root of the region tree.

Friends

class SubRect

Classes

class  SubRect
 Sub-rectangle. More...


Detailed Description

A class managing allocations of sub-rectangles.

i.e. this class represents a rectangular region from which a client can allocate smaller rectangles until the region is full.

Definition at line 42 of file subrec.h.


Constructor & Destructor Documentation

csSubRectangles::csSubRectangles ( const csRect region  ) 

Allocate a new empty region with the given size.

csSubRectangles::~csSubRectangles (  ) 

Remove this region and sub-regions.


Member Function Documentation

SubRect* csSubRectangles::Alloc ( int  w,
int  h,
csRect rect 
)

Allocate a new rectangle.

Returns 0 if there is no room

void csSubRectangles::Clear (  ) 

Free all rectangles in this region.

void csSubRectangles::Dump (  ) 

For debugging: dump all free rectangles.

const csRect& csSubRectangles::GetRectangle (  )  const [inline]

Get the rectangle for this region.

Definition at line 141 of file subrec.h.

bool csSubRectangles::Grow ( int  newWidth,
int  newHeight 
)

Increase the size of the region.

You can only grow upwards.

void csSubRectangles::Reclaim ( SubRect subrect  ) 

Reclaim a subrectangle, meaning, the space occupied by the subrect can be reused by subsequent Alloc() calls.


Member Data Documentation

Leaves of the region tree.

Definition at line 119 of file subrec.h.

Dimensions of this region.

Definition at line 109 of file subrec.h.

Root of the region tree.

Definition at line 111 of file subrec.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.7