1 \section{\class{wxRegion
}}\label{wxregion
}
3 A wxRegion represents a simple or complex region on a device context or window. It uses
4 reference counting, so copying and assignment operations are fast.
6 \wxheading{Derived from
}
8 \helpref{wxGDIObject
}{wxgdiobject
}\\
9 \helpref{wxObject
}{wxobject
}
11 \wxheading{Include files
}
17 \helpref{wxRegionIterator
}{wxregioniterator
}
19 \latexignore{\rtfignore{\wxheading{Members
}}}
22 \membersection{wxRegion::wxRegion
}\label{wxregionctor
}
24 \func{}{wxRegion
}{\void}
28 \func{}{wxRegion
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
30 Constructs a rectangular region with the given position and size.
32 \func{}{wxRegion
}{\param{const wxPoint\&
}{ topLeft
},
\param{const wxPoint\&
}{ bottomRight
}}
34 Constructs a rectangular region from the top left point and the bottom right point.
36 \func{}{wxRegion
}{\param{const wxRect\&
}{ rect
}}
38 Constructs a rectangular region a wxRect object.
40 \func{}{wxRegion
}{\param{const wxRegion\&
}{ region
}}
42 Copy constructor, uses
\helpref{reference counting
}{trefcount
}.
44 \func{}{wxRegion
}{\param{size
\_t}{ n
},
\param{const wxPoint
}{*points
},
\param{int
}{fillStyle = wxWINDING
\_RULE}}
46 Constructs a region corresponding to the polygon made of
{\it n
} points in the
47 provided array.
{\it fillStyle
} parameter may have values
48 {\tt wxWINDING
\_RULE} or
{\tt wxODDEVEN
\_RULE}.
50 {\bf NB:
} This constructor is only implemented for Win32 and GTK+ wxWidgets ports.
52 \func{}{wxRegion
}{\param{const wxBitmap\&
}{ bmp
}}
54 \func{}{wxRegion
}{\param{const wxBitmap\&
}{ bmp
},
55 \param{const wxColour\&
}{ transColour
},
56 \param{int
}{ tolerance =
0}}
58 Constructs a region using the non-transparent pixels of a bitmap. See
59 \helpref{Union
}{wxregionunion
} for more details.
63 \membersection{wxRegion::
\destruct{wxRegion
}}\label{wxregiondtor
}
65 \func{}{\destruct{wxRegion
}}{\void}
70 \membersection{wxRegion::Clear
}\label{wxregionclear
}
72 \func{void
}{Clear
}{\void}
74 Clears the current region.
77 \membersection{wxRegion::Contains
}\label{wxregioncontains
}
79 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
}}
81 Returns a value indicating whether the given point is contained within the region.
83 \constfunc{wxRegionContain
}{Contains
}{\param{const wxPoint\&
}{ pt
}}
85 Returns a value indicating whether the given point is contained within the region.
87 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
89 Returns a value indicating whether the given rectangle is contained within the region.
91 \constfunc{wxRegionContain
}{Contains
}{\param{const wxRect\&
}{rect
}}
93 Returns a value indicating whether the given rectangle is contained within the region.
95 \wxheading{Return value
}
97 The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
99 On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
100 all or some part of the region is contained in this region.
103 \membersection{wxRegion::ConvertToBitmap
}\label{wxregionconverttobitmap
}
105 \constfunc{wxBitmap
}{ConvertToBitmap
}{}
107 Convert the region to a black and white bitmap with the white pixels
108 being inside the region.
111 \membersection{wxRegion::GetBox
}\label{wxregiongetbox
}
113 \constfunc{void
}{GetBox
}{\param{wxCoord\&
}{x
},
\param{wxCoord\&
}{y
},
\param{wxCoord\&
}{width
},
\param{wxCoord\&
}{height
}}
115 Returns the outer bounds of the region.
117 \constfunc{wxRect
}{GetBox
}{\void}
119 Returns the outer bounds of the region.
122 \membersection{wxRegion::Intersect
}\label{wxregionintersect
}
124 \func{bool
}{Intersect
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
126 Finds the intersection of this region and another, rectangular region, specified using position and size.
128 \func{bool
}{Intersect
}{\param{const wxRect\&
}{ rect
}}
130 Finds the intersection of this region and another, rectangular region.
132 \func{bool
}{Intersect
}{\param{const wxRegion\&
}{ region
}}
134 Finds the intersection of this region and another region.
136 \wxheading{Return value
}
138 {\tt true
} if successful,
{\tt false
} otherwise.
142 Creates the intersection of the two regions, that is, the parts which are in both regions. The result
143 is stored in this region.
146 \membersection{wxRegion::IsEmpty
}\label{wxregionisempty
}
148 \constfunc{bool
}{IsEmpty
}{\void}
150 Returns
{\tt true
} if the region is empty,
{\tt false
} otherwise.
153 \membersection{wxRegion::IsEqual
}\label{wxregionisequal
}
155 \constfunc{bool
}{IsEqual
}{\param{const wxRegion\&
}{region
}}
157 Returns
{\tt true
} if the region is equal to, i.e. covers the same area as,
158 another one. Note that if both this region and
\arg{region
} are invalid, they
159 are considered to be equal.
162 \membersection{wxRegion::Subtract
}\label{wxregionsubtract
}
164 \func{bool
}{Subtract
}{\param{const wxRect\&
}{ rect
}}
166 Subtracts a rectangular region from this region.
168 \func{bool
}{Subtract
}{\param{const wxRegion\&
}{ region
}}
170 Subtracts a region from this region.
172 \wxheading{Return value
}
174 {\tt true
} if successful,
{\tt false
} otherwise.
178 This operation combines the parts of 'this' region that are not part of the second region.
179 The result is stored in this region.
182 \membersection{wxRegion::Offset
}\label{wxregionoffset
}
184 \func{bool
}{Offset
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
}}
186 \func{bool
}{Offset
}{\param{const wxPoint\&
}{ pt
}}
188 Moves the region by the specified offsets in horizontal and vertical
191 \wxheading{Return value
}
193 {\tt true
} if successful,
{\tt false
} otherwise (the region is unchanged then).
196 \membersection{wxRegion::Union
}\label{wxregionunion
}
198 \func{bool
}{Union
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
200 Finds the union of this region and another, rectangular region, specified using position and size.
202 \func{bool
}{Union
}{\param{const wxRect\&
}{ rect
}}
204 Finds the union of this region and another, rectangular region.
206 \func{bool
}{Union
}{\param{const wxRegion\&
}{ region
}}
208 Finds the union of this region and another region.
210 \func{bool
}{Union
}{\param{const wxBitmap\&
}{ bmp
}}
212 Finds the union of this region and the non-transparent pixels of a
213 bitmap. Bitmap's mask is used to determine transparency. If the bitmap doesn't
214 have a mask, solid rectangle of bitmap's dimensions is used.
216 \func{bool
}{Union
}{\param{const wxBitmap\&
}{ bmp
},
217 \param{const wxColour\&
}{ transColour
},
218 \param{int
}{ tolerance =
0}}
220 Finds the union of this region and the non-transparent pixels of a
221 bitmap. Colour to be treated as transparent is specified in the
222 \arg{transColour
} argument, along with an
223 optional colour tolerance value.
225 \wxheading{Return value
}
227 {\tt true
} if successful,
{\tt false
} otherwise.
231 This operation creates a region that combines all of this region and the second region.
232 The result is stored in this region.
235 \membersection{wxRegion::Xor
}\label{wxregionxor
}
237 \func{bool
}{Xor
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
239 Finds the Xor of this region and another, rectangular region, specified using position and size.
241 \func{bool
}{Xor
}{\param{const wxRect\&
}{ rect
}}
243 Finds the Xor of this region and another, rectangular region.
245 \func{bool
}{Xor
}{\param{const wxRegion\&
}{ region
}}
247 Finds the Xor of this region and another region.
249 \wxheading{Return value
}
251 {\tt true
} if successful,
{\tt false
} otherwise.
255 This operation creates a region that combines all of this region and the second region, except
256 for any overlapping areas. The result is stored in this region.
259 \membersection{wxRegion::operator $=$
}\label{wxregionassign
}
261 \func{void
}{operator $=$
}{\param{const wxRegion\&
}{ region
}}
263 Assignment operator, using
\helpref{reference counting
}{trefcount
}.
267 \section{\class{wxRegionIterator
}}\label{wxregioniterator
}
269 This class is used to iterate through the rectangles in a region,
270 typically when examining the damaged regions of a window within an OnPaint call.
272 To use it, construct an iterator object on the stack and loop through the
273 regions, testing the object and incrementing the iterator at the end of the loop.
275 See
\helpref{wxPaintEvent
}{wxpaintevent
} for an example of use.
277 \wxheading{Derived from
}
279 \helpref{wxObject
}{wxobject
}
281 \wxheading{Include files
}
287 \helpref{wxPaintEvent
}{wxpaintevent
}
289 \latexignore{\rtfignore{\wxheading{Members
}}}
292 \membersection{wxRegionIterator::wxRegionIterator
}\label{wxregioniteratorctor
}
294 \func{}{wxRegionIterator
}{\void}
298 \func{}{wxRegionIterator
}{\param{const wxRegion\&
}{ region
}}
300 Creates an iterator object given a region.
303 \membersection{wxRegionIterator::GetX
}\label{wxregioniteratorgetx
}
305 \constfunc{wxCoord
}{GetX
}{\void}
307 Returns the x value for the current region.
310 \membersection{wxRegionIterator::GetY
}\label{wxregioniteratorgety
}
312 \constfunc{wxCoord
}{GetY
}{\void}
314 Returns the y value for the current region.
317 \membersection{wxRegionIterator::GetW
}\label{wxregioniteratorgetw
}
319 \constfunc{wxCoord
}{GetW
}{\void}
321 An alias for GetWidth.
324 \membersection{wxRegionIterator::GetHeight
}\label{wxregioniteratorgetheight
}
326 \constfunc{wxCoord
}{GetHeight
}{\void}
328 Returns the height value for the current region.
331 \membersection{wxRegionIterator::GetH
}\label{wxregioniteratorgeth
}
333 \constfunc{wxCoord
}{GetH
}{\void}
335 An alias for GetHeight.
338 \membersection{wxRegionIterator::GetRect
}\label{wxregioniteratorgetrect
}
340 \constfunc{wxRect
}{GetRect
}{\void}
342 Returns the current rectangle.
345 \membersection{wxRegionIterator::GetWidth
}\label{wxregioniteratorgetwidth
}
347 \constfunc{wxCoord
}{GetWidth
}{\void}
349 Returns the width value for the current region.
352 \membersection{wxRegionIterator::HaveRects
}\label{wxregioniteratorhaverects
}
354 \constfunc{bool
}{HaveRects
}{\void}
356 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
359 \membersection{wxRegionIterator::Reset
}\label{wxregioniteratorreset
}
361 \func{void
}{Reset
}{\void}
363 Resets the iterator to the beginning of the rectangles.
365 \func{void
}{Reset
}{\param{const wxRegion\&
}{ region
}}
367 Resets the iterator to the given region.
370 \membersection{wxRegionIterator::operator $++$
}\label{wxregioniteratorinc
}
372 \func{void
}{operator $++$
}{\void}
374 Increment operator. Increments the iterator to the next region.
376 \pythonnote{A wxPython alias for this operator is called
{\tt Next
}.
}
379 \membersection{wxRegionIterator::operator bool
}\label{wxregioniteratorbool
}
381 \constfunc{}{operator bool
}{\void}
383 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
385 You can use this to test the iterator object as if it were of type bool.