Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gdk::Region Class Reference

A GdkRegion C++ wrapper class. More...

`#include <inti/gdk/region.h>`

Inheritance diagram for Inti::Gdk::Region:

List of all members.

## Public Types

- typedef Slot1< void, GdkSpan * > SpansIntersectForeachSlot
    Signature of the callback slot to be called on each span in the intersection of a region and an array of spans.

## Public Member Functions

Constructors

- Region ()
    Construct a new empty region.
- Region (const std::vector< Point > &points, FillRule fill_rule)
    Construct a new region using the polygon defined by a number of points.
- Region (const Rectangle &rectangle)
    Construct a new region containing the area rectangle.
- Region (GdkRegion *region)
    Construct a new region from an existing GdkRegion.
- Region (const Region &src)
    Copy constructor.
- virtual ~Region ()
    Destructor.
- Region & operator= (const Region &src)
    Assignment operator.

Accessors

- GdkRegion * gdk_region () const
    Get a pointer to the GdkRegion structure.
- operator GdkRegion * () const
    Conversion operator; safely converts a Region to a GdkRegion pointer.
- Rectangle get_clipbox () const
    Gets the smallest rectangle which includes the entire region.
- void get_clipbox (Rectangle &rectangle) const
    Gets the smallest rectangle which includes the entire region.
- std::vector< Rectangle > get_rectangles () const
    Obtains the area covered by the region as a list of rectangles.
- bool empty () const
    Returns true if the region is empty.
- bool equal (const Region &other) const
    Returns true if this region and other are the same.
- bool point_in (int x, int y) const
    Returns true if a point is in the region.
- bool point_in (const Point &point) const
    Returns true if a point is in the region.
- OverlapType rect_in (const Rectangle &rectangle) const
    Tests whether a rectangle is within a region.
- bool operator== (const Region &other) const
    Equality operator; compares this region with other.
- bool operator!= (const Region &other) const
    Inequality operator; compares this region with other.

Methods

- void offset (int dx, int dy)
    Moves a region the specified distance.
- void shrink (int dx, int dy)
    Resizes a region by the specified amount.
- void union_with (const Rectangle &rectangle)
    Sets the area of the region to the union of the areas of the region and rectangle.
- void union_with (const Region &other)
    Sets the area of the region to the union of the areas of the region and other.
- void intersect (const Region &other)
    Sets the area of the region to the intersection of the areas of the region and other.
- void subtract (const Region &other)
    Subtracts the area of the region from the area other.
- void xor_with (const Region &other)
    Sets the area of the region to the exclusive-OR of the areas of the region and other.
- void spans_intersect_foreach (const std::vector< Span > &spans, bool sorted, const SpansIntersectForeachSlot *slot)
    Calls slot on each span in the intersection of the region and spans.

## Detailed Description

A GdkRegion C++ wrapper class.

Region is an object that represents an arbitrary set of pixels on the screen, and is usually used for clipping graphical operations (see Gdk::GC::set_clip(const Region&)).

## Member Typedef Documentation

typedef Slot1<void, GdkSpan*> Inti::Gdk::Region::SpansIntersectForeachSlot

| Signature of the callback slot to be called on each span in the intersection of a region and an array of spans. Example: Method signature for SpansIntersectForeachSlot.
                 void method(GdkSpan *span);

                 // span: A GdkSpan.
This is the type of slot passed to spans_intersect_foreach().

## Constructor & Destructor Documentation

Inti::Gdk::Region::Region | ( | const std::vector< Point > & | points,
|  | FillRule | fill_rule
| ) |

  | Construct a new region using the polygon defined by a number of points. Parameters:
  points | A reference to a vector of Point that holds the points defining the polygon.
  fill_rule | Specifies which pixels are included in the region when the polygon overlaps itself.

Inti::Gdk::Region::Region | ( | const Rectangle & | rectangle | ) |

  | Construct a new region containing the area rectangle. Parameters:
  rectangle | A Gdk::Rectangle.

Inti::Gdk::Region::Region | ( | GdkRegion * | region | ) | `[explicit]`

  | Construct a new region from an existing GdkRegion. Parameters:
  region | A pointer to a GdkRegion.
The region created is a copy of region.

Inti::Gdk::Region::Region | ( | const Region & | src | ) |

  | Copy constructor. Parameters:
  src | The source region.

