<refentry id="gdk-Points-Rectangles-and-Regions">
<refmeta>
<refentrytitle>Points, Rectangles and Regions</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Points, Rectangles and Regions</refname><refpurpose>simple graphical data types.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

#include &lt;gdk/gdk.h&gt;


struct      <link linkend="GdkPoint">GdkPoint</link>;

struct      <link linkend="GdkRectangle">GdkRectangle</link>;
<link linkend="gboolean">gboolean</link>    <link linkend="gdk-rectangle-intersect">gdk_rectangle_intersect</link>         (<link linkend="GdkRectangle">GdkRectangle</link> *src1,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *src2,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *dest);
void        <link linkend="gdk-rectangle-union">gdk_rectangle_union</link>             (<link linkend="GdkRectangle">GdkRectangle</link> *src1,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *src2,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *dest);

struct      <link linkend="GdkRegion">GdkRegion</link>;
<link linkend="GdkRegion">GdkRegion</link>*  <link linkend="gdk-region-new">gdk_region_new</link>                  (void);
<link linkend="GdkRegion">GdkRegion</link>*  <link linkend="gdk-region-polygon">gdk_region_polygon</link>              (<link linkend="GdkPoint">GdkPoint</link> *points,
                                             <link linkend="gint">gint</link> npoints,
                                             <link linkend="GdkFillRule">GdkFillRule</link> fill_rule);
enum        <link linkend="GdkFillRule">GdkFillRule</link>;
<link linkend="GdkRegion">GdkRegion</link>*  <link linkend="gdk-region-copy">gdk_region_copy</link>                 (<link linkend="GdkRegion">GdkRegion</link> *region);
<link linkend="GdkRegion">GdkRegion</link>*  <link linkend="gdk-region-rectangle">gdk_region_rectangle</link>            (<link linkend="GdkRectangle">GdkRectangle</link> *rectangle);
void        <link linkend="gdk-region-destroy">gdk_region_destroy</link>              (<link linkend="GdkRegion">GdkRegion</link> *region);

void        <link linkend="gdk-region-get-clipbox">gdk_region_get_clipbox</link>          (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *rectangle);
void        <link linkend="gdk-region-get-rectangles">gdk_region_get_rectangles</link>       (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> **rectangles,
                                             <link linkend="gint">gint</link> *n_rectangles);
<link linkend="gboolean">gboolean</link>    <link linkend="gdk-region-empty">gdk_region_empty</link>                (<link linkend="GdkRegion">GdkRegion</link> *region);
<link linkend="gboolean">gboolean</link>    <link linkend="gdk-region-equal">gdk_region_equal</link>                (<link linkend="GdkRegion">GdkRegion</link> *region1,
                                             <link linkend="GdkRegion">GdkRegion</link> *region2);
<link linkend="gboolean">gboolean</link>    <link linkend="gdk-region-point-in">gdk_region_point_in</link>             (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             int x,
                                             int y);
<link linkend="GdkOverlapType">GdkOverlapType</link> <link linkend="gdk-region-rect-in">gdk_region_rect_in</link>           (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *rect);
enum        <link linkend="GdkOverlapType">GdkOverlapType</link>;

void        <link linkend="gdk-region-offset">gdk_region_offset</link>               (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="gint">gint</link> dx,
                                             <link linkend="gint">gint</link> dy);
void        <link linkend="gdk-region-shrink">gdk_region_shrink</link>               (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="gint">gint</link> dx,
                                             <link linkend="gint">gint</link> dy);
void        <link linkend="gdk-region-union-with-rect">gdk_region_union_with_rect</link>      (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *rect);
void        <link linkend="gdk-region-intersect">gdk_region_intersect</link>            (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);
void        <link linkend="gdk-region-union">gdk_region_union</link>                (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);
void        <link linkend="gdk-region-subtract">gdk_region_subtract</link>             (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);
void        <link linkend="gdk-region-xor">gdk_region_xor</link>                  (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);

