1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxRegion}}\label{wxregion}
|
|
|
|
|
|
|
|
A wxRegion represents a simple or complex region on a device context or window. It uses
|
|
|
|
reference counting, so copying and assignment operations are fast.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxGDIObject}{wxgdiobject}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/region.h>
|
|
|
|
|
1998-11-04 17:16:10 -05:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxRegionIterator}{wxregioniterator}
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxRegion::wxRegion}\label{wxregionconstr}
|
|
|
|
|
|
|
|
\func{}{wxRegion}{\void}
|
|
|
|
|
|
|
|
Default constructor.
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\func{}{wxRegion}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Constructs a rectangular region with the given position and size.
|
|
|
|
|
|
|
|
\func{}{wxRegion}{\param{const wxPoint\&}{ topLeft}, \param{const wxPoint\&}{ bottomRight}}
|
|
|
|
|
|
|
|
Constructs a rectangular region from the top left point and the bottom right point.
|
|
|
|
|
|
|
|
\func{}{wxRegion}{\param{const wxRect\&}{ rect}}
|
|
|
|
|
|
|
|
Constructs a rectangular region a wxRect object.
|
|
|
|
|
|
|
|
\func{}{wxRegion}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Constructs a region by copying another region.
|
|
|
|
|
2001-08-27 10:56:55 -04:00
|
|
|
\func{}{wxRegion}{\param{size\_t}{ n}, \param{const wxPoint }{*points}, \param{int }{fillStyle = wxWINDING\_RULE}}
|
|
|
|
|
|
|
|
Constructs a region corresponding to the polygon made of {\it n} points in the
|
2003-03-28 18:05:05 -05:00
|
|
|
provided array. {\it fillStyle} parameter may have values
|
2001-08-27 10:56:55 -04:00
|
|
|
{\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}.
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
{\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWidgets ports.
|
2001-08-27 10:56:55 -04:00
|
|
|
|
2004-06-03 17:13:52 -04:00
|
|
|
\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp}}
|
|
|
|
|
2003-06-22 18:20:40 -04:00
|
|
|
\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp},
|
2004-06-03 17:13:52 -04:00
|
|
|
\param{const wxColour\&}{ transColour},
|
2003-03-28 18:05:05 -05:00
|
|
|
\param{int}{ tolerance = 0}}
|
|
|
|
|
|
|
|
Constructs a region using the non-transparent pixels of a bitmap. See
|
|
|
|
\helpref{Union}{wxregionunion} for more details.
|
|
|
|
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxRegion::\destruct{wxRegion}}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxRegion}}{\void}
|
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
|
|
|
\membersection{wxRegion::Clear}\label{wxregionclear}
|
|
|
|
|
|
|
|
\func{void}{Clear}{\void}
|
|
|
|
|
|
|
|
Clears the current region.
|
|
|
|
|
|
|
|
\membersection{wxRegion::Contains}\label{wxregioncontains}
|
|
|
|
|
|
|
|
\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}}
|
|
|
|
|
|
|
|
Returns a value indicating whether the given point is contained within the region.
|
|
|
|
|
|
|
|
\constfunc{wxRegionContain}{Contains}{\param{const wxPoint\&}{ pt}}
|
|
|
|
|
|
|
|
Returns a value indicating whether the given point is contained within the region.
|
|
|
|
|
|
|
|
\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}}
|
|
|
|
|
|
|
|
Returns a value indicating whether the given rectangle is contained within the region.
|
|
|
|
|
|
|
|
\constfunc{wxRegionContain}{Contains}{\param{const wxRect\& }{rect}}
|
|
|
|
|
|
|
|
Returns a value indicating whether the given rectangle is contained within the region.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
|
|
|
|
|
|
|
|
On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
|
|
|
|
all or some part of the region is contained in this region.
|
|
|
|
|
2003-03-28 18:05:05 -05:00
|
|
|
\membersection{wxRegion::ConvertToBitmap}\label{wxregionconverttobitmap}
|
|
|
|
|
|
|
|
\constfunc{wxBitmap}{ConvertToBitmap}{}
|
|
|
|
|
2003-05-03 13:56:30 -04:00
|
|
|
Convert the region to a black and white bitmap with the white pixels
|
2003-03-28 18:05:05 -05:00
|
|
|
being inside the region.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxRegion::GetBox}\label{wxregiongetbox}
|
|
|
|
|
|
|
|
\constfunc{void}{GetBox}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}}
|
|
|
|
|
|
|
|
Returns the outer bounds of the region.
|
|
|
|
|
|
|
|
\constfunc{wxRect}{GetBox}{\void}
|
|
|
|
|
|
|
|
Returns the outer bounds of the region.
|
|
|
|
|
|
|
|
\membersection{wxRegion::Intersect}\label{wxregionintersect}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\func{bool}{Intersect}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Finds the intersection of this region and another, rectangular region, specified using position and size.
|
|
|
|
|
|
|
|
\func{bool}{Intersect}{\param{const wxRect\&}{ rect}}
|
|
|
|
|
|
|
|
Finds the intersection of this region and another, rectangular region.
|
|
|
|
|
|
|
|
\func{bool}{Intersect}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Finds the intersection of this region and another region.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
{\tt true} if successful, {\tt false} otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
Creates the intersection of the two regions, that is, the parts which are in both regions. The result
|
|
|
|
is stored in this region.
|
|
|
|
|
|
|
|
\membersection{wxRegion::IsEmpty}\label{wxregionisempty}
|
|
|
|
|
|
|
|
\constfunc{bool}{IsEmpty}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns {\tt true} if the region is empty, {\tt false} otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-04-13 04:14:19 -04:00
|
|
|
\membersection{wxRegion::Subtract}\label{wxregionsubstract}
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\func{bool}{Subtract}{\param{const wxRect\&}{ rect}}
|
|
|
|
|
|
|
|
Subtracts a rectangular region from this region.
|
|
|
|
|
|
|
|
\func{bool}{Subtract}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Subtracts a region from this region.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
{\tt true} if successful, {\tt false} otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
This operation combines the parts of 'this' region that are not part of the second region.
|
|
|
|
The result is stored in this region.
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\membersection{wxRegion::Offset}\label{wxregionoffset}
|
|
|
|
|
|
|
|
\func{bool}{Offset}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
|
|
|
|
|
|
|
|
Moves the region by the specified offsets in horizontal and vertical
|
|
|
|
directions.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
{\tt true} if successful, {\tt false} otherwise (the region is unchanged then).
|
2002-01-31 11:00:13 -05:00
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxRegion::Union}\label{wxregionunion}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\func{bool}{Union}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Finds the union of this region and another, rectangular region, specified using position and size.
|
|
|
|
|
|
|
|
\func{bool}{Union}{\param{const wxRect\&}{ rect}}
|
|
|
|
|
|
|
|
Finds the union of this region and another, rectangular region.
|
|
|
|
|
|
|
|
\func{bool}{Union}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Finds the union of this region and another region.
|
|
|
|
|
2004-06-03 17:13:52 -04:00
|
|
|
\func{bool}{Union}{\param{const wxBitmap\&}{ bmp}}
|
|
|
|
|
|
|
|
Finds the union of this region and the the non-transparent pixels of a
|
|
|
|
bitmap. Bitmap's mask is used to determine transparency. If the bitmap doesn't
|
|
|
|
have a mask, solid rectangle of bitmap's dimensions is used.
|
|
|
|
|
2003-06-22 18:20:40 -04:00
|
|
|
\func{bool}{Union}{\param{const wxBitmap\&}{ bmp},
|
2004-06-03 17:13:52 -04:00
|
|
|
\param{const wxColour\&}{ transColour},
|
2003-03-28 18:05:05 -05:00
|
|
|
\param{int}{ tolerance = 0}}
|
|
|
|
|
|
|
|
Finds the union of this region and the the non-transparent pixels of a
|
2004-06-03 17:13:52 -04:00
|
|
|
bitmap. Colour to be treated as transparent is specified in the
|
|
|
|
\arg{transColour} argument, along with an
|
2003-03-28 18:05:05 -05:00
|
|
|
optional colour tolerance value.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Return value}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
{\tt true} if successful, {\tt false} otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
This operation creates a region that combines all of this region and the second region.
|
|
|
|
The result is stored in this region.
|
|
|
|
|
|
|
|
\membersection{wxRegion::Xor}\label{wxregionxor}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\func{bool}{Xor}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Finds the Xor of this region and another, rectangular region, specified using position and size.
|
|
|
|
|
|
|
|
\func{bool}{Xor}{\param{const wxRect\&}{ rect}}
|
|
|
|
|
|
|
|
Finds the Xor of this region and another, rectangular region.
|
|
|
|
|
|
|
|
\func{bool}{Xor}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Finds the Xor of this region and another region.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
{\tt true} if successful, {\tt false} otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
This operation creates a region that combines all of this region and the second region, except
|
|
|
|
for any overlapping areas. The result is stored in this region.
|
|
|
|
|
|
|
|
\membersection{wxRegion::operator $=$}\label{wxregionassign}
|
|
|
|
|
|
|
|
\func{void}{operator $=$}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Copies {\it region} by reference counting.
|
|
|
|
|
1998-11-04 17:16:10 -05:00
|
|
|
\section{\class{wxRegionIterator}}\label{wxregioniterator}
|
|
|
|
|
|
|
|
This class is used to iterate through the rectangles in a region,
|
|
|
|
typically when examining the damaged regions of a window within an OnPaint call.
|
|
|
|
|
|
|
|
To use it, construct an iterator object on the stack and loop through the
|
|
|
|
regions, testing the object and incrementing the iterator at the end of the loop.
|
|
|
|
|
2002-04-08 12:46:27 -04:00
|
|
|
See \helpref{wxPaintEvent}{wxpaintevent} for an example of use.
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/region.h>
|
|
|
|
|
1998-11-04 17:16:10 -05:00
|
|
|
\wxheading{See also}
|
|
|
|
|
2002-04-08 12:46:27 -04:00
|
|
|
\helpref{wxPaintEvent}{wxpaintevent}
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::wxRegionIterator}
|
|
|
|
|
|
|
|
\func{}{wxRegionIterator}{\void}
|
|
|
|
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
\func{}{wxRegionIterator}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Creates an iterator object given a region.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::GetX}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\constfunc{wxCoord}{GetX}{\void}
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
Returns the x value for the current region.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::GetY}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\constfunc{wxCoord}{GetY}{\void}
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
Returns the y value for the current region.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::GetW}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\constfunc{wxCoord}{GetW}{\void}
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
An alias for GetWidth.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::GetWidth}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\constfunc{wxCoord}{GetWidth}{\void}
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
Returns the width value for the current region.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::GetH}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\constfunc{wxCoord}{GetH}{\void}
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
An alias for GetHeight.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::GetHeight}
|
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
\constfunc{wxCoord}{GetWidth}{\void}
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
Returns the width value for the current region.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::GetRect}
|
|
|
|
|
|
|
|
\constfunc{wxRect}{GetRect}{\void}
|
|
|
|
|
|
|
|
Returns the current rectangle.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::HaveRects}
|
|
|
|
|
|
|
|
\constfunc{bool}{HaveRects}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
\membersection{wxRegionIterator::Reset}
|
|
|
|
|
|
|
|
\func{void}{Reset}{\void}
|
|
|
|
|
|
|
|
Resets the iterator to the beginning of the rectangles.
|
|
|
|
|
|
|
|
\func{void}{Reset}{\param{const wxRegion\&}{ region}}
|
|
|
|
|
|
|
|
Resets the iterator to the given region.
|
|
|
|
|
|
|
|
\membersection{wxRegionIterator::operator $++$}
|
|
|
|
|
|
|
|
\func{void}{operator $++$}{\void}
|
|
|
|
|
|
|
|
Increment operator. Increments the iterator to the next region.
|
|
|
|
|
1999-12-25 15:34:56 -05:00
|
|
|
\pythonnote{A wxPython alias for this operator is called {\tt Next}.}
|
1999-02-19 02:58:02 -05:00
|
|
|
|
1998-11-04 17:16:10 -05:00
|
|
|
\membersection{wxRegionIterator::operator bool}
|
|
|
|
|
|
|
|
\constfunc{}{operator bool}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
|
1998-11-04 17:16:10 -05:00
|
|
|
|
|
|
|
You can use this to test the iterator object as if it were of type bool.
|
1998-05-20 10:25:30 -04:00
|
|
|
|