BRegion Class Reference

#include <Region.h>

List of all members.


Detailed Description

A BRegion object comprises a set of rectangles in a two-dimensional coordinate system.

See also:
Using BRegion


Public Member Functions

 BRegion ()
 BRegion (const BRegion &region)
 BRegion (const BRect rect)
virtual ~BRegion ()
BRegionoperator= (const BRegion &from)
BRect Frame () const
clipping_rect FrameInt () const
BRect RectAt (int32 index) const
clipping_rect RectAtInt (int32 index) const
int32 CountRects () const
void Set (BRect newBounds)
void Set (clipping_rect newBounds)
bool Intersects (BRect r) const
bool Intersects (clipping_rect r) const
bool Contains (BPoint pt) const
bool Contains (int32 x, int32 y)
void PrintToStream () const
void OffsetBy (int32 dh, int32 dv)
void MakeEmpty ()
void Include (BRect r)
void Include (clipping_rect r)
void Include (const BRegion *)
void Exclude (BRect r)
void Exclude (clipping_rect r)
void Exclude (const BRegion *)
void IntersectWith (const BRegion *)
 BRegion (BPrivate::IRegion *reg, bool takeOwnership=true)

Friends

class BPrivate::IKAccess


Constructor & Destructor Documentation

BRegion  ) 
 

Default constructor.

If no argument is supplied, the BRegion is empty and Frame() returns and invalid BRect.

BRegion const BRegion reg  ) 
 

Initializes the BRegion object to be a copy of region.

Parameters:
reg Region

BRegion const BRect  rect  ) 
 

Initializes the BRegion object to be a rectangular region containing the space indicated by rect.

~BRegion  )  [virtual]
 

Frees the memory that was allocated to hold data describing the region.

BRegion BPrivate::IRegion *  reg,
bool  takeOwnership = true
 


Member Function Documentation

bool Contains int32  x,
int32  y
 

bool Contains BPoint  a_point  )  const
 

Returns:
true if point lies within the region, and false if not.

int32 CountRects  )  const
 

/return the total number of rectangles in the BRegion.

void Exclude const BRegion region  ) 
 

Modifies the region to exclude all rectangles contained in region.

region Region to exclude

void Exclude clipping_rect  r  ) 
 

void Exclude BRect  fr  ) 
 

Modifies the region to exclude all rectangles contained in rect.

fr Rectangle to exclude

BRect Frame  )  const
 

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.

See also:
BRect::IsValid()

clipping_rect FrameInt  )  const
 

void Include const BRegion region  ) 
 

Modifies the region to include (copies of) the rectangles contained in region.

region Region to include

void Include clipping_rect  r  ) 
 

void Include BRect  fr  ) 
 

Modifies the region to include (copies of) the rectangles contained in rect.

Parameters:
fr Rectangle to include

bool Intersects clipping_rect  r  )  const
 

bool Intersects BRect  a_rect  )  const
 

Returns:
true if the BRegion has any area in common with rect, and false if not.

void IntersectWith const BRegion region  ) 
 

Modifies the region so that it includes only those areas that it has in common with another region.

Parameters:
region Intersection region

void MakeEmpty  ) 
 

Empties the BRegion and invalidates the object's Frame() rectangle.

void OffsetBy int32  dh,
int32  dv
 

Offsets all rectangles in the region by horizontal and vertical deltas.

Parameters:
dh horizontal delta
dv vertical delta

BRegion & operator= const BRegion from  ) 
 

Sets the left region to be an independent copy of the right region:

BRegion left_region = right_region;

void PrintToStream void   )  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.

BRect RectAt int32  index  )  const
 

Returns:
the rectangle at a particular index. The order of the rectangles is unimportant.
Parameters:
index particular index

clipping_rect RectAtInt int32  index  )  const
 

void Set clipping_rect  newBounds  ) 
 

void Set BRect  initialbound  ) 
 

Modifies the BRegion so that it only contains rect.

Parameters:
initialbound Initial rectangle


Friends And Related Function Documentation

friend class BPrivate::IKAccess [friend]
 


Copyright 2005 by yellowTAB GmbH, Be Inc., Palm Source Inc. and their respective legal successors
All rights reserved.