]> Pileus Git - ~andy/gtk/blob - gdk/gdkregion.h
gdk/gdk.h gdk/gdkcairo.h gdk/gdkcolor.h gdk/gdkgc.h gdk/gdkinternals.h
[~andy/gtk] / gdk / gdkregion.h
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 #include <gdk/gdktypes.h>
31
32 G_BEGIN_DECLS
33
34 /* GC fill rule for polygons
35  *  EvenOddRule
36  *  WindingRule
37  */
38 typedef enum
39 {
40   GDK_EVEN_ODD_RULE,
41   GDK_WINDING_RULE
42 } GdkFillRule;
43
44 /* Types of overlapping between a rectangle and a region
45  * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region
46  * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region
47  * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region
48  */
49 typedef enum
50 {
51   GDK_OVERLAP_RECTANGLE_IN,
52   GDK_OVERLAP_RECTANGLE_OUT,
53   GDK_OVERLAP_RECTANGLE_PART
54 } GdkOverlapType;
55
56 typedef void (* GdkSpanFunc) (GdkSpan *span,
57                               gpointer data);
58
59 GdkRegion    * gdk_region_new             (void);
60 GdkRegion    * gdk_region_polygon         (const GdkPoint     *points,
61                                            gint                n_points,
62                                            GdkFillRule         fill_rule);
63 GdkRegion    * gdk_region_copy            (const GdkRegion    *region);
64 GdkRegion    * gdk_region_rectangle       (const GdkRectangle *rectangle);
65 void           gdk_region_destroy         (GdkRegion          *region);
66
67 void           gdk_region_get_clipbox     (const GdkRegion    *region,
68                                            GdkRectangle       *rectangle);
69 void           gdk_region_get_rectangles  (const GdkRegion    *region,
70                                            GdkRectangle      **rectangles,
71                                            gint               *n_rectangles);
72
73 gboolean       gdk_region_empty           (const GdkRegion    *region);
74 gboolean       gdk_region_equal           (const GdkRegion    *region1,
75                                            const GdkRegion    *region2);
76 gboolean       gdk_region_point_in        (const GdkRegion    *region,
77                                            int                 x,
78                                            int                 y);
79 GdkOverlapType gdk_region_rect_in         (const GdkRegion    *region,
80                                            const GdkRectangle *rectangle);
81
82 void           gdk_region_offset          (GdkRegion          *region,
83                                            gint                dx,
84                                            gint                dy);
85 void           gdk_region_shrink          (GdkRegion          *region,
86                                            gint                dx,
87                                            gint                dy);
88 void           gdk_region_union_with_rect (GdkRegion          *region,
89                                            const GdkRectangle *rect);
90 void           gdk_region_intersect       (GdkRegion          *source1,
91                                            const GdkRegion    *source2);
92 void           gdk_region_union           (GdkRegion          *source1,
93                                            const GdkRegion    *source2);
94 void           gdk_region_subtract        (GdkRegion          *source1,
95                                            const GdkRegion    *source2);
96 void           gdk_region_xor             (GdkRegion          *source1,
97                                            const GdkRegion    *source2);
98
99 void   gdk_region_spans_intersect_foreach (GdkRegion          *region,
100                                            GdkSpan            *spans,
101                                            int                 n_spans,
102                                            gboolean            sorted,
103                                            GdkSpanFunc         function,
104                                            gpointer            data);
105
106 G_END_DECLS
107
108 #endif /* __GDK_REGION_H__ */
109