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