An area composed of rectangles. More...
Public Member Functions | |
BRegion () | |
Initializes an empty region. The region contains no rectangles, and its bounds are invalid. | |
BRegion (const BRect rect) | |
Initializes a region to contain a rect. | |
BRegion (const BRegion &other) | |
Initializes a region as a copy of other. | |
virtual | ~BRegion () |
Destroys the BRegion freeing any memory allocated by it. | |
bool | Contains (BPoint point) const |
Returns whether or not if the region contains the given point. | |
bool | Contains (int32 x, int32 y) |
Returns whether or not the region contains the given coordinates. | |
bool | Contains (int32 x, int32 y) const |
Return whether or not the region contains the given coordinates. | |
int32 | CountRects () |
Returns the number of rectangles contained in the region. | |
int32 | CountRects () const |
Returns the number of rectangles contained in the region. | |
void | Exclude (BRect rect) |
Modifies the region excluding the area of the given rect. | |
void | Exclude (clipping_rect clipping) |
Modifies the region excluding the area of the given clipping rectangle. | |
void | Exclude (const BRegion *region) |
Modifies the region excluding the area contained by the given region. | |
void | ExclusiveInclude (const BRegion *region) |
Modifies the region so that it contains only the area which the BRegion and region do NOT have in common. | |
BRect | Frame () const |
Returns a rectangle that encloses the BRegion. | |
clipping_rect | FrameInt () const |
Returns the bounds of the region as a clipping_rect (which has integer coordinates). | |
void | Include (BRect rect) |
Modifies the region so that it includes the given rect. | |
void | Include (clipping_rect clipping) |
Modifies the region so that it includes the given clipping rectangle. | |
void | Include (const BRegion *region) |
Modifies the region to include the area of the given region. | |
bool | Intersects (BRect rect) const |
Returns whether or not the region has any area in common with rect. | |
bool | Intersects (clipping_rect clipping) const |
Returns whether or not the region has any area in common with clipping. | |
void | IntersectWith (const BRegion *region) |
Modifies the region, so that it will contain only the area in common with region. | |
void | MakeEmpty () |
Empties the region so that it doesn't containt any rects, and invalidates its bounds. | |
void | OffsetBy (const BPoint &point) |
Applies the given offsets given by the x and y coordinates of point to each rectangle contained in the region and recalculates the region's bounds. | |
void | OffsetBy (int32 x, int32 y) |
Applies the given x and y offsets to each rectangle contained in the region and recalculates the region's bounds. | |
void | PrintToStream () const |
Prints each rect in the the BRegion to standard output. | |
BRect | RectAt (int32 index) |
Returns the rectangle contained in the region at the given index. | |
BRect | RectAt (int32 index) const |
Returns the rectangle contained in the region at the given index. | |
clipping_rect | RectAtInt (int32 index) |
Returns the clipping_rect contained in the region at the given index. | |
clipping_rect | RectAtInt (int32 index) const |
Returns the clipping_rect contained in the region at the given index. | |
void | ScaleBy (BSize scale) |
Resize each of the contained rectangles by the given factor and recalculates the region's bounds. | |
void | ScaleBy (float x, float y) |
Resize each of the contained rectangles by the given factors and recalculates the region's bounds. | |
void | Set (BRect rect) |
Set the region to bounds of newBounds. | |
void | Set (clipping_rect clipping) |
Set the region to the bounds of clipping_rect. | |
Operators | |
BRegion & | operator= (const BRegion &other) |
Modifies the BRegion to be a copy of other. | |
bool | operator== (const BRegion &other) const |
Compares this region to other by value. | |
An area composed of rectangles.
The rectangles do not need to overlap. This class is useful for creating clipping masks.
BRegion::BRegion | ( | ) |
Initializes an empty region. The region contains no rectangles, and its bounds are invalid.
BRegion::BRegion | ( | const BRegion & | other | ) |
Initializes a region as a copy of other.
other | The region to copy. |
BRegion::BRegion | ( | const BRect | rect | ) |
|
virtual |
Destroys the BRegion freeing any memory allocated by it.
bool BRegion::Contains | ( | BPoint | point | ) | const |
Returns whether or not if the region contains the given point.
point | The point to check. |
true
if the region contains the point, false
if not.Returns whether or not the region contains the given coordinates.
x | The x coordinate of the point to check. |
y | The y coordinate of the point to check. |
true
if the region contains the point, false
if not.Return whether or not the region contains the given coordinates.
x | The x coordinate of the point to check. |
y | The y coordinate of the point to check. |
true
if the region contains the point, false
if not.int32 BRegion::CountRects | ( | ) |
Returns the number of rectangles contained in the region.
int32 BRegion::CountRects | ( | ) | const |
Returns the number of rectangles contained in the region.
void BRegion::Exclude | ( | BRect | rect | ) |
Modifies the region excluding the area of the given rect.
rect | The BRect to be excluded. |
void BRegion::Exclude | ( | clipping_rect | clipping | ) |
Modifies the region excluding the area of the given clipping rectangle.
clipping | The clipping_rect to be excluded. |
void BRegion::Exclude | ( | const BRegion * | region | ) |
Modifies the region excluding the area contained by the given region.
region | The BRegion to be excluded. |
void BRegion::ExclusiveInclude | ( | const BRegion * | region | ) |
BRect BRegion::Frame | ( | ) | const |
clipping_rect BRegion::FrameInt | ( | ) | const |
Returns the bounds of the region as a clipping_rect (which has integer coordinates).
void BRegion::Include | ( | BRect | rect | ) |
Modifies the region so that it includes the given rect.
rect | The BRect to include in the region. |
void BRegion::Include | ( | clipping_rect | clipping | ) |
Modifies the region so that it includes the given clipping rectangle.
clipping | The clipping_rect to include in the region. |
void BRegion::Include | ( | const BRegion * | region | ) |
Modifies the region to include the area of the given region.
region | The region to be included. |
bool BRegion::Intersects | ( | BRect | rect | ) | const |
bool BRegion::Intersects | ( | clipping_rect | clipping | ) | const |
Returns whether or not the region has any area in common with clipping.
clipping | The clipping_rect to check the region against. |
true
if the region has any area in common with the clipping_rect, false
if not.void BRegion::IntersectWith | ( | const BRegion * | region | ) |
Modifies the region, so that it will contain only the area in common with region.
region | the BRegion to intersect with. |
void BRegion::MakeEmpty | ( | ) |
Empties the region so that it doesn't containt any rects, and invalidates its bounds.
void BRegion::OffsetBy | ( | const BPoint & | point | ) |
Applies the given offsets given by the x and y coordinates of point to each rectangle contained in the region and recalculates the region's bounds.
point | The point to get the coordinates to offset by. |
Applies the given x and y offsets to each rectangle contained in the region and recalculates the region's bounds.
x | The horizontal offset. |
y | The vertical offset. |
bool BRegion::operator== | ( | const BRegion & | other | ) | const |
Compares this region to other by value.
other | the BRegion to compare to. |
true
if the regions are the same, false
otherwise.void BRegion::PrintToStream | ( | ) | const |
Prints each rect in the the BRegion to standard output.
clipping_rect BRegion::RectAtInt | ( | int32 | index | ) |
Returns the clipping_rect contained in the region at the given index.
index | The index of the clipping_rect to retrieve. (zero based) |
clipping_rect BRegion::RectAtInt | ( | int32 | index | ) | const |
Returns the clipping_rect contained in the region at the given index.
index | The index of the clipping_rect to retrieve. (zero based) |
void BRegion::ScaleBy | ( | BSize | scale | ) |
Resize each of the contained rectangles by the given factor and recalculates the region's bounds.
scale | The scale factor |
void BRegion::ScaleBy | ( | float | x, |
float | y | ||
) |
Resize each of the contained rectangles by the given factors and recalculates the region's bounds.
x | The horizontal scale. |
y | The vertical scale. |
void BRegion::Set | ( | BRect | rect | ) |
void BRegion::Set | ( | clipping_rect | clipping | ) |
Set the region to the bounds of clipping_rect.
clipping | The clipping_rect to set the bounds to. |