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  * Conversion parameters:
26  * inFile  = gdk-Points-Rectangles-and-Regions.html
27  * outPack = gdk
28  * outFile = Rectangle
29  * strct   = GdkRectangle
30  * realStrct=
31  * ctorStrct=
32  * clss    = Rectangle
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_rectangle_
41  * omit structs:
42  * omit prefixes:
43  * 	- gdk_region_
44  * omit code:
45  * omit signals:
46  * imports:
47  * structWrap:
48  * 	- GdkRectangle* -> Rectangle
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gdk.Rectangle;
55 
56 public  import gtkc.gdktypes;
57 
58 private import gtkc.gdk;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 
63 
64 
65 
66 
67 /**
68  * Description
69  * GDK provides the GdkPoint, GdkRectangle, GdkRegion and GdkSpan data types
70  * for representing pixels and sets of pixels on the screen.
71  * GdkPoint is a simple structure containing an x and y coordinate of a point.
72  * GdkRectangle is a structure holding the position and size of a rectangle.
73  * The intersection of two rectangles can be computed with
74  * gdk_rectangle_intersect(). To find the union of two rectangles use
75  * gdk_rectangle_union().
76  * GdkRegion is an opaque data type holding a set of arbitrary pixels, and is
77  * usually used for clipping graphical operations (see gdk_gc_set_clip_region()).
78  * GdkSpan is a structure holding a spanline. A spanline is a horizontal line that
79  * is one pixel wide. It is mainly used when rasterizing other graphics primitives.
80  * It can be intersected to regions by using gdk_region_spans_intersect_foreach().
81  */
82 public class Rectangle
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GdkRectangle* gdkRectangle;
87 	
88 	
89 	public GdkRectangle* getRectangleStruct()
90 	{
91 		return gdkRectangle;
92 	}
93 	
94 	
95 	/** the main Gtk struct as a void* */
96 	protected void* getStruct()
97 	{
98 		return cast(void*)gdkRectangle;
99 	}
100 	
101 	/**
102 	 * Sets our main struct and passes it to the parent class
103 	 */
104 	public this (GdkRectangle* gdkRectangle)
105 	{
106 		this.gdkRectangle = gdkRectangle;
107 	}
108 	
109 	/**
110 	 */
111 	
112 	/**
113 	 * Calculates the intersection of two rectangles. It is allowed for
114 	 * dest to be the same as either src1 or src2. If the rectangles
115 	 * do not intersect, dest's width and height is set to 0 and its x
116 	 * and y values are undefined. If you are only interested in whether
117 	 * the rectangles intersect, but not in the intersecting area itself,
118 	 * pass NULL for dest.
119 	 * Params:
120 	 * src2 = a GdkRectangle
121 	 * dest = return location for the
122 	 * intersection of src1 and src2, or NULL. [out caller-allocates][allow-none]
123 	 * Returns: TRUE if the rectangles intersect.
124 	 */
125 	public int intersect(Rectangle src2, Rectangle dest)
126 	{
127 		// gboolean gdk_rectangle_intersect (const GdkRectangle *src1,  const GdkRectangle *src2,  GdkRectangle *dest);
128 		return gdk_rectangle_intersect(gdkRectangle, (src2 is null) ? null : src2.getRectangleStruct(), (dest is null) ? null : dest.getRectangleStruct());
129 	}
130 	
131 	/**
132 	 * Calculates the union of two rectangles.
133 	 * The union of rectangles src1 and src2 is the smallest rectangle which
134 	 * includes both src1 and src2 within it.
135 	 * It is allowed for dest to be the same as either src1 or src2.
136 	 * Params:
137 	 * src2 = a GdkRectangle
138 	 * dest = return location for the union of src1 and src2. [out]
139 	 */
140 	public void unio(Rectangle src2, Rectangle dest)
141 	{
142 		// void gdk_rectangle_union (const GdkRectangle *src1,  const GdkRectangle *src2,  GdkRectangle *dest);
143 		gdk_rectangle_union(gdkRectangle, (src2 is null) ? null : src2.getRectangleStruct(), (dest is null) ? null : dest.getRectangleStruct());
144 	}
145 }