Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXRegion.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                      C l i p p i n g   R e g i o n                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,2004 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXRegion.h,v 1.11 2004/02/08 17:17:34 fox Exp $                           *
00023 ********************************************************************************/
00024 #ifndef FXREGION_H
00025 #define FXREGION_H
00026 
00027 namespace FX {
00028 
00029 /// Region
00030 class FXAPI FXRegion {
00031   friend class FXDC;
00032   friend class FXDCWindow;
00033 private:
00034   void *region;
00035 public:
00036 
00037   /// Construct new empty region
00038   FXRegion();
00039 
00040   /// Construct new region copied from region r
00041   FXRegion(const FXRegion& r);
00042 
00043   /// Construct rectangle region
00044   FXRegion(FXint x,FXint y,FXint w,FXint h);
00045 
00046   /// Construct polygon region
00047   FXRegion(const FXPoint* points,FXuint npoints,FXbool winding=FALSE);
00048 
00049   /// Assign region r to this one
00050   FXRegion &operator=(const FXRegion& r);
00051 
00052   /// Return TRUE if region is empty
00053   FXbool empty() const;
00054 
00055   /// Return TRUE if region contains point
00056   FXbool contains(FXint x,FXint y) const;
00057 
00058   /// Return TRUE if region contains rectangle
00059   FXbool contains(FXint x,FXint y,FXint w,FXint h) const;
00060 
00061   /// Return bounding box
00062   void bounds(FXRectangle& r) const;
00063 
00064   /// Offset region by dx,dy
00065   FXRegion& offset(FXint dx,FXint dy);
00066 
00067   /// Union region r with this one
00068   FXRegion& operator+=(const FXRegion& r);
00069 
00070   /// Intersect region r with this one
00071   FXRegion& operator*=(const FXRegion& r);
00072 
00073   /// Substract region r from this one
00074   FXRegion& operator-=(const FXRegion& r);
00075 
00076   /// Xor region r with this one
00077   FXRegion& operator^=(const FXRegion& r);
00078 
00079   /// Union of region r1 and region r2
00080   friend FXAPI FXRegion operator+(const FXRegion& r1,const FXRegion& r2);
00081 
00082   /// Intersection of region r1 and region r2
00083   friend FXAPI FXRegion operator*(const FXRegion& r1,const FXRegion& r2);
00084 
00085   /// Substract region r2 from region r1
00086   friend FXAPI FXRegion operator-(const FXRegion& r1,const FXRegion& r2);
00087 
00088   /// Xor of region r1 and region r2
00089   friend FXAPI FXRegion operator^(const FXRegion& r1,const FXRegion& r2);
00090 
00091   /// Return TRUE if region equal to this one
00092   friend FXAPI FXbool operator==(const FXRegion& r1,const FXRegion& r2);
00093 
00094   /// Return TRUE if region not equal to this one
00095   friend FXAPI FXbool operator!=(const FXRegion& r1,const FXRegion& r2);
00096 
00097   /// Destroy region
00098  ~FXRegion();
00099   };
00100 
00101 }
00102 
00103 #endif

Copyright © 1997-2004 Jeroen van der Zijp