CrystalSpace

Public API Reference

CS::SubRectanglesCompact Class Reference

A variation of SubRectangles that tries to place rectangles in a rectangular fashion. More...

#include <csgeom/subrec.h>

Inheritance diagram for CS::SubRectanglesCompact:

List of all members.

Public Member Functions

SubRectAlloc (int w, int h, csRect &rect)
 Allocate a new rectangle.
SubRectAllocNoGrow (int w, int h, csRect &rect)
 Allocate a rectangle but don't attempt growing to fit.
void Clear ()
 Free all rectangles in this region.
bool GetGrowPO2 () const
 Return whether growing to PO2 dimensions is enabled.
const csRectGetMaximumRectangle () const
 Return the upper limit of the rectangle.
void SetGrowPO2 (bool growPO2)
 Enable growing to PO2 dimensions.

Detailed Description

A variation of SubRectangles that tries to place rectangles in a rectangular fashion.

This means all allocated rectangles are attempted to be placed compactly in a rectangle in the upper left corner, where as the normal SubRectangles quickly "expands" in the X and Y directions.

This variation is useful if the rectangle you fill is an upper limit but the covered area should be as small as possible. It has slightly more overhead than the normal SubRectangles, though.

Remarks:
works best if bigger rectangles are inserted first. The malus from not doing so is bigger than the CS::SubRectangles one.

Definition at line 257 of file subrec.h.


Member Function Documentation

SubRect* CS::SubRectanglesCompact::Alloc ( int  w,
int  h,
csRect rect 
) [virtual]

Allocate a new rectangle.

Returns 0 if there is no room

Reimplemented from CS::SubRectangles.

SubRect* CS::SubRectanglesCompact::AllocNoGrow ( int  w,
int  h,
csRect rect 
) [inline]

Allocate a rectangle but don't attempt growing to fit.

Definition at line 284 of file subrec.h.

void CS::SubRectanglesCompact::Clear (  )  [virtual]

Free all rectangles in this region.

Reimplemented from CS::SubRectangles.

bool CS::SubRectanglesCompact::GetGrowPO2 (  )  const [inline]

Return whether growing to PO2 dimensions is enabled.

Definition at line 281 of file subrec.h.

const csRect& CS::SubRectanglesCompact::GetMaximumRectangle (  )  const [inline]

Return the upper limit of the rectangle.

Definition at line 272 of file subrec.h.

void CS::SubRectanglesCompact::SetGrowPO2 ( bool  growPO2  )  [inline]

Enable growing to PO2 dimensions.

Means that if an enlargement of the rectangle is necessary it will be to a PO2 dimension. Useful when e.g. the rectangle is to be used as a texture.

Definition at line 279 of file subrec.h.


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

Generated for Crystal Space 2.0 by doxygen 1.6.1