2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
47 * - GdkRectangle* -> Rectangle
48 * - GdkRegion* -> Region
54 private import gdk
.gdktypes
;
56 private import lib
.gdk
;
58 private import gdk
.Region
;
59 private import gdk
.Rectangle
;
63 * GDK provides the GdkPoint, GdkRectangle, GdkRegion and GdkSpan data types
64 * for representing pixels and sets of pixels on the screen.
65 * GdkPoint is a simple structure containing an x and y coordinate of a point.
66 * GdkRectangle is a structure holding the position and size of a rectangle.
67 * The intersection of two rectangles can be computed with
68 * gdk_rectangle_intersect(). To find the union of two rectangles use
69 * gdk_rectangle_union().
70 * GdkRegion is an opaque data type holding a set of arbitrary pixels, and is
71 * usually used for clipping graphical operations (see gdk_gc_set_clip_region()).
72 * GdkSpan is a structure holding a spanline. A spanline is a horizontal line that
73 * is one pixel wide. It is mainly used when rasterizing other graphics primitives.
74 * It can be intersected to regions by using gdk_region_spans_intersect_foreach().
79 /** the main Gtk struct */
80 protected GdkRegion
* gdkRegion
;
83 public GdkRegion
* getRegionStruct()
89 /** the main Gtk struct as a void* */
90 protected void* getStruct()
92 return cast(void*)gdkRegion
;
96 * Sets our main struct and passes it to the parent class
98 public this (GdkRegion
* gdkRegion
)
100 this.gdkRegion
= gdkRegion
;
112 * Creates a new empty GdkRegion.
114 * a new empty GdkRegion
118 // GdkRegion* gdk_region_new (void);
119 this(cast(GdkRegion
*)gdk_region_new() );
123 * Creates a new GdkRegion using the polygon defined by a
126 * an array of GdkPoint structs
128 * the number of elements in the points array
130 * specifies which pixels are included in the region when the
131 * polygon overlaps itself.
133 * a new GdkRegion based on the given polygon
135 public static Region
polygon(GdkPoint
* points
, int npoints
, GdkFillRule fillRule
)
137 // GdkRegion* gdk_region_polygon (GdkPoint *points, gint npoints, GdkFillRule fill_rule);
138 return new Region( gdk_region_polygon(points
, npoints
, fillRule
) );
143 * Copies region, creating an identical new region.
147 * a new region identical to region
151 // GdkRegion* gdk_region_copy (GdkRegion *region);
152 return new Region( gdk_region_copy(gdkRegion
) );
156 * Creates a new region containing the area rectangle.
162 public static Region
rectangle(Rectangle rectangle
)
164 // GdkRegion* gdk_region_rectangle (GdkRectangle *rectangle);
165 return new Region( gdk_region_rectangle((rectangle
is null) ?
null : rectangle
.getRectangleStruct()) );
169 * Destroys a GdkRegion.
173 public void destroy()
175 // void gdk_region_destroy (GdkRegion *region);
176 gdk_region_destroy(gdkRegion
);
180 * Obtains the smallest rectangle which includes the entire GdkRegion.
184 * return location for the clipbox
186 public void getClipbox(Rectangle rectangle
)
188 // void gdk_region_get_clipbox (GdkRegion *region, GdkRectangle *rectangle);
189 gdk_region_get_clipbox(gdkRegion
, (rectangle
is null) ?
null : rectangle
.getRectangleStruct());
193 * Obtains the area covered by the region as a list of rectangles.
194 * The array returned in rectangles must be freed with g_free().
198 * return location for an array of rectangles
200 * length of returned array
202 public void getRectangles(GdkRectangle
** rectangles
, int* nRectangles
)
204 // void gdk_region_get_rectangles (GdkRegion *region, GdkRectangle **rectangles, gint *n_rectangles);
205 gdk_region_get_rectangles(gdkRegion
, rectangles
, nRectangles
);
209 * Finds out if the GdkRegion is empty.
213 * TRUE if region is empty.
217 // gboolean gdk_region_empty (GdkRegion *region);
218 return gdk_region_empty(gdkRegion
);
222 * Finds out if the two regions are the same.
228 * TRUE if region1 and region2 are equal.
230 public int equal(Region region2
)
232 // gboolean gdk_region_equal (GdkRegion *region1, GdkRegion *region2);
233 return gdk_region_equal(gdkRegion
, (region2
is null) ?
null : region2
.getRegionStruct());
237 * Finds out if a point is in a region.
241 * the x coordinate of a point
243 * the y coordinate of a point
245 * TRUE if the point is in region.
247 public int pointIn(int x
, int y
)
249 // gboolean gdk_region_point_in (GdkRegion *region, int x, int y);
250 return gdk_region_point_in(gdkRegion
, x
, y
);
254 * Tests whether a rectangle is within a region.
260 * GDK_OVERLAP_RECTANGLE_IN, GDK_OVERLAP_RECTANGLE_OUT, or
261 * GDK_OVERLAP_RECTANGLE_PART, depending on whether the rectangle is inside,
262 * outside, or partly inside the GdkRegion, respectively.
264 public GdkOverlapType
rectIn(Rectangle rectangle
)
266 // GdkOverlapType gdk_region_rect_in (GdkRegion *region, GdkRectangle *rectangle);
267 return gdk_region_rect_in(gdkRegion
, (rectangle
is null) ?
null : rectangle
.getRectangleStruct());
272 * Moves a region the specified distance.
276 * the distance to move the region horizontally
278 * the distance to move the region vertically
280 public void offset(int dx
, int dy
)
282 // void gdk_region_offset (GdkRegion *region, gint dx, gint dy);
283 gdk_region_offset(gdkRegion
, dx
, dy
);
287 * Resizes a region by the specified amount.
288 * Positive values shrink the region. Negative values expand it.
292 * the number of pixels to shrink the region horizontally
294 * the number of pixels to shrink the region vertically
296 public void shrink(int dx
, int dy
)
298 // void gdk_region_shrink (GdkRegion *region, gint dx, gint dy);
299 gdk_region_shrink(gdkRegion
, dx
, dy
);
303 * Sets the area of region to the union of the areas of region and
304 * rect. The resulting area is the set of pixels contained in
305 * either region or rect.
311 public void unionWithRect(Rectangle rect
)
313 // void gdk_region_union_with_rect (GdkRegion *region, GdkRectangle *rect);
314 gdk_region_union_with_rect(gdkRegion
, (rect
is null) ?
null : rect
.getRectangleStruct());
318 * Sets the area of source1 to the intersection of the areas of source1
319 * and source2. The resulting area is the set of pixels contained in
320 * both source1 and source2.
326 public void intersect(Region source2
)
328 // void gdk_region_intersect (GdkRegion *source1, GdkRegion *source2);
329 gdk_region_intersect(gdkRegion
, (source2
is null) ?
null : source2
.getRegionStruct());
333 * Sets the area of source1 to the union of the areas of source1 and
334 * source2. The resulting area is the set of pixels contained in
335 * either source1 or source2.
341 public void unio(Region source2
)
343 // void gdk_region_union (GdkRegion *source1, GdkRegion *source2);
344 gdk_region_union(gdkRegion
, (source2
is null) ?
null : source2
.getRegionStruct());
348 * Subtracts the area of source2 from the area source1. The resulting
349 * area is the set of pixels contained in source1 but not in source2.
355 public void subtract(Region source2
)
357 // void gdk_region_subtract (GdkRegion *source1, GdkRegion *source2);
358 gdk_region_subtract(gdkRegion
, (source2
is null) ?
null : source2
.getRegionStruct());
362 * Sets the area of source1 to the exclusive-OR of the areas of source1
363 * and source2. The resulting area is the set of pixels contained in one
364 * or the other of the two sources but not in both.
370 public void xor(Region source2
)
372 // void gdk_region_xor (GdkRegion *source1, GdkRegion *source2);
373 gdk_region_xor(gdkRegion
, (source2
is null) ?
null : source2
.getRegionStruct());
379 * Calls a function on each span in the intersection of region and spans.
383 * an array of GdkSpans
385 * the length of spans
387 * TRUE if spans is sorted wrt. the y coordinate
389 * function to call on each span in the intersection
391 * data to pass to function
393 public void spansIntersectForeach(GdkSpan
* spans
, int nSpans
, int sorted
, GdkSpanFunc funct
, void* data
)
395 // void gdk_region_spans_intersect_foreach (GdkRegion *region, GdkSpan *spans, int n_spans, gboolean sorted, GdkSpanFunc function, gpointer data);
396 gdk_region_spans_intersect_foreach(gdkRegion
, spans
, nSpans
, sorted
, funct
, data
);