Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Types | Public Member Functions
Xfc::Gdk::Region Class Reference

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

#include <xfc/gdk/region.hh>

Inheritance diagram for Xfc::Gdk::Region:
Xfc::Object Xfc::Trackable

List of all members.

Public Types

Public Member Functions

Constructors

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

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Member Typedef Documentation

typedef sigc::slot<void, GdkSpan*> Xfc::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

Xfc::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:
pointsA reference to a vector of Point that holds the points defining the polygon.
fill_ruleSpecifies which pixels are included in the region when the polygon overlaps itself.

The region is created with a reference count of 1 that the caller owns.

Xfc::Gdk::Region::Region ( const Rectangle rectangle)

Constructs a new region containing the area rectangle.

Parameters:
rectangleA Gdk::Rectangle.

The region is created with a reference count of 1 that the caller owns.

Xfc::Gdk::Region::Region ( GdkRegion *  region,
bool  copy 
)

Construct a new region from an existing GdkRegion.

Parameters:
regionA pointer to a GdkRegion.
copySet true if region should be copied.

If copy is false the Region takes over the reference count of region. The new Region created has a reference count of 1 that the caller owns.

Xfc::Gdk::Region::Region ( const Region src)

Copy constructor.

Parameters:
srcThe source region.

Member Function Documentation

Gets the smallest rectangle which includes the entire region.

Returns:
The smallest rectangle which includes all of the region.
void Xfc::Gdk::Region::get_clipbox ( Rectangle rectangle) const

Gets the smallest rectangle which includes the entire region.

Parameters:
rectangleThe location to store the smallest rectangle which includes all of the region.

Obtains the area covered by the region as a list of rectangles.

Returns:
A vector of Rectangle that holds the list of rectangles.
void Xfc::Gdk::Region::intersect ( const Region other)

Sets the area of the region to the intersection of the areas of the region and other.

Parameters:
otherA Region.

The resulting area is the set of pixels contained in both the region and other.

void Xfc::Gdk::Region::offset ( int  dx,
int  dy 
)

Moves a region the specified distance.

Parameters:
dxThe distance to move the region horizontally.
dyThe distance to move the region vertically.
bool Xfc::Gdk::Region::operator!= ( const Region other) const

Inequality operator; compares this region with other.

Parameters:
otherThe region to compare.
Returns:
true if the two regions compare unequal.
Region& Xfc::Gdk::Region::operator= ( const Region src)

Assignment operator.

Parameters:
srcThe source region.
bool Xfc::Gdk::Region::operator== ( const Region other) const

Equality operator; compares this region with other.

Parameters:
otherThe region to compare.
Returns:
true if the two regions compare equal.
bool Xfc::Gdk::Region::point_in ( int  x,
int  y 
) const

Returns true if a point is in the region.

Parameters:
xThe X coordinate of a point.
yThe Y coordinate of a point.
Returns:
true if the point is in the region.
bool Xfc::Gdk::Region::point_in ( const Point point) const

Returns true if a point is in the region.

Parameters:
pointThe Point to test.
Returns:
true if the point is in the region.
OverlapType Xfc::Gdk::Region::rect_in ( const Rectangle rectangle) const

Tests whether a rectangle is within a region.

Parameters:
rectangleA 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 Xfc::Gdk::Region::shrink ( int  dx,
int  dy 
)

Resizes a region by the specified amount.

Parameters:
dxThe number of pixels to shrink the region horizontally.
dyThe number of pixels to shrink the region vertically.

Positive values shrink the region. Negative values expand it.

void Xfc::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:
spansA reference to a vector of Span that holds the list of Span to test.
sortedSet true if spans is sorted wrt. the y coordinate.
slotThe slot to call on each span in the intersection.
void Xfc::Gdk::Region::subtract ( const Region other)

Subtracts the area of the region from the area other.

Parameters:
otherA Region.

The resulting area is the set of pixels contained in the region but not in other.

void Xfc::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:
rectangleA Gdk::Rectangle.

The resulting area is the set of pixels contained in either region or rect.

void Xfc::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:
otherA Region.

The resulting area is the set of pixels contained in either the region or other.

void Xfc::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:
otherA 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:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC