Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / rect.h
index ddd2605..cc21e1f 100644 (file)
@@ -2,19 +2,21 @@
 /*!    \file rect.h
 **     \brief Rectangle Class
 **
-**     $Id: rect.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 Chris Moore
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
@@ -50,6 +52,9 @@ public:
 
        static Rect full_plane();
 
+       static Rect horizontal_strip(const value_type &y1, const value_type &y2);
+       static Rect vertical_strip(const value_type &x1, const value_type &x2);
+
        static Rect zero()
        {
                return Rect(
@@ -67,16 +72,16 @@ public:
        Rect(const Point& min, const Point& max) { set_point(min); expand(max); }
 
        Rect(const value_type &x1,const value_type &y1) { set_point(x1,y1); }
-       
+
        Rect(const value_type &x1,const value_type &y1,
                        const value_type &x2,const value_type &y2)
        {
                set_point(x1,y1);
                expand(x2,y2);
        }
-               
+
        void set_point(const Point& max) { set_point(max[0],max[1]);    }
-       
+
        Rect& expand(const Point& max) { expand(max[0],max[1]); return *this; }
 
        Rect& expand(const Real& r) { minx-=r; miny-=r; maxx+=r; maxy+=r; return *this; }
@@ -84,21 +89,21 @@ public:
        Rect& expand_x(const Real& r) { minx-=r; maxx+=r; return *this; }
 
        Rect& expand_y(const Real& r) { miny-=r; maxy+=r; return *this; }
-       
+
        Rect& set(const Point& min,const Point& max) { set(min[0],min[1],max[0],max[1]); return *this; }
-       
+
        Point get_min()const { return Point(minx,miny); }
        Point get_max()const { return Point(maxx,maxy); }
-       
+
        bool is_inside(const Point& x) { return x[0]>minx && x[0]<maxx && x[1]>miny && x[1]<maxy; }
-               
+
        Real area()const
        {
                return (maxx-minx)*(maxy-miny);
        }
-       
+
        // Operators
-       
+
        Rect& operator+=(const Vector& rhs)
        {
                minx+=rhs[0]; miny+=rhs[1];
@@ -163,6 +168,10 @@ public:
 
        bool operator&&(const Rect& rhs)const { return etl::intersect(*this, rhs); }
 
+       bool operator==(const Rect &rhs)const { return get_min() == rhs.get_min() && get_max() == rhs.get_max(); }
+
+       bool operator!=(const Rect &rhs)const { return get_min() != rhs.get_min() || get_max() != rhs.get_max(); }
+
        bool is_valid()const { return valid(); }
 }; // END of class Rect