struct      <link linkend="GdkSpan">GdkSpan</link>;
void        (<link linkend="GdkSpanFunc">*GdkSpanFunc</link>)                  (<link linkend="GdkSpan">GdkSpan</link> *span,
                                             <link linkend="gpointer">gpointer</link> data);
void        <link linkend="gdk-region-spans-intersect-foreach">gdk_region_spans_intersect_foreach</link>
                                            (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkSpan">GdkSpan</link> *spans,
                                             int n_spans,
                                             <link linkend="gboolean">gboolean</link> sorted,
                                             <link linkend="GdkSpanFunc">GdkSpanFunc</link> function,
                                             <link linkend="gpointer">gpointer</link> data);


</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
<para>
GDK provides the <link linkend="GdkPoint">GdkPoint</link>, <link linkend="GdkRectangle">GdkRectangle</link>, <link linkend="GdkRegion">GdkRegion</link> and <link linkend="GdkSpan">GdkSpan</link> data types
for representing pixels and sets of pixels on the screen.
</para>
<para>
<link linkend="GdkPoint">GdkPoint</link> is a simple structure containing an x and y coordinate of a point.
</para>
<para>
<link linkend="GdkRectangle">GdkRectangle</link> is a structure holding the position and size of a rectangle.
The intersection of two rectangles can be computed with
<link linkend="gdk-rectangle-intersect">gdk_rectangle_intersect</link>(). To find the union of two rectangles use
<link linkend="gdk-rectangle-union">gdk_rectangle_union</link>().
</para>
<para>
<link linkend="GdkRegion">GdkRegion</link> is an opaque data type holding a set of arbitrary pixels, and is
usually used for clipping graphical operations (see <link linkend="gdk-gc-set-clip-region">gdk_gc_set_clip_region</link>()).
</para>
<para>
<link linkend="GdkSpan">GdkSpan</link> 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 <link linkend="gdk-region-spans-intersect-foreach">gdk_region_spans_intersect_foreach</link>().
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GdkPoint">struct GdkPoint</title>
<programlisting>struct GdkPoint
{
  gint x;
  gint y;
};
</programlisting>
<para>
Defines the x and y coordinates of a point.
</para><informaltable pgwide="1" frame="none" role="struct">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><link linkend="gint">gint</link> <structfield>x</structfield></entry>
<entry>the x coordinate of the point.
</entry>
</row>
<row>
<entry><link linkend="gint">gint</link> <structfield>y</structfield></entry>
<entry>the y coordinate of the point.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkRectangle">struct GdkRectangle</title>
<programlisting>struct GdkRectangle
{
  gint x;
  gint y;
  gint width;
  gint height;
};
</programlisting>
<para>
Defines the position and size of a rectangle.
</para><informaltable pgwide="1" frame="none" role="struct">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><link linkend="gint">gint</link> <structfield>x</structfield></entry>
<entry>the x coordinate of the left edge of the rectangle.
</entry>
</row>
<row>
<entry><link linkend="gint">gint</link> <structfield>y</structfield></entry>
<entry>the y coordinate of the top of the rectangle.
</entry>
</row>
<row>
<entry><link linkend="gint">gint</link> <structfield>width</structfield></entry>
<entry>the width of the rectangle.
</entry>
</row>
<row>
<entry><link linkend="gint">gint</link> <structfield>height</structfield></entry>
<entry>the height of the rectangle.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-rectangle-intersect">gdk_rectangle_intersect ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gdk_rectangle_intersect         (<link linkend="GdkRectangle">GdkRectangle</link> *src1,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *src2,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *dest);</programlisting>
<para>
Calculates the intersection of two rectangles.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>src1</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRectangle">GdkRectangle</link>.
</entry></row>
<row><entry align="right"><parameter>src2</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRectangle">GdkRectangle</link>.
</entry></row>
<row><entry align="right"><parameter>dest</parameter>&nbsp;:</entry>
<entry>the intersection of <parameter>src1</parameter> and <parameter>src2</parameter>.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the rectangles intersect.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-rectangle-union">gdk_rectangle_union ()</title>
<programlisting>void        gdk_rectangle_union             (<link linkend="GdkRectangle">GdkRectangle</link> *src1,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *src2,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *dest);</programlisting>
<para>
Calculates the union of two rectangles.
The union of rectangles <parameter>src1</parameter> and <parameter>src2</parameter> is the smallest rectangle which
includes both <parameter>src1</parameter> and <parameter>src2</parameter> within it.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>src1</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRectangle">GdkRectangle</link>.
</entry></row>
<row><entry align="right"><parameter>src2</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRectangle">GdkRectangle</link>.
</entry></row>
<row><entry align="right"><parameter>dest</parameter>&nbsp;:</entry>
<entry>the union of <parameter>src1</parameter> and <parameter>src2</parameter>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkRegion">struct GdkRegion</title>
<programlisting>struct GdkRegion;</programlisting>
<para>
A GdkRegion represents a set of pixels on the screen.
The only user-visible field of the structure is the user_data member, which
can be used to attach arbitrary data to the <link linkend="GdkRegion">GdkRegion</link>.
</para></refsect2>
<refsect2>
<title><anchor id="gdk-region-new">gdk_region_new ()</title>
<programlisting><link linkend="GdkRegion">GdkRegion</link>*  gdk_region_new                  (void);</programlisting>
<para>
Creates a new empty <link linkend="GdkRegion">GdkRegion</link>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a new empty <link linkend="GdkRegion">GdkRegion</link>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-polygon">gdk_region_polygon ()</title>
<programlisting><link linkend="GdkRegion">GdkRegion</link>*  gdk_region_polygon              (<link linkend="GdkPoint">GdkPoint</link> *points,
                                             <link linkend="gint">gint</link> npoints,
                                             <link linkend="GdkFillRule">GdkFillRule</link> fill_rule);</programlisting>
