| ## 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.
size_t | 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.
const csRect & | RectAt (size_t i) const
| Returns the rect at a specific index.
| ~csRectRegion ()
| Destructor.
## Protected Member Functions
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.
## Protected Attributes
csRect | fragment [FRAGMENT_BUFFER_SIZE]
| The fragment buffer, used for performing fragment operations.
size_t | gather_mark
| The gather marker.
csArray< csRect > | region
| The pointer the list of regions.
## Static Protected Attributes
static const size_t | FRAGMENT_BUFFER_SIZE = 64

## 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 55 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.

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

Returns the number of rectangles in this region.

Definition at line 97 of file csrectrg.h.

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.

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

Returns the rect at a specific index.

Definition at line 99 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 63 of file csrectrg.h.

size_t csRectRegion::gather_mark`[protected]`

The gather marker.

Definition at line 65 of file csrectrg.h.

csArray<csRect> csRectRegion::region`[protected]`

The pointer the list of regions.

Definition at line 61 of file csrectrg.h.

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

- csgeom/csrectrg.h