#include <region.h>
Public Types | |
| enum | FillRule { EVEN_ODD_RULE, WINDING_RULE } |
| Fill rule for polygons. More... | |
| enum | OverlapType { OVERLAP_IN, OVERLAP_OUT, OVERLAP_PART } |
| Types of overlapping between a rectangle and a region. More... | |
Public Member Functions | |
| Region () | |
| Empty region. | |
| Region (const Region &) | |
| Copy a region. | |
| Region (const std::vector< Point >, FillRule) | |
| Region from polygon. | |
| Region (const SDL_Rect &) | |
| Region from rectangle. | |
| Region (const Point &) | |
| Region from point. | |
| Region & | operator= (const Region &) |
| copy one region into another | |
| Rect | getClipbox () const |
| Get clipping box. | |
| RectList | getRectangles () const |
| Get component rectangles. | |
| unsigned long | nRects () const |
| Rect | getRect (unsigned long i) const |
| bool | empty () const |
| true if region empty | |
| bool | operator== (const Region &) const |
| compare two regions | |
| bool | operator!= (const Region &r) const |
| compare two regions | |
| bool | operator< (const Region &) const |
| for std::map only | |
| bool | contains (const Point &) const |
| check if a region contains a point | |
| OverlapType | overlap (const SDL_Rect &) const |
| Check if a region contains/overlaps a rectangle. | |
| void | clear () |
| set the region to be empty | |
| void | offset (int dx, int dy) |
| Move a region. | |
| void | offset (const Point &p) |
| Move a region. | |
| void | shrink (int dx, int dy) |
| Shrink a region Contract (dx, dy > 0) or expand (dx, dy < 0) the region in the directions of the axes. | |
| Region & | operator|= (const Region &) |
| Pointwise or. | |
| Region & | operator &= (const Region &) |
| Pointwise and. | |
| Region & | operator-= (const Region &) |
| Pointwise subtraction. | |
| Region & | operator^= (const Region &) |
| Pointwise xor. | |
| Region | boundary (bool inside) const |
| inside == true => points in the region which are next to points outside the region inside == false => points outside the region which are next to points in the region | |
| const_iterator | begin () const |
| const_iterator | end () const |
Friends | |
| Region | operator| (const Region &r, const Region &r2) |
| Pointwise or. | |
| Region | operator & (const Region &r, const Region &r2) |
| Pointwise and. | |
| Region | operator- (const Region &r, const Region &r2) |
| Pointwise subtraction. | |
| Region | operator^ (const Region &r, const Region &r2) |
| Pointwise xor. | |
Classes | |
| class | const_iterator |
| Iterator over points in the region. More... | |
| class | RectList |
| Used for things like passing an array of SDL_Rect to SDL_UpdateRects(). More... | |
| Region::Region | ( | const Region & | region | ) |
Copy a region.
Copies , creating an identical new region.
Return value: a new region identical to
| Region::Region | ( | const SDL_Rect & | rectangle | ) |
| Region::RectList Region::getRectangles | ( | ) | const |
Get component rectangles.
Obtains the area covered by the region as a list of rectangles. The array returned in must be freed with g_free().
| void Region::shrink | ( | int | dx, | |
| int | dy | |||
| ) |
Shrink a region Contract (dx, dy > 0) or expand (dx, dy < 0) the region in the directions of the axes.
If one of (dx, dy) is positive and the other negative, the region contracts in one direction and expands in the other.
Pointwise or.
Sets the area of to the union of the areas of and . The resulting area is the set of pixels contained in either or .
Pointwise and.
Sets the area of to the intersection of the areas of and . The resulting area is the set of pixels contained in both and .
Pointwise subtraction.
Subtracts the area of from the area . The resulting area is the set of pixels contained in but not in .
Pointwise xor.
Sets the area of to the exclusive-OR of the areas of and . The resulting area is the set of pixels contained in one or the other of the two sources but not in both.
| Region Region::boundary | ( | bool | inside | ) | const |
inside == true => points in the region which are next to points outside the region inside == false => points outside the region which are next to points in the region
FIXME pick a default value for 'inside'
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.