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
}}}
21 \membersection{wxRegion::wxRegion
}\label{wxregionconstr
}
23 \func{}{wxRegion
}{\void}
27 \func{}{wxRegion
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
29 Constructs a rectangular region with the given position and size.
31 \func{}{wxRegion
}{\param{const wxPoint\&
}{ topLeft
},
\param{const wxPoint\&
}{ bottomRight
}}
33 Constructs a rectangular region from the top left point and the bottom right point.
35 \func{}{wxRegion
}{\param{const wxRect\&
}{ rect
}}
37 Constructs a rectangular region a wxRect object.
39 \func{}{wxRegion
}{\param{const wxRegion\&
}{ region
}}
41 Constructs a region by copying another region.
43 \func{}{wxRegion
}{\param{size
\_t}{ n
},
\param{const wxPoint
}{*points
},
\param{int
}{fillStyle = wxWINDING
\_RULE}}
45 Constructs a region corresponding to the polygon made of
{\it n
} points in the
46 provided array.
{\it fillStyle
} parameter may have values
47 {\tt wxWINDING
\_RULE} or
{\tt wxODDEVEN
\_RULE}.
49 {\bf NB:
} This constructor is only implemented for Win32 and GTK+ wxWindows ports.
51 \func{}{wxRegion
}{\param{const wxBitmap\&
}{ bmp
},
52 \param{const wxColour\&
}{ transColour = wxNullColour
},
53 \param{int
}{ tolerance =
0}}
55 Constructs a region using the non-transparent pixels of a bitmap. See
56 \helpref{Union
}{wxregionunion
} for more details.
59 \membersection{wxRegion::
\destruct{wxRegion
}}
61 \func{}{\destruct{wxRegion
}}{\void}
65 \membersection{wxRegion::Clear
}\label{wxregionclear
}
67 \func{void
}{Clear
}{\void}
69 Clears the current region.
71 \membersection{wxRegion::Contains
}\label{wxregioncontains
}
73 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
}}
75 Returns a value indicating whether the given point is contained within the region.
77 \constfunc{wxRegionContain
}{Contains
}{\param{const wxPoint\&
}{ pt
}}
79 Returns a value indicating whether the given point is contained within the region.
81 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
83 Returns a value indicating whether the given rectangle is contained within the region.
85 \constfunc{wxRegionContain
}{Contains
}{\param{const wxRect\&
}{rect
}}
87 Returns a value indicating whether the given rectangle is contained within the region.
89 \wxheading{Return value
}
91 The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
93 On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
94 all or some part of the region is contained in this region.
96 \membersection{wxRegion::ConvertToBitmap
}\label{wxregionconverttobitmap
}
98 \constfunc{wxBitmap
}{ConvertToBitmap
}{}
100 Convert the region to a black and white bitmap with the white pixels
101 being inside the region.
103 \membersection{wxRegion::GetBox
}\label{wxregiongetbox
}
105 \constfunc{void
}{GetBox
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
107 Returns the outer bounds of the region.
109 \constfunc{wxRect
}{GetBox
}{\void}
111 Returns the outer bounds of the region.
113 \membersection{wxRegion::Intersect
}\label{wxregionintersect
}
115 \func{bool
}{Intersect
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
117 Finds the intersection of this region and another, rectangular region, specified using position and size.
119 \func{bool
}{Intersect
}{\param{const wxRect\&
}{ rect
}}
121 Finds the intersection of this region and another, rectangular region.
123 \func{bool
}{Intersect
}{\param{const wxRegion\&
}{ region
}}
125 Finds the intersection of this region and another region.
127 \wxheading{Return value
}
129 {\tt true
} if successful,
{\tt false
} otherwise.
133 Creates the intersection of the two regions, that is, the parts which are in both regions. The result
134 is stored in this region.
136 \membersection{wxRegion::IsEmpty
}\label{wxregionisempty
}
138 \constfunc{bool
}{IsEmpty
}{\void}
140 Returns
{\tt true
} if the region is empty,
{\tt false
} otherwise.
142 \membersection{wxRegion::Subtract
}\label{wxregionsubstract
}
144 \func{bool
}{Subtract
}{\param{const wxRect\&
}{ rect
}}
146 Subtracts a rectangular region from this region.
148 \func{bool
}{Subtract
}{\param{const wxRegion\&
}{ region
}}
150 Subtracts a region from this region.
152 \wxheading{Return value
}
154 {\tt true
} if successful,
{\tt false
} otherwise.
158 This operation combines the parts of 'this' region that are not part of the second region.
159 The result is stored in this region.
161 \membersection{wxRegion::Offset
}\label{wxregionoffset
}
163 \func{bool
}{Offset
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
}}
165 Moves the region by the specified offsets in horizontal and vertical
168 \wxheading{Return value
}
170 {\tt true
} if successful,
{\tt false
} otherwise (the region is unchanged then).
172 \membersection{wxRegion::Union
}\label{wxregionunion
}
174 \func{bool
}{Union
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
176 Finds the union of this region and another, rectangular region, specified using position and size.
178 \func{bool
}{Union
}{\param{const wxRect\&
}{ rect
}}
180 Finds the union of this region and another, rectangular region.
182 \func{bool
}{Union
}{\param{const wxRegion\&
}{ region
}}
184 Finds the union of this region and another region.
186 \func{bool
}{Union
}{\param{const wxBitmap\&
}{ bmp
},
187 \param{const wxColour\&
}{ transColour = wxNullColour
},
188 \param{int
}{ tolerance =
0}}
190 Finds the union of this region and the the non-transparent pixels of a
191 bitmap. If the bitmap has a mask then it will be used, otherwise the
192 colour to be treated as transparent may be specified, along with an
193 optional colour tolerance value.
195 \wxheading{Return value
}
197 {\tt true
} if successful,
{\tt false
} otherwise.
201 This operation creates a region that combines all of this region and the second region.
202 The result is stored in this region.
204 \membersection{wxRegion::Xor
}\label{wxregionxor
}
206 \func{bool
}{Xor
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
208 Finds the Xor of this region and another, rectangular region, specified using position and size.
210 \func{bool
}{Xor
}{\param{const wxRect\&
}{ rect
}}
212 Finds the Xor of this region and another, rectangular region.
214 \func{bool
}{Xor
}{\param{const wxRegion\&
}{ region
}}
216 Finds the Xor of this region and another region.
218 \wxheading{Return value
}
220 {\tt true
} if successful,
{\tt false
} otherwise.
224 This operation creates a region that combines all of this region and the second region, except
225 for any overlapping areas. The result is stored in this region.
227 \membersection{wxRegion::operator $=$
}\label{wxregionassign
}
229 \func{void
}{operator $=$
}{\param{const wxRegion\&
}{ region
}}
231 Copies
{\it region
} by reference counting.
233 \section{\class{wxRegionIterator
}}\label{wxregioniterator
}
235 This class is used to iterate through the rectangles in a region,
236 typically when examining the damaged regions of a window within an OnPaint call.
238 To use it, construct an iterator object on the stack and loop through the
239 regions, testing the object and incrementing the iterator at the end of the loop.
241 See
\helpref{wxPaintEvent
}{wxpaintevent
} for an example of use.
243 \wxheading{Derived from
}
245 \helpref{wxObject
}{wxobject
}
247 \wxheading{Include files
}
253 \helpref{wxPaintEvent
}{wxpaintevent
}
255 \latexignore{\rtfignore{\wxheading{Members
}}}
257 \membersection{wxRegionIterator::wxRegionIterator
}
259 \func{}{wxRegionIterator
}{\void}
263 \func{}{wxRegionIterator
}{\param{const wxRegion\&
}{ region
}}
265 Creates an iterator object given a region.
267 \membersection{wxRegionIterator::GetX
}
269 \constfunc{wxCoord
}{GetX
}{\void}
271 Returns the x value for the current region.
273 \membersection{wxRegionIterator::GetY
}
275 \constfunc{wxCoord
}{GetY
}{\void}
277 Returns the y value for the current region.
279 \membersection{wxRegionIterator::GetW
}
281 \constfunc{wxCoord
}{GetW
}{\void}
283 An alias for GetWidth.
285 \membersection{wxRegionIterator::GetWidth
}
287 \constfunc{wxCoord
}{GetWidth
}{\void}
289 Returns the width value for the current region.
291 \membersection{wxRegionIterator::GetH
}
293 \constfunc{wxCoord
}{GetH
}{\void}
295 An alias for GetHeight.
297 \membersection{wxRegionIterator::GetHeight
}
299 \constfunc{wxCoord
}{GetWidth
}{\void}
301 Returns the width value for the current region.
303 \membersection{wxRegionIterator::GetRect
}
305 \constfunc{wxRect
}{GetRect
}{\void}
307 Returns the current rectangle.
309 \membersection{wxRegionIterator::HaveRects
}
311 \constfunc{bool
}{HaveRects
}{\void}
313 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
315 \membersection{wxRegionIterator::Reset
}
317 \func{void
}{Reset
}{\void}
319 Resets the iterator to the beginning of the rectangles.
321 \func{void
}{Reset
}{\param{const wxRegion\&
}{ region
}}
323 Resets the iterator to the given region.
325 \membersection{wxRegionIterator::operator $++$
}
327 \func{void
}{operator $++$
}{\void}
329 Increment operator. Increments the iterator to the next region.
331 \pythonnote{A wxPython alias for this operator is called
{\tt Next
}.
}
333 \membersection{wxRegionIterator::operator bool
}
335 \constfunc{}{operator bool
}{\void}
337 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
339 You can use this to test the iterator object as if it were of type bool.