Region

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

Constructors

this
this(GdkRegion* gdkRegion)

Sets our main struct and passes it to the parent class

this
this()

Creates a new empty GdkRegion.

Members

Functions

copy
Region copy()

Copies region, creating an identical new region.

destroy
void destroy()

Destroys a GdkRegion.

empty
int empty()

Finds out if the GdkRegion is empty.

equal
int equal(Region region2)

Finds out if the two regions are the same.

getClipbox
void getClipbox(Rectangle rectangle)

Obtains the smallest rectangle which includes the entire GdkRegion.

getRectangles
void getRectangles(GdkRectangle[] rectangles)

Obtains the area covered by the region as a list of rectangles. The array returned in rectangles must be freed with g_free().

getRegionStruct
GdkRegion* getRegionStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

intersect
void 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.

offset
void offset(int dx, int dy)

Moves a region the specified distance.

pointIn
int pointIn(int x, int y)

Finds out if a point is in a region.

rectEqual
int rectEqual(Rectangle rectangle)

Warning gdk_region_rect_equal has been deprecated since version 2.22 and should not be used in newly-written code. Use gdk_region_new_rect() and gdk_region_equal() to achieve the same effect. Finds out if a regions is the same as a rectangle. Since 2.18

rectIn
GdkOverlapType rectIn(Rectangle rectangle)

Tests whether a rectangle is within a region.

shrink
void shrink(int dx, int dy)

Warning gdk_region_shrink has been deprecated since version 2.22 and should not be used in newly-written code. There is no replacement for this function. Resizes a region by the specified amount. Positive values shrink the region. Negative values expand it.

spansIntersectForeach
void spansIntersectForeach(GdkSpan[] spans, int sorted, GdkSpanFunc funct, void* data)

Warning gdk_region_spans_intersect_foreach has been deprecated since version 2.22 and should not be used in newly-written code. There is no replacement. Calls a function on each span in the intersection of region and spans.

subtract
void 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.

unio
void 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.

unionWithRect
void 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.

xor
void 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.

Static functions

polygon
Region polygon(GdkPoint[] points, GdkFillRule fillRule)

Warning gdk_region_polygon has been deprecated since version 2.22 and should not be used in newly-written code. There is no replacement. For working with paths, please use Cairo. Creates a new GdkRegion using the polygon defined by a number of points.

rectangle
Region rectangle(Rectangle rectangle)

Creates a new region containing the area rectangle.

Variables

gdkRegion
GdkRegion* gdkRegion;

the main Gtk struct

Meta