Synopsis#include <gdk/gdk.h> GdkPoint; GdkRectangle; gboolean gdk_rectangle_intersect (const GdkRectangle *src1, const GdkRectangle *src2, GdkRectangle *dest); void gdk_rectangle_union (const GdkRectangle *src1, const GdkRectangle *src2, GdkRectangle *dest); GdkRegion; GdkRegion* gdk_region_new (void); GdkRegion* gdk_region_polygon (const GdkPoint *points, gint n_points, GdkFillRule fill_rule); enum GdkFillRule; GdkRegion* gdk_region_copy (const GdkRegion *region); GdkRegion* gdk_region_rectangle (const GdkRectangle *rectangle); void gdk_region_destroy (GdkRegion *region); void gdk_region_get_clipbox (const GdkRegion *region, GdkRectangle *rectangle); void gdk_region_get_rectangles (const GdkRegion *region, GdkRectangle **rectangles, gint *n_rectangles); gboolean gdk_region_empty (const GdkRegion *region); gboolean gdk_region_equal (const GdkRegion *region1, const GdkRegion *region2); gboolean gdk_region_point_in (const GdkRegion *region, int x, int y); GdkOverlapType gdk_region_rect_in (const GdkRegion *region, const GdkRectangle *rectangle); enum GdkOverlapType; void gdk_region_offset (GdkRegion *region, gint dx, gint dy); void gdk_region_shrink (GdkRegion *region, gint dx, gint dy); void gdk_region_union_with_rect (GdkRegion *region, const GdkRectangle *rect); void gdk_region_intersect (GdkRegion *source1, const GdkRegion *source2); void gdk_region_union (GdkRegion *source1, const GdkRegion *source2); void gdk_region_subtract (GdkRegion *source1, const GdkRegion *source2); void gdk_region_xor (GdkRegion *source1, const GdkRegion *source2); GdkSpan; void (*GdkSpanFunc) (GdkSpan *span, gpointer data); void gdk_region_spans_intersect_foreach (GdkRegion *region, const GdkSpan *spans, int n_spans, gboolean sorted, GdkSpanFunc function, gpointer data); DescriptionGDK 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
GdkRegion is an opaque data type holding a set of arbitrary pixels, and is
usually used for clipping graphical operations (see
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 DetailsGdkPointtypedef struct { gint x; gint y; } GdkPoint; Defines the x and y coordinates of a point.
GdkRectangletypedef struct { gint x; gint y; gint width; gint height; } GdkRectangle; Defines the position and size of a rectangle.
gdk_rectangle_intersect ()gboolean gdk_rectangle_intersect (const GdkRectangle *src1, const GdkRectangle *src2, GdkRectangle *dest);
Calculates the intersection of two rectangles. It is allowed for
gdk_rectangle_union ()void gdk_rectangle_union (const GdkRectangle *src1, const GdkRectangle *src2, GdkRectangle *dest);
Calculates the union of two rectangles.
The union of rectangles
GdkRegiontypedef struct _GdkRegion GdkRegion; A GdkRegion represents a set of pixels on the screen. gdk_region_new ()GdkRegion* gdk_region_new (void); Creates a new empty GdkRegion.
gdk_region_polygon ()GdkRegion* gdk_region_polygon (const GdkPoint *points, gint n_points, GdkFillRule fill_rule); Creates a new GdkRegion using the polygon defined by a number of points.
enum GdkFillRuletypedef enum { GDK_EVEN_ODD_RULE, GDK_WINDING_RULE } GdkFillRule; The method for determining which pixels are included in a region, when creating a GdkRegion from a polygon. The fill rule is only relevant for polygons which overlap themselves. gdk_region_copy ()GdkRegion* gdk_region_copy (const GdkRegion *region);
Copies
gdk_region_rectangle ()GdkRegion* gdk_region_rectangle (const GdkRectangle *rectangle);
Creates a new region containing the area
gdk_region_destroy ()void gdk_region_destroy (GdkRegion *region); Destroys a GdkRegion.
gdk_region_get_clipbox ()void gdk_region_get_clipbox (const GdkRegion *region, GdkRectangle *rectangle); Obtains the smallest rectangle which includes the entire GdkRegion.
gdk_region_get_rectangles ()void gdk_region_get_rectangles (const GdkRegion *region, GdkRectangle **rectangles, gint *n_rectangles);
Obtains the area covered by the region as a list of rectangles.
The array returned in
gdk_region_empty ()gboolean gdk_region_empty (const GdkRegion *region); Finds out if the GdkRegion is empty.
gdk_region_equal ()gboolean gdk_region_equal (const GdkRegion *region1, const GdkRegion *region2); Finds out if the two regions are the same.
gdk_region_point_in ()gboolean gdk_region_point_in (const GdkRegion *region, int x, int y); Finds out if a point is in a region.
gdk_region_rect_in ()GdkOverlapType gdk_region_rect_in (const GdkRegion *region, const GdkRectangle *rectangle); Tests whether a rectangle is within a region.
enum GdkOverlapTypetypedef enum { GDK_OVERLAP_RECTANGLE_IN, GDK_OVERLAP_RECTANGLE_OUT, GDK_OVERLAP_RECTANGLE_PART } GdkOverlapType;
Specifies the possible values returned by gdk_region_offset ()void gdk_region_offset (GdkRegion *region, gint dx, gint dy); Moves a region the specified distance.
gdk_region_shrink ()void gdk_region_shrink (GdkRegion *region, gint dx, gint dy); Resizes a region by the specified amount. Positive values shrink the region. Negative values expand it.
gdk_region_union_with_rect ()void gdk_region_union_with_rect (GdkRegion *region, const GdkRectangle *rect);
Sets the area of
gdk_region_intersect ()void gdk_region_intersect (GdkRegion *source1, const GdkRegion *source2);
Sets the area of
gdk_region_union ()void gdk_region_union (GdkRegion *source1, const GdkRegion *source2);
Sets the area of
gdk_region_subtract ()void gdk_region_subtract (GdkRegion *source1, const GdkRegion *source2);
Subtracts the area of
gdk_region_xor ()void gdk_region_xor (GdkRegion *source1, const GdkRegion *source2);
Sets the area of
GdkSpantypedef struct { gint x; gint y; gint width; } GdkSpan;
A GdkSpan represents a horizontal line of pixels starting
at the pixel with coordinates
GdkSpanFunc ()void (*GdkSpanFunc) (GdkSpan *span, gpointer data);
This defines the type of the function passed to
gdk_region_spans_intersect_foreach ()void gdk_region_spans_intersect_foreach (GdkRegion *region, const GdkSpan *spans, int n_spans, gboolean sorted, GdkSpanFunc function, gpointer data);
Calls a function on each span in the intersection of
|