<para>
Creates a new <link linkend="GdkRegion">GdkRegion</link> using the polygon defined by a number of points.

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>points</parameter>&nbsp;:</entry>
<entry>an array of <link linkend="GdkPoint">GdkPoint</link> structs.
</entry></row>
<row><entry align="right"><parameter>npoints</parameter>&nbsp;:</entry>
<entry>the number of elements in the <parameter>points</parameter> array.
</entry></row>
<row><entry align="right"><parameter>fill_rule</parameter>&nbsp;:</entry>
<entry>specifies which pixels are included in the region when the polygon
overlaps itself.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a new <link linkend="GdkRegion">GdkRegion</link> based on the given polygon.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkFillRule">enum GdkFillRule</title>
<programlisting>typedef enum
{
  GDK_EVEN_ODD_RULE,
  GDK_WINDING_RULE
} GdkFillRule;
</programlisting>
<para>
The method for determining which pixels are included in a region, when
creating a <link linkend="GdkRegion">GdkRegion</link> from a polygon.
The fill rule is only relevant for polygons which overlap themselves.
</para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>GDK_EVEN_ODD_RULE</literal></entry>
<entry>areas which are overlapped an odd number of times are
included in the region, while areas overlapped an even number of times are not.
</entry>
</row>
<row>
<entry><literal>GDK_WINDING_RULE</literal></entry>
<entry>overlapping areas are always included.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-copy">gdk_region_copy ()</title>
<programlisting><link linkend="GdkRegion">GdkRegion</link>*  gdk_region_copy                 (<link linkend="GdkRegion">GdkRegion</link> *region);</programlisting>
<para>
Copies <parameter>region</parameter>, creating an identical new region.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a new region identical to <parameter>region</parameter>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-rectangle">gdk_region_rectangle ()</title>
<programlisting><link linkend="GdkRegion">GdkRegion</link>*  gdk_region_rectangle            (<link linkend="GdkRectangle">GdkRectangle</link> *rectangle);</programlisting>
<para>
Creates a new region containing the area <parameter>rectangle</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>rectangle</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkRectangle">GdkRectangle</link>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a new region
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-destroy">gdk_region_destroy ()</title>
<programlisting>void        gdk_region_destroy              (<link linkend="GdkRegion">GdkRegion</link> *region);</programlisting>
<para>
Destroys a <link linkend="GdkRegion">GdkRegion</link>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-get-clipbox">gdk_region_get_clipbox ()</title>
<programlisting>void        gdk_region_get_clipbox          (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *rectangle);</programlisting>
<para>
Returns the smallest rectangle which includes the entire <link linkend="GdkRegion">GdkRegion</link>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>rectangle</parameter>&nbsp;:</entry>
<entry>returns the smallest rectangle which includes all of <parameter>region</parameter>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-get-rectangles">gdk_region_get_rectangles ()</title>
<programlisting>void        gdk_region_get_rectangles       (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> **rectangles,
                                             <link linkend="gint">gint</link> *n_rectangles);</programlisting>
