Cairo::Region Class Reference

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

## 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. More...
RefPtr< Region > | copy () const
| allocates a new region object copied from the original More...
virtual | ~Region ()
RectangleInt | get_extents () const
| Gets the bounding rectangle of the region. More...
int | get_num_rectangles () const
| Gets the number of rectangles contained in the region. More...
RectangleInt | get_rectangle (int nth_rectangle) const
| Gets the nth rectangle from the region. More...
bool | empty () const
| Checks whether the region is empty. More...
RegionOverlap | contains_rectangle (const RectangleInt& rectangle) const
| Checks whether rectangle is inside, outside, or partially contained in the region. More...
bool | contains_point (int x, int y) const
| Checks whether (x,y) is contained in the region. More...
void | translate (int dx, int dy)
| Translates the region by (dx,dy) More...
void | subtract (const RefPtr< Region >& other)
| Subtracts other from this region. More...
void | subtract (const RectangleInt& rectangle)
| Subtracts rectangle from this region. More...
void | intersect (const RefPtr< Region >& other)
| Sets the region to the intersection of this region with other. More...
void | intersect (const RectangleInt& rectangle)
| Sets the region to the intersection of this region with rectangle. More...
void | do_union (const RefPtr< Region >& other)
| Sets this region to the union of the region with other. More...
void | do_union (const RectangleInt& rectangle)
| Sets this region to the union of the region with rectangle. More...
void | do_xor (const RefPtr< Region >& other)
| Sets this region to the exclusive difference of the region with other. More...
void | do_xor (const RectangleInt& rectangle)
| Sets this region to the exclusive difference of the region with rectangle. More...
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. More...
static RefPtr< Region > | create (const RectangleInt& rectangle)
| Creates a Region object containing rectangle. More...
static RefPtr< Region > | create (const std::vector< RectangleInt >& rects)
| Creates a Region object containing the union of all given rects. More...
static RefPtr< Region > | create (const RectangleInt* rects, int count)
| Creates a Region object containing the union of all given rects. More...

## 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

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

static

Creates an empty Region object.

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

static

Creates a Region object containing rectangle.

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

static

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

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

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 RefPtr< Region >& | other | ) |

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

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

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

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

cobject* Cairo::Region::m_cobject

protected

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

- cairomm/region.h