Top |

## Description

GDK provides the GdkPoint and GdkRectangle data types for representing pixels and sets of pixels on the screen. Together with Cairo’s cairo_region_t data type, they make up the central types for representing graphical data.

A GdkPoint represents an x and y coordinate of a point.

A GdkRectangle represents 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()`

.

cairo_region_t is usually used for managing clipping of graphical operations.

## Functions

### 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
* dest*
to be the same as either

*or*

`src1`

*. If the rectangles do not intersect,*

`src2`

*’s width and height is set to 0 and its x and y values are undefined. If you are only interested in whether the rectangles intersect, but not in the intersecting area itself, pass*

`dest`

`NULL`

for *.*

`dest`

#### Parameters

src1 |
||

src2 |
||

dest |
return location for the
intersection of
, or `src2` `NULL` . |
[out caller-allocates][allow-none] |

### 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 * src1*
and

*is the smallest rectangle which includes both*

`src2`

*and*

`src1`

*within it. It is allowed for*

`src2`

*to be the same as either*

`dest`

*or*

`src1`

*.*

`src2`

Note that this function does not ignore 'empty' rectangles (ie. with zero width or height).

### gdk_rectangle_equal ()

gboolean gdk_rectangle_equal (,`const GdkRectangle *rect1`

);`const GdkRectangle *rect2`

Checks if the two given rectangles are equal.

Since: 3.20

## Types and Values

### GdkRectangle

typedef struct { int x, y; int width, height; } GdkRectangle;

Defines the position and size of a rectangle. It is identical to cairo_rectangle_int_t.