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


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.

Constructors

Public Types

Public Member Functions

Accessors
Methods

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:
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.
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:
rectangle A 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:
region A pointer to a GdkRegion.
copy Set 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:
src The source region.


Member Function Documentation

Region& Xfc::Gdk::Region::operator= ( const Region src  ) 

Assignment operator.

Parameters:
src The source region.

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

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:
rectangle The location to store the smallest rectangle which includes all of the region.

std::vector<Rectangle> Xfc::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.

bool Xfc::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.

bool Xfc::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.

OverlapType Xfc::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.

bool Xfc::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 Xfc::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.

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

void Xfc::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 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:
rectangle A 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:
other A Region.
The resulting area is the set of pixels contained in either the region or other.

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:
other A Region.
The resulting area is the set of pixels contained in both the region and other.

void Xfc::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 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:
other A Region.
The resulting area is the set of pixels contained in the region or other, but not in both.

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:
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.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3