<para>
Obtains the area covered by the region as a list of rectangles.
The array returned in <parameter>rectangles</parameter> must be freed with <link linkend="g-free">g_free</link>().</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
<row><entry align="right"><parameter>rectangles</parameter>&nbsp;:</entry>
<entry> return location for an array of rectangles
</entry></row>
<row><entry align="right"><parameter>n_rectangles</parameter>&nbsp;:</entry>
<entry> length of returned array
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-empty">gdk_region_empty ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gdk_region_empty                (<link linkend="GdkRegion">GdkRegion</link> *region);</programlisting>
<para>
Returns <literal>TRUE</literal> if the <link linkend="GdkRegion">GdkRegion</link> is empty.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>region</parameter> is empty.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-equal">gdk_region_equal ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gdk_region_equal                (<link linkend="GdkRegion">GdkRegion</link> *region1,
                                             <link linkend="GdkRegion">GdkRegion</link> *region2);</programlisting>
<para>
Returns <literal>TRUE</literal> if the two regions are the same.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region1</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>region2</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>region1</parameter> and <parameter>region2</parameter> are equal.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-point-in">gdk_region_point_in ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gdk_region_point_in             (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             int x,
                                             int y);</programlisting>
<para>
Returns <literal>TRUE</literal> if a point is in a region.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>x</parameter>&nbsp;:</entry>
<entry>the x coordinate of a point.
</entry></row>
<row><entry align="right"><parameter>y</parameter>&nbsp;:</entry>
<entry>the y coordinate of a point.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the point is in <parameter>region</parameter>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-rect-in">gdk_region_rect_in ()</title>
<programlisting><link linkend="GdkOverlapType">GdkOverlapType</link> gdk_region_rect_in           (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *rect);</programlisting>
<para>
Tests whether a rectangle is within a region.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>rect</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRectangle">GdkRectangle</link>.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>GDK_OVERLAP_RECTANGLE_IN</literal>, <literal>GDK_OVERLAP_RECTANGLE_OUT</literal>, or
<literal>GDK_OVERLAP_RECTANGLE_PART</literal>, depending on whether the rectangle is inside,
outside, or partly inside the <link linkend="GdkRegion">GdkRegion</link>, respectively.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkOverlapType">enum GdkOverlapType</title>
<programlisting>typedef enum
{
  GDK_OVERLAP_RECTANGLE_IN,
  GDK_OVERLAP_RECTANGLE_OUT,
  GDK_OVERLAP_RECTANGLE_PART
} GdkOverlapType;
</programlisting>
<para>
Specifies the possible values returned by <link linkend="gdk-region-rect-in">gdk_region_rect_in</link>().
</para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>GDK_OVERLAP_RECTANGLE_IN</literal></entry>
<entry>if the rectangle is inside the <link linkend="GdkRegion">GdkRegion</link>.
</entry>
</row>
<row>
<entry><literal>GDK_OVERLAP_RECTANGLE_OUT</literal></entry>
<entry>if the rectangle is outside the <link linkend="GdkRegion">GdkRegion</link>.
</entry>
</row>
<row>
<entry><literal>GDK_OVERLAP_RECTANGLE_PART</literal></entry>
<entry>if the rectangle is partly inside the <link linkend="GdkRegion">GdkRegion</link>.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-offset">gdk_region_offset ()</title>
<programlisting>void        gdk_region_offset               (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="gint">gint</link> dx,
                                             <link linkend="gint">gint</link> dy);</programlisting>