## Member Function Documentation

void Inti::Gdk::Region::get_clipbox | ( | Rectangle & | rectangle | ) | const

  | Gets the smallest rectangle which includes the entire region. Parameters:
  rectangle | The location to store the smallest rectangle which includes all of the region.

Rectangle Inti::Gdk::Region::get_clipbox | ( |  | ) | const

| Gets the smallest rectangle which includes the entire region. Returns: The smallest rectangle which includes all of the region.

std::vector<Rectangle> Inti::Gdk::Region::get_rectangles | ( |  | ) | const

| Obtains the area covered by the region as a list of rectangles. Returns: A vector of Rectangle that holds the list of rectangles.

void Inti::Gdk::Region::intersect | ( | const Region & | other | ) |

  | Sets the area of the region to the intersection of the areas of the region and other. Parameters:
  other | A Region.
The resulting area is the set of pixels contained in both the region and other.

void Inti::Gdk::Region::offset | ( | int | dx,
|  | int | dy
| ) |

  | Moves a region the specified distance. Parameters:
  dx | The distance to move the region horizontally.
  dy | The distance to move the region vertically.

bool Inti::Gdk::Region::operator!= | ( | const Region & | other | ) | const

  | Inequality operator; compares this region with other. Parameters:
  other | The region to compare.
Returns: true if the two regions compare unequal.

Region& Inti::Gdk::Region::operator= | ( | const Region & | src | ) |

  | Assignment operator. Parameters:
  src | The source region.

bool Inti::Gdk::Region::operator== | ( | const Region & | other | ) | const

  | Equality operator; compares this region with other. Parameters:
  other | The region to compare.
Returns: true if the two regions compare equal.

bool Inti::Gdk::Region::point_in | ( | const Point & | point | ) | const

  | Returns true if a point is in the region. Parameters:
  point | The Point to test.
Returns: true if the point is in the region.

bool Inti::Gdk::Region::point_in | ( | int | x,
|  | int | y
| ) | const

  | Returns true if a point is in the region. Parameters:
  x | The X coordinate of a point.
  y | The Y coordinate of a point.
Returns: true if the point is in the region.

OverlapType Inti::Gdk::Region::rect_in | ( | const Rectangle & | rectangle | ) | const

  | Tests whether a rectangle is within a region. Parameters:
  rectangle | A Gdk::Rectangle.
Returns: OVERLAP_RECTANGLE_IN, OVERLAP_RECTANGLE_OUT, or OVERLAP_RECTANGLE_PART, depending on whether the rectangle is inside, outside, or partly inside the Region, respectively.

void Inti::Gdk::Region::shrink | ( | int | dx,
|  | int | dy
| ) |

  | Resizes a region by the specified amount. Parameters:
  dx | The number of pixels to shrink the region horizontally.
  dy | The number of pixels to shrink the region vertically.
Positive values shrink the region. Negative values expand it.

void Inti::Gdk::Region::spans_intersect_foreach | ( | const std::vector< Span > & | spans,
|  | bool | sorted,
|  | const SpansIntersectForeachSlot * | slot
| ) |

  | Calls slot on each span in the intersection of the region and spans. Parameters:
  spans | A reference to a vector of Span that holds the list of Span to test.
  sorted | Set true if spans is sorted wrt. the y coordinate.
  slot | The slot to call on each span in the intersection.

void Inti::Gdk::Region::subtract | ( | const Region & | other | ) |

  | Subtracts the area of the region from the area other. Parameters:
  other | A Region.
The resulting area is the set of pixels contained in the region but not in other.

void Inti::Gdk::Region::union_with | ( | const Region & | other | ) |

  | Sets the area of the region to the union of the areas of the region and other. Parameters:
  other | A Region.
The resulting area is the set of pixels contained in either the region or other.

void Inti::Gdk::Region::union_with | ( | const Rectangle & | rectangle | ) |

  | Sets the area of the region to the union of the areas of the region and rectangle. Parameters:
  rectangle | A Gdk::Rectangle.
The resulting area is the set of pixels contained in either region or rect.

void Inti::Gdk::Region::xor_with | ( | const Region & | other | ) |

  | Sets the area of the region to the exclusive-OR of the areas of the region and other. Parameters:
  other | A Region.
The resulting area is the set of pixels contained in the region or other, but not in both.

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

- region.h

Main Page - Footer