## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csRectRegion Class Reference
[Geometry utilities]

A rect region is a class that implements splittable 2d rectangles. More...

`#include <csgeom/csrectrg.h>`

List of all members.

## Public Member Functions

void | ClipTo (csRect &clip)
| Clips everything in the region to the borders given.
int | Count () const
| Returns the number of rectangles in this region.
| csRectRegion ()
| Constructor.
void | Exclude (const csRect &rect)
| Exclude a rect from this region; may cause splitting.
void | Include (const csRect &rect)
| Add a rect to this region; may cause unions, but will not adjance (see csRect).
void | makeEmpty ()
| Resets the region count to zero.
csRect & | RectAt (int i) const
| Returns the rect at a specific index.
| ~csRectRegion ()
| Destructor.

## Protected Member Functions

void | deleteRect (int)
| Removes a rect from the region.
void | fragmentContainedRect (csRect &r1, csRect &r2)
| Work method fragments rects properly when they intersect.
void | fragmentRect (csRect &, csRect &, int mode)
| Controls fragmentContainedRect, used to perform all-side clipping and edge intersection.
void | gatherFragments ()
| Gathers all regions since the mark into the fragment buffer.
void | markForGather ()
| Marks the current region insertion point for gather.
void | pushRect (csRect const &)
| Pushes a new rect into the region, increases buffer if necessary.

## Protected Attributes

csRect | fragment [FRAGMENT_BUFFER_SIZE]
| The fragment buffer, used for performing fragment operations.
int | gather_mark
| The gather marker.
csRect * | region
| The pointer the list of regions.
int | region_count
| The number of regions currently stored.
int | region_max
| The size of the region buffer (in rects).

## Detailed Description

A rect region is a class that implements splittable 2d rectangles.

The region may be composed of one or more rectangles that do not need to occupy the same area. The idea being that you need to be able to have a number of disparate rectangular regions for updates. This class uses csRect for nearly all rectangle operations.

To use you can Include and Exclude rectangles from this region. When finished, this class will have a list of optimal rectangles that occupy a region. If used properly, it will result in faster overall painting performance, since several areas will not require overwriting.

Definition at line 56 of file csrectrg.h.

## Constructor & Destructor Documentation

csRectRegion::csRectRegion | ( |  | ) |

| Constructor.

csRectRegion::~csRectRegion | ( |  | ) |

| Destructor.

## Member Function Documentation

void csRectRegion::ClipTo | ( | csRect & | clip | ) |

| Clips everything in the region to the borders given.

int csRectRegion::Count | ( |  | ) | const`[inline]`

| Returns the number of rectangles in this region. Definition at line 106 of file csrectrg.h.

void csRectRegion::deleteRect | ( | int |  | ) | `[protected]`

| Removes a rect from the region.

void csRectRegion::Exclude | ( | const csRect & | rect | ) |

| Exclude a rect from this region; may cause splitting.

void csRectRegion::fragmentContainedRect | ( | csRect & | r1,
|  | csRect & | r2
| ) | `[protected]`

| Work method fragments rects properly when they intersect.

void csRectRegion::fragmentRect | ( | csRect & | ,
|  | csRect & | ,
|  | int | mode
| ) | `[protected]`

| Controls fragmentContainedRect, used to perform all-side clipping and edge intersection.

void csRectRegion::gatherFragments | ( |  | ) | `[protected]`

| Gathers all regions since the mark into the fragment buffer.

void csRectRegion::Include | ( | const csRect & | rect | ) |

| Add a rect to this region; may cause unions, but will not adjance (see csRect).

void csRectRegion::makeEmpty | ( |  | ) |

| Resets the region count to zero.

void csRectRegion::markForGather | ( |  | ) | `[protected]`

| Marks the current region insertion point for gather.

void csRectRegion::pushRect | ( | csRect const & |  | ) | `[protected]`

| Pushes a new rect into the region, increases buffer if necessary.

csRect& csRectRegion::RectAt | ( | int | i | ) | const`[inline]`

| Returns the rect at a specific index. Definition at line 108 of file csrectrg.h.

## Member Data Documentation

csRect csRectRegion::fragment[FRAGMENT_BUFFER_SIZE]`[protected]`

| The fragment buffer, used for performing fragment operations. Definition at line 66 of file csrectrg.h.

int csRectRegion::gather_mark `[protected]`

| The gather marker. Definition at line 68 of file csrectrg.h.

csRect* csRectRegion::region `[protected]`

| The pointer the list of regions. Definition at line 60 of file csrectrg.h.

int csRectRegion::region_count `[protected]`

| The number of regions currently stored. Definition at line 62 of file csrectrg.h.

int csRectRegion::region_max `[protected]`

| The size of the region buffer (in rects). Definition at line 64 of file csrectrg.h.

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

- csgeom/csrectrg.h