<para>
Moves a region the specified distance.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>dx</parameter>&nbsp;:</entry>
<entry>the distance to move the region horizontally.
</entry></row>
<row><entry align="right"><parameter>dy</parameter>&nbsp;:</entry>
<entry>the distance to move the region vertically.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-shrink">gdk_region_shrink ()</title>
<programlisting>void        gdk_region_shrink               (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="gint">gint</link> dx,
                                             <link linkend="gint">gint</link> dy);</programlisting>
<para>
Resizes a region by the specified amount.
Positive values shrink the region. Negative values expand it.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>dx</parameter>&nbsp;:</entry>
<entry>the number of pixels to shrink the region horizontally.
</entry></row>
<row><entry align="right"><parameter>dy</parameter>&nbsp;:</entry>
<entry>the number of pixels to shrink the region vertically.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-union-with-rect">gdk_region_union_with_rect ()</title>
<programlisting>void        gdk_region_union_with_rect      (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *rect);</programlisting>
<para>
Sets the area of <parameter>region</parameter> to the union of the areas of <parameter>region</parameter> and
<parameter>rect</parameter>. The resulting area is the set of pixels contained in
either <parameter>region</parameter> or <parameter>rect</parameter>.

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>rect</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRectangle">GdkRectangle</link>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-intersect">gdk_region_intersect ()</title>
<programlisting>void        gdk_region_intersect            (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);</programlisting>
<para>
Converts <parameter>source1</parameter> into the intersection between <parameter>source1</parameter> and <parameter>source2</parameter>.
That is, after calling this function <parameter>source2</parameter> will be unchanged and
<parameter>source1</parameter> will be the areas the two regions have in common.</para>
<para>
Sets the area of <parameter>source1</parameter> to the intersection of the areas of <parameter>source1</parameter>
and <parameter>source2</parameter>. The resulting area is the set of pixels contained in
both <parameter>source1</parameter> and <parameter>source2</parameter>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>source1</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
<row><entry align="right"><parameter>source2</parameter>&nbsp;:</entry>
<entry> another <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-union">gdk_region_union ()</title>
<programlisting>void        gdk_region_union                (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);</programlisting>
<para>
Sets the area of <parameter>source1</parameter> to the union of the areas of <parameter>source1</parameter> and
<parameter>source2</parameter>. The resulting area is the set of pixels contained in
either <parameter>source1</parameter> or <parameter>source2</parameter>.

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>source1</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
<row><entry align="right"><parameter>source2</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-subtract">gdk_region_subtract ()</title>
<programlisting>void        gdk_region_subtract             (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);</programlisting>
<para>
Subtracts any area in <parameter>source2</parameter> from the area in <parameter>source1</parameter>.</para>
<para>
Subtracts the area of <parameter>source2</parameter> from the area <parameter>source1</parameter>. The resulting
area is the set of pixels contained in <parameter>source1</parameter> but not in <parameter>source2</parameter>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>source1</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
<row><entry align="right"><parameter>source2</parameter>&nbsp;:</entry>
<entry> another <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-xor">gdk_region_xor ()</title>
<programlisting>void        gdk_region_xor                  (<link linkend="GdkRegion">GdkRegion</link> *source1,
                                             <link linkend="GdkRegion">GdkRegion</link> *source2);</programlisting>
