BRegion¶
Constructor and Destructor¶
BRegion()
BRegion(const BRegion ®ion)
BRegion(const BRect &rect)
BRegion()
Initializes the BRegion object to be a copy of region,
or to be a rectangular region containing the space indicated by
rect. If no argument is supplied, the BRegion is empty
and Frame()
returns and invalid BRect
.
~BRegion()
virtual BRegion::~BRegion()
Frees the memory that was allocated to hold data describing the region.
Member Functions¶
Contains()
bool BRegion::Contains(BPoint point) const
Returns true if point lies within the region, and false if not.
Frame()
Returns the smallest rectangle that encloses all the rectangles in the region.
If the region is empty, the returned object will be invalid. Check the return thus:
rect = region.Frame();
if (rect.IsValid())
/* okay */
else
/* nope */
Intersects()
bool BRegion::Intersects(BRect rect) const
Returns true if the BRegion has any area in common with rect, and false if not.
MakeEmpty()
void BRegion::MakeEmpty()
Empties the BRegion and invalidates the object’s
Frame()
rectangle.
OffsetBy()
void BRegion::OffsetBy(int32 horizontal, int32 vertical)
Offsets all rectangles in the region by horizontal and vertical deltas.
PrintToStream()
void BRegion::PrintToStream() const
Prints (to standard out) each rectangle in the BRegion in the form:
"BRect(left, top, right, bottom)"
The first string that’s printed is the object’s frame rectangle. Each subsequent string describes a single rectangle in the BRegion.
RectAt(), CountRects()
BRect BRegion::RectAt(int32 index)
int32 BRegion::CountRects()
CountRects() returns the total number of rectangles in the BRegion; RectAt() returns the rectangle at a particular index. The order of the rectangles is unimportant.
Set(), Include(), Exclude(), IntersectWith()
void BRegion::Include(BRect rect)
void BRegion::Include(const BRegion *region)
void BRegion::Exclude(BRect rect)
void BRegion::Exclude(const BRegion *region)
void BRegion::IntersectWith(const BRegion *region)
Set() modifies the BRegion so that it only contains rect.
Include() modifies the region to include (copies of) the rectangles contained in rect or region.
Exclude() modifies the region to exclude all rectangles contained in rect or region..
IntersectWith() modifies the region so that it includes only those areas that it has in common with another region.
Operators¶
BRegion &operator=(const BRegion&)
Sets the left region to be an independent copy of the right region:
BRegion left_region = right_region;