Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

wftk::Region Class Reference

Region specifies a 'working area' of the screen - pixels outside the region are always ignored. More...

#include <region.h>

List of all members.

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.

Regionoperator= (const Region &)
 copy one region into another

Rect getClipbox () const
 Get clipping box.

RectList getRectangles () const
 Get component rectangles.

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.

Regionoperator|= (const Region &)
 Pointwise or.

Regionoperator &= (const Region &)
 Pointwise and.

Regionoperator-= (const Region &)
 Pointwise subtraction.

Regionoperator^= (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


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.


Detailed Description

Region specifies a 'working area' of the screen - pixels outside the region are always ignored.


Member Enumeration Documentation

enum wftk::Region::FillRule
 

Fill rule for polygons.

Enumeration values:
EVEN_ODD_RULE 
WINDING_RULE 

enum wftk::Region::OverlapType
 

Types of overlapping between a rectangle and a region.

Enumeration values:
OVERLAP_IN  rectangle is in region
OVERLAP_OUT  rectangle is not in region
OVERLAP_PART  rectangle is partially in region


Constructor & Destructor Documentation

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 from rectangle.

Creates a new region containing the area .

Return value: a new region


Member Function Documentation

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'

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().

Region & Region::operator &= const Region other  ) 
 

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 .

Region & Region::operator-= const Region other  ) 
 

Pointwise subtraction.

Subtracts the area of from the area . The resulting area is the set of pixels contained in but not in .

Region & Region::operator^= const Region other  ) 
 

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::operator|= const Region 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 .

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.


The documentation for this class was generated from the following files:

Generated Fri Mar 5 08:11:01 2004.
Copyright © 1998-2003 by the respective authors.

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.