<para>
XORs the two regions, placing the result in <parameter>source1</parameter>.  The XOR of two
regions contains all areas which were not overlapping.  That is,
it's the union of the regions minus the intersection of the
regions.</para>
<para>
Sets the area of <parameter>source1</parameter> to the exclusive-OR of the areas of <parameter>source1</parameter>
and <parameter>source2</parameter>. The resulting area is the set of pixels contained in one
or the other of the two sources but not in both.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>source1</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
<row><entry align="right"><parameter>source2</parameter>&nbsp;:</entry>
<entry> another <link linkend="GdkRegion">GdkRegion</link>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkSpan">struct GdkSpan</title>
<programlisting>struct GdkSpan
{
  gint x;
  gint y;
  gint width;
};
</programlisting>
<para>
A GdkSpan represents a horizontal line of pixels starting
at the pixel with coordinates <parameter>x</parameter>, <parameter>y</parameter> and ending before <parameter>x</parameter> + <parameter>width</parameter>, <parameter>y</parameter>.
</para><informaltable pgwide="1" frame="none" role="struct">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><link linkend="gint">gint</link> <structfield>x</structfield></entry>
<entry>x coordinate of the first pixel.
</entry>
</row>
<row>
<entry><link linkend="gint">gint</link> <structfield>y</structfield></entry>
<entry>y coordinate of the first pixel.
</entry>
</row>
<row>
<entry><link linkend="gint">gint</link> <structfield>width</structfield></entry>
<entry>number of pixels in the span.

</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GdkSpanFunc">GdkSpanFunc ()</title>
<programlisting>void        (*GdkSpanFunc)                  (<link linkend="GdkSpan">GdkSpan</link> *span,
                                             <link linkend="gpointer">gpointer</link> data);</programlisting>
<para>
This defines the type of the function passed to 
<link linkend="gdk-region-spans-intersect-foreach">gdk_region_spans_intersect_foreach</link>(). 
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>span</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkSpan">GdkSpan</link>.
</entry></row>
<row><entry align="right"><parameter>data</parameter>&nbsp;:</entry>
<entry>the user data passed to <link linkend="gdk-region-spans-intersect-foreach">gdk_region_spans_intersect_foreach</link>().


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gdk-region-spans-intersect-foreach">gdk_region_spans_intersect_foreach ()</title>
<programlisting>void        gdk_region_spans_intersect_foreach
                                            (<link linkend="GdkRegion">GdkRegion</link> *region,
                                             <link linkend="GdkSpan">GdkSpan</link> *spans,
                                             int n_spans,
                                             <link linkend="gboolean">gboolean</link> sorted,
                                             <link linkend="GdkSpanFunc">GdkSpanFunc</link> function,
                                             <link linkend="gpointer">gpointer</link> data);</programlisting>
<para>
Calls a function on each span in the intersection of <parameter>region</parameter> and
<parameter>spans</parameter>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>region</parameter>&nbsp;:</entry>
<entry>a <link linkend="GdkRegion">GdkRegion</link>.
</entry></row>
<row><entry align="right"><parameter>spans</parameter>&nbsp;:</entry>
<entry>an array of <link linkend="GdkSpans">GdkSpans</link>.
</entry></row>
<row><entry align="right"><parameter>n_spans</parameter>&nbsp;:</entry>
<entry>the length of <parameter>spans</parameter>.
</entry></row>
<row><entry align="right"><parameter>sorted</parameter>&nbsp;:</entry>
<entry><literal>TRUE</literal> if <parameter>spans</parameter> is sorted wrt. the y coordinate.
</entry></row>
<row><entry align="right"><parameter>function</parameter>&nbsp;:</entry>
<entry>function to call on each span in the intersection.
</entry></row>
<row><entry align="right"><parameter>data</parameter>&nbsp;:</entry>
<entry>data to pass to <parameter>function</parameter>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>
