1 /* GDK - The GIMP Drawing Kit 2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library 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 GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Boston, MA 02111-1307, USA. 18 */ 19 20 /* 21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS 22 * file for a list of people on the GTK+ Team. See the ChangeLog 23 * files for a list of changes. These files are distributed with 24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 25 */ 26 27 #ifndef __GDK_REGION_H__ 28 #define __GDK_REGION_H__ 29 30 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION) 31 #error "Only <gdk/gdk.h> can be included directly." 32 #endif 33 34 #include <gdk/gdktypes.h> 35 36 G_BEGIN_DECLS 37 38 #ifndef GDK_DISABLE_DEPRECATED 39 /* GC fill rule for polygons 40 * EvenOddRule 41 * WindingRule 42 */ 43 typedef enum 44 { 45 GDK_EVEN_ODD_RULE, 46 GDK_WINDING_RULE 47 } GdkFillRule; 48 #endif 49 50 /* Types of overlapping between a rectangle and a region 51 * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region 52 * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region 53 * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region 54 */ 55 typedef enum 56 { 57 GDK_OVERLAP_RECTANGLE_IN, 58 GDK_OVERLAP_RECTANGLE_OUT, 59 GDK_OVERLAP_RECTANGLE_PART 60 } GdkOverlapType; 61 62 #ifndef GDK_DISABLE_DEPRECATED 63 typedef void (* GdkSpanFunc) (GdkSpan *span, 64 gpointer data); 65 #endif 66 67 GdkRegion * gdk_region_new (void); 68 #ifndef GDK_DISABLE_DEPRECATED 69 GdkRegion * gdk_region_polygon (const GdkPoint *points, 70 gint n_points, 71 GdkFillRule fill_rule); 72 #endif 73 GdkRegion * gdk_region_copy (const GdkRegion *region); 74 GdkRegion * gdk_region_rectangle (const GdkRectangle *rectangle); 75 void gdk_region_destroy (GdkRegion *region); 76 77 void gdk_region_get_clipbox (const GdkRegion *region, 78 GdkRectangle *rectangle); 79 void gdk_region_get_rectangles (const GdkRegion *region, 80 GdkRectangle **rectangles, 81 gint *n_rectangles); 82 83 gboolean gdk_region_empty (const GdkRegion *region); 84 gboolean gdk_region_equal (const GdkRegion *region1, 85 const GdkRegion *region2); 86 #ifndef GDK_DISABLE_DEPRECATED 87 gboolean gdk_region_rect_equal (const GdkRegion *region, 88 const GdkRectangle *rectangle); 89 #endif 90 gboolean gdk_region_point_in (const GdkRegion *region, 91 int x, 92 int y); 93 GdkOverlapType gdk_region_rect_in (const GdkRegion *region, 94 const GdkRectangle *rectangle); 95 96 void gdk_region_offset (GdkRegion *region, 97 gint dx, 98 gint dy); 99 #ifndef GDK_DISABLE_DEPRECATED 100 void gdk_region_shrink (GdkRegion *region, 101 gint dx, 102 gint dy); 103 #endif 104 void gdk_region_union_with_rect (GdkRegion *region, 105 const GdkRectangle *rect); 106 void gdk_region_intersect (GdkRegion *source1, 107 const GdkRegion *source2); 108 void gdk_region_union (GdkRegion *source1, 109 const GdkRegion *source2); 110 void gdk_region_subtract (GdkRegion *source1, 111 const GdkRegion *source2); 112 void gdk_region_xor (GdkRegion *source1, 113 const GdkRegion *source2); 114 115 #ifndef GDK_DISABLE_DEPRECATED 116 void gdk_region_spans_intersect_foreach (GdkRegion *region, 117 const GdkSpan *spans, 118 int n_spans, 119 gboolean sorted, 120 GdkSpanFunc function, 121 gpointer data); 122 #endif 123 124 G_END_DECLS 125 126 #endif /* __GDK_REGION_H__ */ 127 128