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+ wxWidgets ports.
51 \func{}{wxRegion
}{\param{const wxBitmap\&
}{ bmp
}}
53 \func{}{wxRegion
}{\param{const wxBitmap\&
}{ bmp
},
54 \param{const wxColour\&
}{ transColour
},
55 \param{int
}{ tolerance =
0}}
57 Constructs a region using the non-transparent pixels of a bitmap. See
58 \helpref{Union
}{wxregionunion
} for more details.
61 \membersection{wxRegion::
\destruct{wxRegion
}}
63 \func{}{\destruct{wxRegion
}}{\void}
67 \membersection{wxRegion::Clear
}\label{wxregionclear
}
69 \func{void
}{Clear
}{\void}
71 Clears the current region.
73 \membersection{wxRegion::Contains
}\label{wxregioncontains
}
75 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
}}
77 Returns a value indicating whether the given point is contained within the region.
79 \constfunc{wxRegionContain
}{Contains
}{\param{const wxPoint\&
}{ pt
}}
81 Returns a value indicating whether the given point is contained within the region.
83 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
85 Returns a value indicating whether the given rectangle is contained within the region.
87 \constfunc{wxRegionContain
}{Contains
}{\param{const wxRect\&
}{rect
}}
89 Returns a value indicating whether the given rectangle is contained within the region.
91 \wxheading{Return value
}
93 The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
95 On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
96 all or some part of the region is contained in this region.
98 \membersection{wxRegion::ConvertToBitmap
}\label{wxregionconverttobitmap
}
100 \constfunc{wxBitmap
}{ConvertToBitmap
}{}
102 Convert the region to a black and white bitmap with the white pixels
103 being inside the region.
105 \membersection{wxRegion::GetBox
}\label{wxregiongetbox
}
107 \constfunc{void
}{GetBox
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
109 Returns the outer bounds of the region.
111 \constfunc{wxRect
}{GetBox
}{\void}
113 Returns the outer bounds of the region.
115 \membersection{wxRegion::Intersect
}\label{wxregionintersect
}
117 \func{bool
}{Intersect
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
119 Finds the intersection of this region and another, rectangular region, specified using position and size.
121 \func{bool
}{Intersect
}{\param{const wxRect\&
}{ rect
}}
123 Finds the intersection of this region and another, rectangular region.
125 \func{bool
}{Intersect
}{\param{const wxRegion\&
}{ region
}}
127 Finds the intersection of this region and another region.
129 \wxheading{Return value
}
131 {\tt true
} if successful,
{\tt false
} otherwise.
135 Creates the intersection of the two regions, that is, the parts which are in both regions. The result
136 is stored in this region.
138 \membersection{wxRegion::IsEmpty
}\label{wxregionisempty
}
140 \constfunc{bool
}{IsEmpty
}{\void}
142 Returns
{\tt true
} if the region is empty,
{\tt false
} otherwise.
144 \membersection{wxRegion::Subtract
}\label{wxregionsubstract
}
146 \func{bool
}{Subtract
}{\param{const wxRect\&
}{ rect
}}
148 Subtracts a rectangular region from this region.
150 \func{bool
}{Subtract
}{\param{const wxRegion\&
}{ region
}}
152 Subtracts a region from this region.
154 \wxheading{Return value
}
156 {\tt true
} if successful,
{\tt false
} otherwise.
160 This operation combines the parts of 'this' region that are not part of the second region.
161 The result is stored in this region.
163 \membersection{wxRegion::Offset
}\label{wxregionoffset
}
165 \func{bool
}{Offset
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
}}
167 Moves the region by the specified offsets in horizontal and vertical
170 \wxheading{Return value
}
172 {\tt true
} if successful,
{\tt false
} otherwise (the region is unchanged then).
174 \membersection{wxRegion::Union
}\label{wxregionunion
}
176 \func{bool
}{Union
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
178 Finds the union of this region and another, rectangular region, specified using position and size.
180 \func{bool
}{Union
}{\param{const wxRect\&
}{ rect
}}
182 Finds the union of this region and another, rectangular region.
184 \func{bool
}{Union
}{\param{const wxRegion\&
}{ region
}}
186 Finds the union of this region and another region.
188 \func{bool
}{Union
}{\param{const wxBitmap\&
}{ bmp
}}
190 Finds the union of this region and the the non-transparent pixels of a
191 bitmap. Bitmap's mask is used to determine transparency. If the bitmap doesn't
192 have a mask, solid rectangle of bitmap's dimensions is used.
194 \func{bool
}{Union
}{\param{const wxBitmap\&
}{ bmp
},
195 \param{const wxColour\&
}{ transColour
},
196 \param{int
}{ tolerance =
0}}
198 Finds the union of this region and the the non-transparent pixels of a
199 bitmap. Colour to be treated as transparent is specified in the
200 \arg{transColour
} argument, along with an
201 optional colour tolerance value.
203 \wxheading{Return value
}
205 {\tt true
} if successful,
{\tt false
} otherwise.
209 This operation creates a region that combines all of this region and the second region.
210 The result is stored in this region.
212 \membersection{wxRegion::Xor
}\label{wxregionxor
}
214 \func{bool
}{Xor
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
216 Finds the Xor of this region and another, rectangular region, specified using position and size.
218 \func{bool
}{Xor
}{\param{const wxRect\&
}{ rect
}}
220 Finds the Xor of this region and another, rectangular region.
222 \func{bool
}{Xor
}{\param{const wxRegion\&
}{ region
}}
224 Finds the Xor of this region and another region.
226 \wxheading{Return value
}
228 {\tt true
} if successful,
{\tt false
} otherwise.
232 This operation creates a region that combines all of this region and the second region, except
233 for any overlapping areas. The result is stored in this region.
235 \membersection{wxRegion::operator $=$
}\label{wxregionassign
}
237 \func{void
}{operator $=$
}{\param{const wxRegion\&
}{ region
}}
239 Copies
{\it region
} by reference counting.
241 \section{\class{wxRegionIterator
}}\label{wxregioniterator
}
243 This class is used to iterate through the rectangles in a region,
244 typically when examining the damaged regions of a window within an OnPaint call.
246 To use it, construct an iterator object on the stack and loop through the
247 regions, testing the object and incrementing the iterator at the end of the loop.
249 See
\helpref{wxPaintEvent
}{wxpaintevent
} for an example of use.
251 \wxheading{Derived from
}
253 \helpref{wxObject
}{wxobject
}
255 \wxheading{Include files
}
261 \helpref{wxPaintEvent
}{wxpaintevent
}
263 \latexignore{\rtfignore{\wxheading{Members
}}}
265 \membersection{wxRegionIterator::wxRegionIterator
}
267 \func{}{wxRegionIterator
}{\void}
271 \func{}{wxRegionIterator
}{\param{const wxRegion\&
}{ region
}}
273 Creates an iterator object given a region.
275 \membersection{wxRegionIterator::GetX
}
277 \constfunc{wxCoord
}{GetX
}{\void}
279 Returns the x value for the current region.
281 \membersection{wxRegionIterator::GetY
}
283 \constfunc{wxCoord
}{GetY
}{\void}
285 Returns the y value for the current region.
287 \membersection{wxRegionIterator::GetW
}
289 \constfunc{wxCoord
}{GetW
}{\void}
291 An alias for GetWidth.
293 \membersection{wxRegionIterator::GetWidth
}
295 \constfunc{wxCoord
}{GetWidth
}{\void}
297 Returns the width value for the current region.
299 \membersection{wxRegionIterator::GetH
}
301 \constfunc{wxCoord
}{GetH
}{\void}
303 An alias for GetHeight.
305 \membersection{wxRegionIterator::GetHeight
}
307 \constfunc{wxCoord
}{GetWidth
}{\void}
309 Returns the width value for the current region.
311 \membersection{wxRegionIterator::GetRect
}
313 \constfunc{wxRect
}{GetRect
}{\void}
315 Returns the current rectangle.
317 \membersection{wxRegionIterator::HaveRects
}
319 \constfunc{bool
}{HaveRects
}{\void}
321 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
323 \membersection{wxRegionIterator::Reset
}
325 \func{void
}{Reset
}{\void}
327 Resets the iterator to the beginning of the rectangles.
329 \func{void
}{Reset
}{\param{const wxRegion\&
}{ region
}}
331 Resets the iterator to the given region.
333 \membersection{wxRegionIterator::operator $++$
}
335 \func{void
}{operator $++$
}{\void}
337 Increment operator. Increments the iterator to the next region.
339 \pythonnote{A wxPython alias for this operator is called
{\tt Next
}.
}
341 \membersection{wxRegionIterator::operator bool
}
343 \constfunc{}{operator bool
}{\void}
345 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
347 You can use this to test the iterator object as if it were of type bool.