class TRegion |
Clipping region - abstract base class.
This abstract base class represents a 2-dimensional area which is used by Graphics, the graphics window server, and the text window server to define regions of the display which need to be updated, or regions within which all operations must occur.
A TRegion is defined in terms of an array of TRects and the more complex the region, the more TRects are required to represent it.
A clipping region initially has space allocated for five rectangles. If manipulations result in a region which requires more than this, an attempt is made to allocate more rectangles. If this cannot be done, an error flag is set, and all subsequent operations involving the region have no effect (except possibly to propagate the error flag to other regions). The CheckError() member function allows the error flag to be tested; Clear() can be used to clear it.
The redraw logic of application programs may use the TRegion in various ways:
1. minimally, they pass it to the graphics context as the clipping region; when a graphics context is activated to a window, the clipping region is set up automatically
2. if they wish to avoid redrawing objects which are outside the general area of the region, they may use TRegion::BoundingRect() to return the rectangle which bounds the clipping region, and draw only primitives that lie within that rectangle
3. if they wish to exercise finer control, they may extract the individual rectangles that comprise the clipping region using Operator[]().
Application programs may also manipulate clipping regions in order to constrain parts of their redrawing to narrower areas of the screen than the clipping region offered by the window server. To do this, functions that allow clipping region manipulation may be used; for example, adding or removing rectangles or finding the intersection or union of two regions.
Public Member Functions | |
---|---|
IMPORT_C void | AddRect(const TRect &) |
IMPORT_C TRect | BoundingRect() |
TBool | CheckError() |
IMPORT_C void | Clear() |
IMPORT_C void | ClipRect(const TRect &) |
IMPORT_C TBool | Contains(const TPoint &) |
IMPORT_C void | Copy(const TRegion &) |
TInt | Count() |
IMPORT_C void | ForceError() |
IMPORT_C void | Intersect(const TRegion &) |
IMPORT_C void | Intersection(const TRegion &, const TRegion &) |
IMPORT_C TBool | Intersects(const TRect &) |
IMPORT_C TBool | IsContainedBy(const TRect &) |
IMPORT_C TBool | IsEmpty() |
IMPORT_C void | Offset(TInt, TInt) |
IMPORT_C void | Offset(const TPoint &) |
const TRect * | RectangleList() |
IMPORT_C TInt | Sort() |
IMPORT_C TInt | Sort(const TPoint &) |
IMPORT_C void | SubRect(const TRect &, TRegion *) |
IMPORT_C void | SubRegion(const TRegion &, TRegion *) |
IMPORT_C void | Tidy() |
IMPORT_C void | Union(const TRegion &) |
IMPORT_C const TRect & | operator[](TInt) |
Protected Member Functions | |
---|---|
TRegion(TInt) | |
TRegion() | |
void | AppendRect(const TRect &) |
void | AppendRegion(TRegion &) |
void | DeleteRect(TRect *) |
TRect * | ExpandRegion(TInt) |
void | MergeRect(const TRect &, TBool) |
IMPORT_C TRect * | RectangleListW() |
TBool | SetListSize(TInt) |
void | ShrinkRegion() |
void | SubtractRegion(const TRegion &, TRegion *) |
Protected Attributes | |
---|---|
TInt | iAllocedRects |
TInt | iCount |
TBool | iError |
void | AppendRect | ( | const TRect & | aRect | ) | [protected] |
const TRect & aRect |
TBool | CheckError | ( | ) | const [inline] |
Tests whether the region's error flag is set.
The error flag may be set:
1. when an attempt to allocate more memory for the region fails
2. if an attempt is made to expand a fixed size region beyond its allocated size
3. if ForceError() has been called.
Use Clear() to unset the error flag, clear the region and free all allocated memory.
True, if the error flag is set; false, otherwise.
IMPORT_C TBool | Contains | ( | const TPoint & | aPoint | ) | const |
const TPoint & aPoint |
TInt | Count | ( | ) | const [inline] |
Gets the number of rectangles in this region.
The number of rectangles.
IMPORT_C void | Intersect | ( | const TRegion & | aRegion | ) |
const TRegion & aRegion |
IMPORT_C void | Intersection | ( | const TRegion & | aRegion, |
const TRegion & | aRegion2 | |||
) |
IMPORT_C TBool | Intersects | ( | const TRect & | aRect | ) | const |
const TRect & aRect |
IMPORT_C TBool | IsContainedBy | ( | const TRect & | aRect | ) | const |
const TRect & aRect |
const TRect * | RectangleList | ( | ) | const [inline] |
IMPORT_C void | SubRect | ( | const TRect & | aRect, |
TRegion * | aSubtractedRegion = NULL | |||
) |
IMPORT_C void | SubRegion | ( | const TRegion & | aRegion, |
TRegion * | aSubtractedRegion = NULL | |||
) |
void | SubtractRegion | ( | const TRegion & | aRegion, |
TRegion * | aSubtractedRegion = NULL | |||
) | [protected] |