1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gdk.Rectangle;
26 
27 private import gdk.c.functions;
28 public  import gdk.c.types;
29 
30 
31 /**
32  * A `GdkRectangle` data type for representing rectangles.
33  * 
34  * `GdkRectangle` is identical to `cairo_rectangle_t`. Together with Cairo’s
35  * `cairo_region_t` data type, these are the central types for representing
36  * sets of pixels.
37  * 
38  * The intersection of two rectangles can be computed with
39  * [method@Gdk.Rectangle.intersect]; to find the union of two rectangles use
40  * [method@Gdk.Rectangle.union].
41  * 
42  * The `cairo_region_t` type provided by Cairo is usually used for managing
43  * non-rectangular clipping of graphical operations.
44  * 
45  * The Graphene library has a number of other data types for regions and
46  * volumes in 2D and 3D.
47  */
48 
49 /** */
50 public GType gdkRectangleGetType()
51 {
52 	return gdk_rectangle_get_type();
53 }
54 
55 /**
56  * Returns #TRUE if @rect contains the point described by @x and @y.
57  *
58  * Params:
59  *     x = X coordinate
60  *     y = Y coordinate
61  *
62  * Returns: #TRUE if @rect contains the point
63  */
64 public bool containsPoint(GdkRectangle* rect, int x, int y)
65 {
66 	return gdk_rectangle_contains_point(rect, x, y) != 0;
67 }
68 
69 /**
70  * Checks if the two given rectangles are equal.
71  *
72  * Params:
73  *     rect2 = a `GdkRectangle`
74  *
75  * Returns: %TRUE if the rectangles are equal.
76  */
77 public bool equal(GdkRectangle* rect1, GdkRectangle* rect2)
78 {
79 	return gdk_rectangle_equal(rect1, rect2) != 0;
80 }
81 
82 /**
83  * Calculates the intersection of two rectangles.
84  *
85  * It is allowed for @dest to be the same as either @src1 or @src2.
86  * If the rectangles do not intersect, @dest’s width and height is set
87  * to 0 and its x and y values are undefined. If you are only interested
88  * in whether the rectangles intersect, but not in the intersecting area
89  * itself, pass %NULL for @dest.
90  *
91  * Params:
92  *     src2 = a `GdkRectangle`
93  *     dest = return location for the
94  *         intersection of @src1 and @src2, or %NULL
95  *
96  * Returns: %TRUE if the rectangles intersect.
97  */
98 public bool intersect(GdkRectangle* src1, GdkRectangle* src2, out GdkRectangle dest)
99 {
100 	return gdk_rectangle_intersect(src1, src2, &dest) != 0;
101 }
102 
103 alias unio = union_;
104 /**
105  * Calculates the union of two rectangles.
106  *
107  * The union of rectangles @src1 and @src2 is the smallest rectangle which
108  * includes both @src1 and @src2 within it. It is allowed for @dest to be
109  * the same as either @src1 or @src2.
110  *
111  * Note that this function does not ignore 'empty' rectangles (ie. with
112  * zero width or height).
113  *
114  * Params:
115  *     src2 = a `GdkRectangle`
116  *     dest = return location for the union of @src1 and @src2
117  */
118 public void union_(GdkRectangle* src1, GdkRectangle* src2, out GdkRectangle dest)
119 {
120 	gdk_rectangle_union(src1, src2, &dest);
121 }