]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/region.h
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     interface of wxRegionIterator 
   4 // Author:      wxWidgets team 
   6 // Licence:     wxWindows license 
   7 ///////////////////////////////////////////////////////////////////////////// 
  10     Types of results returned from a call to wxRegion::Contains(). 
  14     /** The specified value is not contained within this region. */ 
  18         The specified value is partially contained within this region. 
  20         On Windows, this result is not supported. ::wxInRegion will be returned 
  26         The specified value is fully contained within this region. 
  28         On Windows, this result will be returned even if only part of the specified 
  29         value is contained in this region. 
  35     @class wxRegionIterator 
  37     This class is used to iterate through the rectangles in a region, 
  38     typically when examining the damaged regions of a window within an OnPaint call. 
  40     To use it, construct an iterator object on the stack and loop through the 
  41     regions, testing the object and incrementing the iterator at the end of the 
  44     See wxPaintEvent for an example of use. 
  54 class wxRegionIterator 
: public wxObject
 
  62         Creates an iterator object given a region. 
  64     wxRegionIterator(const wxRegion
& region
); 
  67         An alias for GetHeight(). 
  72         Returns the height value for the current region. 
  74     wxCoord 
GetHeight() const; 
  77         Returns the current rectangle. 
  79     wxRect 
GetRect() const; 
  82         An alias for GetWidth(). 
  87         Returns the width value for the current region. 
  89     wxCoord 
GetWidth() const; 
  92         Returns the x value for the current region. 
  97         Returns the y value for the current region. 
 102         Returns @true if there are still some rectangles; otherwise returns @false. 
 104     bool HaveRects() const; 
 107         Resets the iterator to the beginning of the rectangles. 
 112         Resets the iterator to the given region. 
 114     void Reset(const wxRegion
& region
); 
 117         Increment operator. Increments the iterator to the next region. 
 120         A wxPython alias for this operator is called Next. 
 123     wxRegionIterator
& operator ++(); 
 126         Returns @true if there are still some rectangles; otherwise returns @false. 
 128         You can use this to test the iterator object as if it were of type @c bool. 
 130     operator bool() const; 
 138     A wxRegion represents a simple or complex region on a device context or window. 
 140     This class uses @ref overview_refcount "reference counting and copy-on-write" 
 141     internally so that assignments between two instances of this class are very 
 142     cheap. You can therefore use actual objects instead of pointers without 
 143     efficiency problems. If an instance of this class is changed it will create 
 144     its own data internally so that other instances, which previously shared the 
 145     data using the reference counting, are not affected. 
 153     @see wxRegionIterator 
 155 class wxRegion 
: public wxGDIObject
 
 163         Constructs a rectangular region with the given position and size. 
 165     wxRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
); 
 167         Constructs a rectangular region from the top left point and the bottom right 
 170     wxRegion(const wxPoint
& topLeft
, const wxPoint
& bottomRight
); 
 172         Constructs a rectangular region a wxRect object. 
 174     wxRegion(const wxRect
& rect
); 
 176         Copy constructor, uses @ref overview_refcount. 
 178     wxRegion(const wxRegion
& region
); 
 180         Constructs a region corresponding to the polygon made of @a n points 
 181         in the provided array. 
 182         @a fillStyle parameter may have values @c wxWINDING_RULE or @c wxODDEVEN_RULE. 
 184     wxRegion(size_t n
, const wxPoint
* points
, int fillStyle 
= wxODDEVEN_RULE
); 
 186         Constructs a region using a bitmap. See Union() for more details. 
 188     wxRegion(const wxBitmap
& bmp
); 
 190         Constructs a region using the non-transparent pixels of a bitmap.  See 
 191         Union() for more details. 
 193     wxRegion(const wxBitmap
& bmp
, const wxColour
& transColour
, 
 198         See @ref overview_refcount_destruct "reference-counted object destruction" for 
 204         Clears the current region. 
 206     virtual void Clear(); 
 209         Returns a value indicating whether the given point is contained within the region. 
 211         @return The return value is one of @c wxOutRegion and @c wxInRegion. 
 213     wxRegionContain 
Contains(wxCoord x
, wxCoord y
) const; 
 215         Returns a value indicating whether the given point is contained within the region. 
 217         @return The return value is one of @c wxOutRegion and @c wxInRegion. 
 219     wxRegionContain 
Contains(const wxPoint
& pt
) const; 
 221         Returns a value indicating whether the given rectangle is contained within the 
 224         @return One of ::wxOutRegion, ::wxPartRegion or ::wxInRegion. 
 226         @note On Windows, only ::wxOutRegion and ::wxInRegion are returned; a value 
 227               ::wxInRegion then indicates that all or some part of the region is 
 228               contained in this region. 
 230     wxRegionContain 
Contains(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) const; 
 232         Returns a value indicating whether the given rectangle is contained within the 
 235         @return One of ::wxOutRegion, ::wxPartRegion or ::wxInRegion. 
 237         @note On Windows, only ::wxOutRegion and ::wxInRegion are returned; a value 
 238               ::wxInRegion then indicates that all or some part of the region is 
 239               contained in this region. 
 241     wxRegionContain 
Contains(const wxRect
& rect
) const; 
 244         Convert the region to a black and white bitmap with the white pixels 
 245         being inside the region. 
 247     wxBitmap 
ConvertToBitmap() const; 
 251         Returns the outer bounds of the region. 
 253     void GetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& width
, 
 254                 wxCoord
& height
) const; 
 255     wxRect 
