SkyGI::Region Class Reference

Collaboration diagram for SkyGI::Region:
[legend]
List of all members.

Public Member Functions

 Region ()
 Initializes a region. The region will have no rects, and its bound will be invalid.
 Region (const Region &region)
 Initializes a region to be a copy of another.
 Region (const Rect rect)
 Initializes a region to contain a Rect.
virtual ~Region ()
 Frees the allocated memory.
Regionoperator= (const Region &from)
 Modifies the region to be a copy of the given Region.
Rect Frame () const
 Returns the bounds of the region.
clipping_rect FrameInt () const
 Returns the bounds of the region as a clipping_rect (which has integer coordinates).
Rect RectAt (int index)
 Returns the regions's Rect at the given index.
clipping_rect RectAtInt (int index)
 Returns the regions's clipping_rect at the given index.
int CountRects ()
 Counts the region rects.
void Set (Rect newBounds)
 Set the region to contain just the given Rect.
void Set (clipping_rect newBounds)
 Set the region to contain just the given clipping_rect.
bool Intersects (Rect r) const
 Check if the region has any area in common with the given Rect.
bool Intersects (clipping_rect r) const
 Check if the region has any area in common with the given clipping_rect.
bool Contains (Point pt) const
 Check if the region contains the given Point.
bool Contains (int x, int y)
 Check if the region contains the given coordinates.
void PrintToStream () const
 Prints the Region to stdout.
void OffsetBy (int dh, int dv)
 Offsets all region's rects, and bounds by the given values.
void MakeEmpty ()
 Empties the region, so that it doesn't include any rect, and invalidates its bounds.
void Include (Rect r)
 Modifies the region, so that it includes the given Rect.
void Include (clipping_rect r)
 Modifies the region, so that it includes the given clipping_rect.
void Include (const Region *)
 Modifies the region, so that it includes the area of the given region.
void Exclude (Rect r)
 Modifies the region, excluding the area represented by the given Rect.
void Exclude (clipping_rect r)
 Modifies the region, excluding the area represented by the given clipping_rect.
void Exclude (const Region *)
 Modifies the region, excluding the area contained in the given Region.
void IntersectWith (const Region *)
 Modifies the region, so that it will contain just the area in common with the given Region.

Friends

class RegionSupport

Constructor & Destructor Documentation

Region::Region (  ) 

Initializes a region. The region will have no rects, and its bound will be invalid.

Region::Region ( const Region region  ) 

Initializes a region to be a copy of another.

Parameters:
region The region to copy.

Region::Region ( const Rect  rect  ) 

Initializes a region to contain a Rect.

Parameters:
rect The Rect to set the region to.

Region::~Region (  )  [virtual]

Frees the allocated memory.


Member Function Documentation

Region & Region::operator= ( const Region region  ) 

Modifies the region to be a copy of the given Region.

Parameters:
region the Region to copy.
Returns:
This function always returns *this.

Rect Region::Frame (  )  const

Returns the bounds of the region.

Returns:
A Rect which represents the bounds of the region.

clipping_rect Region::FrameInt (  )  const

Returns the bounds of the region as a clipping_rect (which has integer coordinates).

Returns:
A clipping_rect which represents the bounds of the region.

Rect Region::RectAt ( int  index  ) 

Returns the regions's Rect at the given index.

Parameters:
index The index (zero based) of the wanted rectangle.
Returns:
If the given index is valid, it returns the Rect at that index, otherwise, it returns an invalid Rect.

clipping_rect Region::RectAtInt ( int  index  ) 

Returns the regions's clipping_rect at the given index.

Parameters:
index The index (zero based) of the wanted rectangle.
Returns:
If the given index is valid, it returns the clipping_rect at that index, otherwise, it returns an invalid clipping_rect.

int Region::CountRects (  ) 

Counts the region rects.

Returns:
An int which is the total number of rects in the region.

void Region::Set ( Rect  newBounds  ) 

Set the region to contain just the given Rect.

Parameters:
newBounds A Rect.

void Region::Set ( clipping_rect  newBounds  ) 

Set the region to contain just the given clipping_rect.

Parameters:
newBounds A clipping_rect.

bool Region::Intersects ( Rect  rect  )  const

Check if the region has any area in common with the given Rect.

Parameters:
rect The Rect to check the region against to.
Returns:
if the region has any area in common with the Rect, if not.

bool Region::Intersects ( clipping_rect  rect  )  const

Check if the region has any area in common with the given clipping_rect.

Parameters:
rect The clipping_rect to check the region against to.
Returns:
if the region has any area in common with the clipping_rect, if not.

bool Region::Contains ( Point  pt  )  const

Check if the region contains the given Point.

Parameters:
pt The Point to be checked.
Returns:
if the region contains the Point, if not.

bool Region::Contains ( int  x,
int  y 
)

Check if the region contains the given coordinates.

Parameters:
x The coordinate of the point to be checked.
y The coordinate of the point to be checked.
Returns:
if the region contains the point, if not.

void Region::PrintToStream (  )  const

Prints the Region to stdout.

void Region::OffsetBy ( int  dh,
int  dv 
)

Offsets all region's rects, and bounds by the given values.

Parameters:
dh The horizontal offset.
dv The vertical offset.

void Region::MakeEmpty (  ) 

Empties the region, so that it doesn't include any rect, and invalidates its bounds.

void Region::Include ( Rect  rect  ) 

Modifies the region, so that it includes the given Rect.

Parameters:
rect The Rect to be included by the region.

void Region::Include ( clipping_rect  rect  ) 

Modifies the region, so that it includes the given clipping_rect.

Parameters:
rect The clipping_rect to be included by the region.

void Region::Include ( const Region region  ) 

Modifies the region, so that it includes the area of the given region.

Parameters:
region The region to be included.

void Region::Exclude ( Rect  rect  ) 

Modifies the region, excluding the area represented by the given Rect.

Parameters:
rect The Rect to be excluded.

void Region::Exclude ( clipping_rect  rect  ) 

Modifies the region, excluding the area represented by the given clipping_rect.

Parameters:
rect The clipping_rect to be excluded.

void Region::Exclude ( const Region region  ) 

Modifies the region, excluding the area contained in the given Region.

Parameters:
region The Region to be excluded.

void Region::IntersectWith ( const Region region  ) 

Modifies the region, so that it will contain just the area in common with the given Region.

Parameters:
region the Region to intersect to.


Friends And Related Function Documentation

friend class RegionSupport [friend]


Generated on Thu Dec 13 18:14:41 2007 for SkyGI by  doxygen 1.5.1-p1