The Great wxRegion Refactoring:

1. added wxRegionBase class and derive all wxRegions from it
2. also added wxRegionWithCombine for the ports providing Combine() method
   (MSW, OS2 and Mac) to reduce code duplication further
3. made sure region comparison works the same way in all ports (except those
   not implementing it) and added IsEqual() method


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-09-25 11:47:23 +00:00
parent b48f51ca74
commit 8a16d7370e
24 changed files with 751 additions and 1654 deletions

View File

@@ -18,6 +18,7 @@ reference counting, so copying and assignment operations are fast.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxRegion::wxRegion}\label{wxregionctor}
\func{}{wxRegion}{\void}
@@ -52,24 +53,27 @@ provided array. {\it fillStyle} parameter may have values
\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp},
\param{const wxColour\&}{ transColour},
\param{int}{ tolerance = 0}}
\param{int}{ tolerance = 0}}
Constructs a region using the non-transparent pixels of a bitmap. See
\helpref{Union}{wxregionunion} for more details.
\membersection{wxRegion::\destruct{wxRegion}}\label{wxregiondtor}
\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}}
@@ -95,6 +99,7 @@ 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.
\membersection{wxRegion::ConvertToBitmap}\label{wxregionconverttobitmap}
\constfunc{wxBitmap}{ConvertToBitmap}{}
@@ -102,6 +107,7 @@ all or some part of the region is contained in this region.
Convert the region to a black and white bitmap with the white pixels
being inside the region.
\membersection{wxRegion::GetBox}\label{wxregiongetbox}
\constfunc{void}{GetBox}{\param{wxCoord\& }{x}, \param{wxCoord\& }{y}, \param{wxCoord\& }{width}, \param{wxCoord\& }{height}}
@@ -112,6 +118,7 @@ Returns the outer bounds of the region.
Returns the outer bounds of the region.
\membersection{wxRegion::Intersect}\label{wxregionintersect}
\func{bool}{Intersect}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
@@ -135,12 +142,23 @@ Finds the intersection of this region and another region.
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}
Returns {\tt true} if the region is empty, {\tt false} otherwise.
\membersection{wxRegion::IsEqual}\label{wxregionisequal}
\constfunc{bool}{IsEqual}{\param{const wxRegion\& }{region}}
Returns {\tt true} if the region is equal to, i.e. covers the same area as,
another one. Note that if both this region and \arg{region} are invalid, they
are considered to be equal.
\membersection{wxRegion::Subtract}\label{wxregionsubtract}
\func{bool}{Subtract}{\param{const wxRect\&}{ rect}}
@@ -160,10 +178,13 @@ Subtracts a region from this region.
This operation combines the parts of 'this' region that are not part of the second region.
The result is stored in this region.
\membersection{wxRegion::Offset}\label{wxregionoffset}
\func{bool}{Offset}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
\func{bool}{Offset}{\param{const wxPoint\& }{ pt}}
Moves the region by the specified offsets in horizontal and vertical
directions.
@@ -171,6 +192,7 @@ directions.
{\tt true} if successful, {\tt false} otherwise (the region is unchanged then).
\membersection{wxRegion::Union}\label{wxregionunion}
\func{bool}{Union}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
@@ -193,7 +215,7 @@ have a mask, solid rectangle of bitmap's dimensions is used.
\func{bool}{Union}{\param{const wxBitmap\&}{ bmp},
\param{const wxColour\&}{ transColour},
\param{int}{ tolerance = 0}}
\param{int}{ tolerance = 0}}
Finds the union of this region and the non-transparent pixels of a
bitmap. Colour to be treated as transparent is specified in the
@@ -209,6 +231,7 @@ optional colour tolerance value.
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}
\func{bool}{Xor}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
@@ -232,6 +255,7 @@ Finds the Xor of this region and another region.
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}}
@@ -262,6 +286,7 @@ See \helpref{wxPaintEvent}{wxpaintevent} for an example of use.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxRegionIterator::wxRegionIterator}\label{wxregioniteratorctor}
\func{}{wxRegionIterator}{\void}
@@ -272,54 +297,63 @@ Default constructor.
Creates an iterator object given a region.
\membersection{wxRegionIterator::GetX}\label{wxregioniteratorgetx}
\constfunc{wxCoord}{GetX}{\void}
Returns the x value for the current region.
\membersection{wxRegionIterator::GetY}\label{wxregioniteratorgety}
\constfunc{wxCoord}{GetY}{\void}
Returns the y value for the current region.
\membersection{wxRegionIterator::GetW}\label{wxregioniteratorgetw}
\constfunc{wxCoord}{GetW}{\void}
An alias for GetWidth.
\membersection{wxRegionIterator::GetHeight}\label{wxregioniteratorgetheight}
\constfunc{wxCoord}{GetHeight}{\void}
Returns the height value for the current region.
\membersection{wxRegionIterator::GetH}\label{wxregioniteratorgeth}
\constfunc{wxCoord}{GetH}{\void}
An alias for GetHeight.
\membersection{wxRegionIterator::GetRect}\label{wxregioniteratorgetrect}
\constfunc{wxRect}{GetRect}{\void}
Returns the current rectangle.
\membersection{wxRegionIterator::GetWidth}\label{wxregioniteratorgetwidth}
\constfunc{wxCoord}{GetWidth}{\void}
Returns the width value for the current region.
\membersection{wxRegionIterator::HaveRects}\label{wxregioniteratorhaverects}
\constfunc{bool}{HaveRects}{\void}
Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
\membersection{wxRegionIterator::Reset}\label{wxregioniteratorreset}
\func{void}{Reset}{\void}
@@ -330,6 +364,7 @@ Resets the iterator to the beginning of the rectangles.
Resets the iterator to the given region.
\membersection{wxRegionIterator::operator $++$}\label{wxregioniteratorinc}
\func{void}{operator $++$}{\void}
@@ -338,6 +373,7 @@ Increment operator. Increments the iterator to the next region.
\pythonnote{A wxPython alias for this operator is called {\tt Next}.}
\membersection{wxRegionIterator::operator bool}\label{wxregioniteratorbool}
\constfunc{}{operator bool}{\void}