GetBox() const; 
 259         Finds the intersection of this region and another, rectangular region, 
 260         specified using position and size. 
 262         @return @true if successful, @false otherwise. 
 264         @remarks Creates the intersection of the two regions, that is, the parts 
 265                  which are in both regions. The result is stored in this 
 268     bool Intersect(wxCoord x
, wxCoord y
, wxCoord width
, 
 271         Finds the intersection of this region and another, rectangular region. 
 273         @return @true if successful, @false otherwise. 
 275         @remarks Creates the intersection of the two regions, that is, the parts 
 276                  which are in both regions. The result is stored in this 
 279     bool Intersect(const wxRect
& rect
); 
 281         Finds the intersection of this region and another region. 
 283         @return @true if successful, @false otherwise. 
 285         @remarks Creates the intersection of the two regions, that is, the parts 
 286                  which are in both regions. The result is stored in this 
 289     bool Intersect(const wxRegion
& region
); 
 292         Returns @true if the region is empty, @false otherwise. 
 294     virtual bool IsEmpty() const; 
 297         Returns @true if the region is equal to, i.e. covers the same area as, 
 300         @note If both this region and @a region are invalid, they are 
 301               considered to be equal. 
 303     bool IsEqual(const wxRegion
& region
) const; 
 307         Moves the region by the specified offsets in horizontal and vertical 
 310         @return @true if successful, @false otherwise (the region is unchanged 
 313     bool Offset(wxCoord x
, wxCoord y
); 
 314     bool Offset(const wxPoint
& pt
); 
 318         Subtracts a rectangular region from this region. 
 320         @return @true if successful, @false otherwise. 
 322         @remarks This operation combines the parts of 'this' region that are not 
 323                  part of the second region. The result is stored in this 
 326     bool Subtract(const wxRect
& rect
); 
 328         Subtracts a region from this region. 
 330         @return @true if successful, @false otherwise. 
 332         @remarks This operation combines the parts of 'this' region that are not 
 333                  part of the second region. The result is stored in this 
 336     bool Subtract(const wxRegion
& region
); 
 339         Finds the union of this region and another, rectangular region, specified using 
 342         @return @true if successful, @false otherwise. 
 344         @remarks This operation creates a region that combines all of this region 
 345                  and the second region. The result is stored in this 
 348     bool Union(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
); 
 350         Finds the union of this region and another, rectangular region. 
 352         @return @true if successful, @false otherwise. 
 354         @remarks This operation creates a region that combines all of this region 
 355                  and the second region. The result is stored in this 
 358     bool Union(const wxRect
& rect
); 
 360         Finds the union of this region and another region. 
 362         @return @true if successful, @false otherwise. 
 364         @remarks This operation creates a region that combines all of this region 
 365                  and the second region. The result is stored in this 
 368     bool Union(const wxRegion
& region
); 
 370         Finds the union of this region and the non-transparent pixels of a 
 371         bitmap. The bitmap's mask is used to determine transparency. If the 
 372         bitmap doesn't have a mask, the bitmap's full dimensions are used. 
 374         @return @true if successful, @false otherwise. 
 376         @remarks This operation creates a region that combines all of this region 
 377                  and the second region. The result is stored in this 
 380     bool Union(const wxBitmap
& bmp
); 
 382         Finds the union of this region and the non-transparent pixels of a 
 383         bitmap. Colour to be treated as transparent is specified in the 
 384         @a transColour argument, along with an optional colour tolerance value. 
 386         @return @true if successful, @false otherwise. 
 388         @remarks This operation creates a region that combines all of this region 
 389                  and the second region. The result is stored in this 
 392     bool Union(const wxBitmap
& bmp
, const wxColour
& transColour
, 
 396         Finds the Xor of this region and another, rectangular region, specified using 
 399         @return @true if successful, @false otherwise. 
 401         @remarks This operation creates a region that combines all of this region 
 402                  and the second region, except for any overlapping 
 403                  areas. The result is stored in this region. 
 405     bool Xor(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
); 
 407         Finds the Xor of this region and another, rectangular region. 
 409         @return @true if successful, @false otherwise. 
 411         @remarks This operation creates a region that combines all of this region 
 412                  and the second region, except for any overlapping 
 413                  areas. The result is stored in this region. 
 415     bool Xor(const wxRect
& rect
); 
 417         Finds the Xor of this region and another region. 
 419         @return @true if successful, @false otherwise. 
 421         @remarks This operation creates a region that combines all of this region 
 422                  and the second region, except for any overlapping 
 423                  areas. The result is stored in this region. 
 425     bool Xor(const wxRegion
& region
); 
 428         Assignment operator, using @ref overview_refcount. 
 430     wxRegion
& operator=(const wxRegion
& region
); 
 436 wxRegion wxNullRegion
;