cairomm: Cairo::Region Class Reference

cairomm 1.14.6

Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Cairo::Region Class Reference

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

`#include <cairomm/region.h>`

## 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< Region > | copy () 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.
cobject * | cobj ()
const cobject * | cobj () const
void | reference () const
void | unreference () const

## Static Public Member Functions
static RefPtr< Region > | create ()
| Creates an empty Region object.
static RefPtr< Region > | create (const RectangleInt & rectangle)
| Creates a Region object containing rectangle.
static RefPtr< Region > | create (const std::vector< RectangleInt > & rects)
| Creates a Region object containing the union of all given rects.
static RefPtr< Region > | create (const RectangleInt * rects, int count)
| Creates a Region object containing the union of all given rects.

## Protected Attributes
cobject * | m_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

## ◆ cobject

typedef cairo_region_t Cairo::Region::cobject

## Constructor & Destructor Documentation

## ◆ Region()

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.

## ◆ ~Region()

virtual Cairo::Region::~Region | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ cobj() [1/2]

cobject * Cairo::Region::cobj | ( |  | ) |
| inline

## ◆ cobj() [2/2]

const cobject * Cairo::Region::cobj | ( |  | ) | const
| inline

## ◆ contains_point()

bool Cairo::Region::contains_point | ( | int | x,
|  | int | y ) const

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

## ◆ contains_rectangle()

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

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

## ◆ copy()

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

allocates a new region object copied from the original

## ◆ create() [1/4]

RefPtr< Region > Cairo::Region::create | ( |  | ) |
| static

Creates an empty Region object.

## ◆ create() [2/4]

RefPtr< Region > Cairo::Region::create | ( | const RectangleInt & | rectangle | ) |
| static

Creates a Region object containing rectangle.

## ◆ create() [3/4]

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

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

## ◆ create() [4/4]

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

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

## ◆ do_union() [1/2]

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

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

## ◆ do_union() [2/2]

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

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

## ◆ do_xor() [1/2]

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

## ◆ do_xor() [2/2]

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

## ◆ empty()

bool Cairo::Region::empty | ( |  | ) | const

Checks whether the region is empty.

## ◆ get_extents()

RectangleInt Cairo::Region::get_extents | ( |  | ) | const

Gets the bounding rectangle of the region.

## ◆ get_num_rectangles()

int Cairo::Region::get_num_rectangles | ( |  | ) | const

Gets the number of rectangles contained in the region.

## ◆ get_rectangle()

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

Gets the nth rectangle from the region.

## ◆ intersect() [1/2]

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

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

## ◆ intersect() [2/2]

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

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

## ◆ reference()

void Cairo::Region::reference | ( |  | ) | const

## ◆ subtract() [1/2]

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

Subtracts rectangle from this region.

## ◆ subtract() [2/2]

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

Subtracts other from this region.

## ◆ translate()

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

Translates the region by (dx,dy).

## ◆ unreference()

void Cairo::Region::unreference | ( |  | ) | const

## Member Data Documentation

## ◆ m_cobject

cobject* Cairo::Region::m_cobject
| protected

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

- cairomm/region.h