Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

region.h

Go to the documentation of this file.
00001 /*  Inti: Integrated Foundation Classes
00002  *  Copyright (C) 2002-2003 The Inti Development Team.
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018  
00024 
00025 #ifndef INTI_GDK_REGION_H
00026 #define INTI_GDK_REGION_H
00027 
00028 #ifndef INTI_OBJECT_H
00029 #include <inti/object.h>
00030 #endif
00031 
00032 #ifndef INTI_SLOT_H
00033 #include <inti/slot.h>
00034 #endif
00035 
00036 #ifndef __GDK_REGION_H__
00037 #include <gdk/gdkregion.h>
00038 #endif
00039 
00040 #ifndef _CPP_VECTOR
00041 #include <vector>
00042 #endif
00043 
00044 namespace Inti {
00045 
00046 namespace Gdk {
00047         
00048 class Rectangle;
00049 class Point;
00050 class Span;
00051 
00056 
00057 enum FillRule
00058 {
00059         EVEN_ODD_RULE = GDK_EVEN_ODD_RULE,
00062 
00063         WINDING_RULE = GDK_WINDING_RULE
00065 };
00066 
00069 
00070 enum OverlapType
00071 {
00072         OVERLAP_RECTANGLE_IN = GDK_OVERLAP_RECTANGLE_IN, 
00073         OVERLAP_RECTANGLE_OUT = GDK_OVERLAP_RECTANGLE_OUT, 
00074         OVERLAP_RECTANGLE_PART = GDK_OVERLAP_RECTANGLE_PART 
00075 };
00076 
00082 
00083 class Region : public ReferencedObject
00084 {
00085         GdkRegion *region_;
00086 
00087 public:
00088         typedef Slot1<void, GdkSpan*> SpansIntersectForeachSlot;
00098 
00101 
00102         Region();
00104 
00105         Region(const std::vector<Point>& points, FillRule fill_rule);
00109 
00110         Region(const Rectangle& rectangle);
00113 
00114         explicit Region(GdkRegion *region);
00119 
00120         Region(const Region& src);
00123 
00124         virtual ~Region();
00126 
00127         Region& operator=(const Region& src);
00130 
00134 
00135         GdkRegion* gdk_region() const { return region_; }
00137 
00138         operator GdkRegion* () const;
00140 
00141         Rectangle get_clipbox() const;
00144 
00145         void get_clipbox(Rectangle& rectangle) const;
00149 
00150         std::vector<Rectangle> get_rectangles() const;
00153 
00154         bool empty() const;
00156         
00157         bool equal(const Region& other) const;
00159         
00160         bool point_in(int x, int y) const;
00165 
00166         bool point_in(const Point& point) const;
00170 
00171         OverlapType rect_in(const Rectangle& rectangle) const;
00176 
00177         bool operator==(const Region& other) const;
00181 
00182         bool operator!=(const Region& other) const;
00186 
00190 
00191         void offset(int dx, int dy);
00195 
00196         void shrink(int dx, int dy);
00202 
00203         void union_with(const Rectangle& rectangle);
00208         
00209         void union_with(const Region& other);
00214         
00215         void intersect(const Region& other);
00220 
00221         void subtract(const Region& other);
00226         
00227         void xor_with(const Region& other);
00232 
00233         void spans_intersect_foreach(const std::vector<Span>& spans, bool sorted, const SpansIntersectForeachSlot *slot);
00238 
00240 };
00241 
00242 } // namespace Gdk
00243 
00244 } // namespace Inti
00245 
00246 #endif // INTI_GDK_REGION_H
00247 
Main Page - Footer


Generated on Sun Sep 14 20:08:03 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002