gdk.Region.Region Class Reference

List of all members.

Detailed Description

Description GDK provides the GdkPoint, GdkRectangle, GdkRegion and GdkSpan data types for representing pixels and sets of pixels on the screen.

GdkPoint is a simple structure containing an x and y coordinate of a point. GdkRectangle is a structure holding the position and size of a rectangle. The intersection of two rectangles can be computed with gdk_rectangle_intersect(). To find the union of two rectangles use gdk_rectangle_union(). GdkRegion is an opaque data type holding a set of arbitrary pixels, and is usually used for clipping graphical operations (see gdk_gc_set_clip_region()). GdkSpan is a structure holding a spanline. A spanline is a horizontal line that is one pixel wide. It is mainly used when rasterizing other graphics primitives. It can be intersected to regions by using gdk_region_spans_intersect_foreach().


Public Member Functions

GdkRegiongetRegionStruct ()
 this (GdkRegion *gdkRegion)
 Sets our main struct and passes it to the parent class.
 this ()
 Creates a new empty GdkRegion.
Region copy ()
 Copies region, creating an identical new region.
void destroy ()
 Destroys a GdkRegion.
void getClipbox (Rectangle rectangle)
 Obtains the smallest rectangle which includes the entire GdkRegion.
void getRectangles (GdkRectangle **rectangles, int *nRectangles)
 Obtains the area covered by the region as a list of rectangles.
int empty ()
 Finds out if the GdkRegion is empty.
int equal (Region region2)
 Finds out if the two regions are the same.
int pointIn (int x, int y)
 Finds out if a point is in a region.
GdkOverlapType rectIn (Rectangle rectangle)
 Tests whether a rectangle is within a region.
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 unionWithRect (Rectangle rect)
 Sets the area of region to the union of the areas of region and rect.
void intersect (Region source2)
 Sets the area of source1 to the intersection of the areas of source1 and source2.
void unio (Region source2)
 Sets the area of source1 to the union of the areas of source1 and source2.
void subtract (Region source2)
 Subtracts the area of source2 from the area source1.
void xor (Region source2)
 Sets the area of source1 to the exclusive-OR of the areas of source1 and source2.
void spansIntersectForeach (GdkSpan *spans, int nSpans, int sorted, GdkSpanFunc funct, void *data)
 Calls a function on each span in the intersection of region and spans.

Static Public Member Functions

static Region polygon (GdkPoint *points, int npoints, GdkFillRule fillRule)
 Creates a new GdkRegion using the polygon defined by a number of points.
static Region rectangle (Rectangle rectangle)
 Creates a new region containing the area rectangle.

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GdkRegiongdkRegion
 the main Gtk struct


Constructor & Destructor Documentation

gdk.Region.Region.this ( GdkRegion gdkRegion  ) 

Sets our main struct and passes it to the parent class.

gdk.Region.Region.this (  ) 

Creates a new empty GdkRegion.

Returns: a new empty GdkRegion


Member Function Documentation

Region gdk.Region.Region.copy (  ) 

Copies region, creating an identical new region.

region: a GdkRegion Returns: a new region identical to region

void gdk.Region.Region.destroy (  ) 

Destroys a GdkRegion.

region: a GdkRegion

int gdk.Region.Region.empty (  ) 

Finds out if the GdkRegion is empty.

region: a GdkRegion Returns: TRUE if region is empty.

int gdk.Region.Region.equal ( Region  region2  ) 

Finds out if the two regions are the same.

region1: a GdkRegion region2: a GdkRegion Returns: TRUE if region1 and region2 are equal.

void gdk.Region.Region.getClipbox ( Rectangle  rectangle  ) 

Obtains the smallest rectangle which includes the entire GdkRegion.

region: a GdkRegion rectangle: return location for the clipbox

void gdk.Region.Region.getRectangles ( GdkRectangle **  rectangles,
int nRectangles 
)

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

The array returned in rectangles must be freed with g_free(). region: a GdkRegion rectangles: return location for an array of rectangles n_rectangles: length of returned array

GdkRegion* gdk.Region.Region.getRegionStruct (  ) 

void* gdk.Region.Region.getStruct (  )  [protected]

the main Gtk struct as a void*

void gdk.Region.Region.intersect ( Region  source2  ) 

Sets the area of source1 to the intersection of the areas of source1 and source2.

The resulting area is the set of pixels contained in both source1 and source2. source1: a GdkRegion source2: another GdkRegion

void gdk.Region.Region.offset ( int  dx,
int  dy 
)

Moves a region the specified distance.

region: a GdkRegion dx: the distance to move the region horizontally dy: the distance to move the region vertically

int gdk.Region.Region.pointIn ( int  x,
int  y 
)

Finds out if a point is in a region.

region: a GdkRegion x: the x coordinate of a point y: the y coordinate of a point Returns: TRUE if the point is in region.

static Region gdk.Region.Region.polygon ( GdkPoint points,
int  npoints,
GdkFillRule  fillRule 
) [static]

Creates a new GdkRegion using the polygon defined by a number of points.

points: an array of GdkPoint structs npoints: the number of elements in the points array fill_rule: specifies which pixels are included in the region when the polygon overlaps itself. Returns: a new GdkRegion based on the given polygon

static Region gdk.Region.Region.rectangle ( Rectangle  rectangle  )  [static]

Creates a new region containing the area rectangle.

rectangle: a GdkRectangle Returns: a new region

GdkOverlapType gdk.Region.Region.rectIn ( Rectangle  rectangle  ) 

Tests whether a rectangle is within a region.

region: a GdkRegion. rectangle: a GdkRectangle. Returns: GDK_OVERLAP_RECTANGLE_IN, GDK_OVERLAP_RECTANGLE_OUT, or GDK_OVERLAP_RECTANGLE_PART, depending on whether the rectangle is inside, outside, or partly inside the GdkRegion, respectively.

void gdk.Region.Region.shrink ( int  dx,
int  dy 
)

Resizes a region by the specified amount.

Positive values shrink the region. Negative values expand it. region: a GdkRegion dx: the number of pixels to shrink the region horizontally dy: the number of pixels to shrink the region vertically

void gdk.Region.Region.spansIntersectForeach ( GdkSpan spans,
int  nSpans,
int  sorted,
GdkSpanFunc  funct,
void *  data 
)

Calls a function on each span in the intersection of region and spans.

region: a GdkRegion spans: an array of GdkSpans n_spans: the length of spans sorted: TRUE if spans is sorted wrt. the y coordinate function: function to call on each span in the intersection data: data to pass to function

void gdk.Region.Region.subtract ( Region  source2  ) 

Subtracts the area of source2 from the area source1.

The resulting area is the set of pixels contained in source1 but not in source2. source1: a GdkRegion source2: another GdkRegion

void gdk.Region.Region.unio ( Region  source2  ) 

Sets the area of source1 to the union of the areas of source1 and source2.

The resulting area is the set of pixels contained in either source1 or source2. source1: a GdkRegion source2: a GdkRegion

void gdk.Region.Region.unionWithRect ( Rectangle  rect  ) 

Sets the area of region to the union of the areas of region and rect.

The resulting area is the set of pixels contained in either region or rect. region: a GdkRegion. rect: a GdkRectangle.

void gdk.Region.Region.xor ( Region  source2  ) 

Sets the area of source1 to the exclusive-OR of the areas of source1 and source2.

The resulting area is the set of pixels contained in one or the other of the two sources but not in both. source1: a GdkRegion source2: another GdkRegion


Member Data Documentation

GdkRegion* gdk.Region.Region.gdkRegion [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo