Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

Cairo::Region Class Reference

A simple graphical data type representing an area of integer-aligned rectangles. More...

List of all members.

Public Types

typedef cairo_region_t cobject

Public Member Functions

 Region (cairo_region_t*cobject, bool has_reference=false)
 Create a C++ wrapper for the C instance.
RefPtr< Regioncopy () const
 allocates a new region object copied from the original
virtual ~Region ()
RectangleInt get_extents () const
 Gets the bounding rectangle of the region.
int get_num_rectangles () const
 Gets the number of rectangles contained in the region.
RectangleInt get_rectangle (int nth_rectangle) const
 Gets the nth rectangle from the region.
bool empty () const
 Checks whether the region is empty.
RegionOverlap contains_rectangle (const RectangleInt& rectangle) const
 Checks whether rectangle is inside, outside, or partially contained in the region.
bool contains_point (int x, int y) const
 Checks whether (x,y) is contained in the region.
void translate (int dx, int dy)
 Translates the region by (dx,dy).
void subtract (const RefPtr< Region >& other)
 Subtracts other from this region.
void subtract (const RectangleInt& rectangle)
 Subtracts rectangle from this region.
void intersect (const RefPtr< Region >& other)
 Sets the region to the intersection of this region with other.
void intersect (const RectangleInt& rectangle)
 Sets the region to the intersection of this region with rectangle.
void do_union (const RefPtr< Region >& other)
 Sets this region to the union of the region with other.
void do_union (const RectangleInt& rectangle)
 Sets this region to the union of the region with rectangle.
void do_xor (const RefPtr< Region >& other)
 Sets this region to the exclusive difference of the region with other.
void do_xor (const RectangleInt& rectangle)
 Sets this region to the exclusive difference of the region with rectangle.
cobjectcobj ()
const cobjectcobj () const
void reference () const
void unreference () const

Static Public Member Functions

static RefPtr< Regioncreate ()
 Creates an empty Region object.
static RefPtr< Regioncreate (const RectangleInt& rectangle)
 Creates a Region object containing rectangle.
static RefPtr< Regioncreate (const std::vector< RectangleInt >& rects)
 Creates a Region object containing the union of all given rects.
static RefPtr< Regioncreate (const RectangleInt* rects, int count)
 Creates a Region object containing the union of all given rects.

Protected Attributes

cobjectm_cobject

Detailed Description

A simple graphical data type representing an area of integer-aligned rectangles.

They are often used on raster surfaces to track areas of interest, such as change or clip areas

It allows set-theoretical operations like union and intersect to be performed on them.

Since:
: 1.10

Member Typedef Documentation

typedef cairo_region_t Cairo::Region::cobject

Constructor & Destructor Documentation

Cairo::Region::Region ( cairo_region_t *  cobject,
bool  has_reference = false 
) [explicit]

Create a C++ wrapper for the C instance.

This C++ instance should then be given to a RefPtr.

Parameters:
cobject The C instance.
has_reference Whether we already have a reference. Otherwise, the constructor will take an extra reference.
virtual Cairo::Region::~Region (  )  [virtual]

Member Function Documentation

cobject* Cairo::Region::cobj (  )  [inline]
const cobject* Cairo::Region::cobj (  )  const [inline]
bool Cairo::Region::contains_point ( int  x,
int  y 
) const

Checks whether (x,y) is contained in the region.

RegionOverlap Cairo::Region::contains_rectangle ( const RectangleInt rectangle  )  const

Checks whether rectangle is inside, outside, or partially contained in the region.

RefPtr<Region> Cairo::Region::copy (  )  const

allocates a new region object copied from the original

static RefPtr<Region> Cairo::Region::create ( const RectangleInt rects,
int  count 
) [static]

Creates a Region object containing the union of all given rects.

static RefPtr<Region> Cairo::Region::create ( const RectangleInt rectangle  )  [static]

Creates a Region object containing rectangle.

static RefPtr<Region> Cairo::Region::create (  )  [static]

Creates an empty Region object.

static RefPtr<Region> Cairo::Region::create ( const std::vector< RectangleInt >&  rects  )  [static]

Creates a Region object containing the union of all given rects.

void Cairo::Region::do_union ( const RefPtr< Region >&  other  ) 

Sets this region to the union of the region with other.

void Cairo::Region::do_union ( const RectangleInt rectangle  ) 

Sets this region to the union of the region with rectangle.

void Cairo::Region::do_xor ( const RefPtr< Region >&  other  ) 

Sets this region to the exclusive difference of the region with other.

That is, the region will contain all areas that are in the original region or in other, but not in both

void Cairo::Region::do_xor ( const RectangleInt rectangle  ) 

Sets this region to the exclusive difference of the region with rectangle.

That is, the region will contain all areas that are in the original region or in rectangle, but not in both

bool Cairo::Region::empty (  )  const

Checks whether the region is empty.

RectangleInt Cairo::Region::get_extents (  )  const

Gets the bounding rectangle of the region.

int Cairo::Region::get_num_rectangles (  )  const

Gets the number of rectangles contained in the region.

RectangleInt Cairo::Region::get_rectangle ( int  nth_rectangle  )  const

Gets the nth rectangle from the region.

void Cairo::Region::intersect ( const RectangleInt rectangle  ) 

Sets the region to the intersection of this region with rectangle.

void Cairo::Region::intersect ( const RefPtr< Region >&  other  ) 

Sets the region to the intersection of this region with other.

void Cairo::Region::reference (  )  const
void Cairo::Region::subtract ( const RefPtr< Region >&  other  ) 

Subtracts other from this region.

void Cairo::Region::subtract ( const RectangleInt rectangle  ) 

Subtracts rectangle from this region.

void Cairo::Region::translate ( int  dx,
int  dy 
)

Translates the region by (dx,dy).

void Cairo::Region::unreference (  )  const

Member Data Documentation


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