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}
68 See
\helpref{reference-counted object destruction
}{refcountdestruct
} for more info.
71 \membersection{wxRegion::Clear
}\label{wxregionclear
}
73 \func{void
}{Clear
}{\void}
75 Clears the current region.
78 \membersection{wxRegion::Contains
}\label{wxregioncontains
}
80 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
}}
82 Returns a value indicating whether the given point is contained within the region.
84 \constfunc{wxRegionContain
}{Contains
}{\param{const wxPoint\&
}{ pt
}}
86 Returns a value indicating whether the given point is contained within the region.
88 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
90 Returns a value indicating whether the given rectangle is contained within the region.
92 \constfunc{wxRegionContain
}{Contains
}{\param{const wxRect\&
}{rect
}}
94 Returns a value indicating whether the given rectangle is contained within the region.
96 \wxheading{Return value
}
98 The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
100 On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
101 all or some part of the region is contained in this region.
104 \membersection{wxRegion::ConvertToBitmap
}\label{wxregionconverttobitmap
}
106 \constfunc{wxBitmap
}{ConvertToBitmap
}{}
108 Convert the region to a black and white bitmap with the white pixels
109 being inside the region.
112 \membersection{wxRegion::GetBox
}\label{wxregiongetbox
}
114 \constfunc{void
}{GetBox
}{\param{wxCoord\&
}{x
},
\param{wxCoord\&
}{y
},
\param{wxCoord\&
}{width
},
\param{wxCoord\&
}{height
}}
116 Returns the outer bounds of the region.
118 \constfunc{wxRect
}{GetBox
}{\void}
120 Returns the outer bounds of the region.
123 \membersection{wxRegion::Intersect
}\label{wxregionintersect
}
125 \func{bool
}{Intersect
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
127 Finds the intersection of this region and another, rectangular region, specified using position and size.
129 \func{bool
}{Intersect
}{\param{const wxRect\&
}{ rect
}}
131 Finds the intersection of this region and another, rectangular region.
133 \func{bool
}{Intersect
}{\param{const wxRegion\&
}{ region
}}
135 Finds the intersection of this region and another region.
137 \wxheading{Return value
}
139 {\tt true
} if successful,
{\tt false
} otherwise.
143 Creates the intersection of the two regions, that is, the parts which are in both regions. The result
144 is stored in this region.
147 \membersection{wxRegion::IsEmpty
}\label{wxregionisempty
}
149 \constfunc{bool
}{IsEmpty
}{\void}
151 Returns
{\tt true
} if the region is empty,
{\tt false
} otherwise.
154 \membersection{wxRegion::IsEqual
}\label{wxregionisequal
}
156 \constfunc{bool
}{IsEqual
}{\param{const wxRegion\&
}{region
}}
158 Returns
{\tt true
} if the region is equal to, i.e. covers the same area as,
159 another one. Note that if both this region and
\arg{region
} are invalid, they
160 are considered to be equal.
163 \membersection{wxRegion::Subtract
}\label{wxregionsubtract
}
165 \func{bool
}{Subtract
}{\param{const wxRect\&
}{ rect
}}
167 Subtracts a rectangular region from this region.
169 \func{bool
}{Subtract
}{\param{const wxRegion\&
}{ region
}}
171 Subtracts a region from this region.
173 \wxheading{Return value
}
175 {\tt true
} if successful,
{\tt false
} otherwise.
179 This operation combines the parts of 'this' region that are not part of the second region.
180 The result is stored in this region.
183 \membersection{wxRegion::Offset
}\label{wxregionoffset
}
185 \func{bool
}{Offset
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
}}
187 \func{bool
}{Offset
}{\param{const wxPoint\&
}{ pt
}}
189 Moves the region by the specified offsets in horizontal and vertical
192 \wxheading{Return value
}
194 {\tt true
} if successful,
{\tt false
} otherwise (the region is unchanged then).
197 \membersection{wxRegion::Union
}\label{wxregionunion
}
199 \func{bool
}{Union
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
201 Finds the union of this region and another, rectangular region, specified using position and size.
203 \func{bool
}{Union
}{\param{const wxRect\&
}{ rect
}}
205 Finds the union of this region and another, rectangular region.
207 \func{bool
}{Union
}{\param{const wxRegion\&
}{ region
}}
209 Finds the union of this region and another region.
211 \func{bool
}{Union
}{\param{const wxBitmap\&
}{ bmp
}}
213 Finds the union of this region and the non-transparent pixels of a
214 bitmap. Bitmap's mask is used to determine transparency. If the bitmap doesn't
215 have a mask, solid rectangle of bitmap's dimensions is used.
217 \func{bool
}{Union
}{\param{const wxBitmap\&
}{ bmp
},
218 \param{const wxColour\&
}{ transColour
},
219 \param{int
}{ tolerance =
0}}
221 Finds the union of this region and the non-transparent pixels of a
222 bitmap. Colour to be treated as transparent is specified in the
223 \arg{transColour
} argument, along with an
224 optional colour tolerance value.
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.
233 The result is stored in this region.
236 \membersection{wxRegion::Xor
}\label{wxregionxor
}
238 \func{bool
}{Xor
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
240 Finds the Xor of this region and another, rectangular region, specified using position and size.
242 \func{bool
}{Xor
}{\param{const wxRect\&
}{ rect
}}
244 Finds the Xor of this region and another, rectangular region.
246 \func{bool
}{Xor
}{\param{const wxRegion\&
}{ region
}}
248 Finds the Xor of this region and another region.
250 \wxheading{Return value
}
252 {\tt true
} if successful,
{\tt false
} otherwise.
256 This operation creates a region that combines all of this region and the second region, except
257 for any overlapping areas. The result is stored in this region.
260 \membersection{wxRegion::operator $=$
}\label{wxregionassign
}
262 \func{void
}{operator $=$
}{\param{const wxRegion\&
}{ region
}}
264 Assignment operator, using
\helpref{reference counting
}{trefcount
}.
268 \section{\class{wxRegionIterator
}}\label{wxregioniterator
}
270 This class is used to iterate through the rectangles in a region,
271 typically when examining the damaged regions of a window within an OnPaint call.
273 To use it, construct an iterator object on the stack and loop through the
274 regions, testing the object and incrementing the iterator at the end of the loop.
276 See
\helpref{wxPaintEvent
}{wxpaintevent
} for an example of use.
278 \wxheading{Derived from
}
280 \helpref{wxObject
}{wxobject
}
282 \wxheading{Include files
}
288 \helpref{wxPaintEvent
}{wxpaintevent
}
290 \latexignore{\rtfignore{\wxheading{Members
}}}
293 \membersection{wxRegionIterator::wxRegionIterator
}\label{wxregioniteratorctor
}
295 \func{}{wxRegionIterator
}{\void}
299 \func{}{wxRegionIterator
}{\param{const wxRegion\&
}{ region
}}
301 Creates an iterator object given a region.
304 \membersection{wxRegionIterator::GetX
}\label{wxregioniteratorgetx
}
306 \constfunc{wxCoord
}{GetX
}{\void}
308 Returns the x value for the current region.
311 \membersection{wxRegionIterator::GetY
}\label{wxregioniteratorgety
}
313 \constfunc{wxCoord
}{GetY
}{\void}
315 Returns the y value for the current region.
318 \membersection{wxRegionIterator::GetW
}\label{wxregioniteratorgetw
}
320 \constfunc{wxCoord
}{GetW
}{\void}
322 An alias for GetWidth.
325 \membersection{wxRegionIterator::GetHeight
}\label{wxregioniteratorgetheight
}
327 \constfunc{wxCoord
}{GetHeight
}{\void}
329 Returns the height value for the current region.
332 \membersection{wxRegionIterator::GetH
}\label{wxregioniteratorgeth
}
334 \constfunc{wxCoord
}{GetH
}{\void}
336 An alias for GetHeight.
339 \membersection{wxRegionIterator::GetRect
}\label{wxregioniteratorgetrect
}
341 \constfunc{wxRect
}{GetRect
}{\void}
343 Returns the current rectangle.
346 \membersection{wxRegionIterator::GetWidth
}\label{wxregioniteratorgetwidth
}
348 \constfunc{wxCoord
}{GetWidth
}{\void}
350 Returns the width value for the current region.
353 \membersection{wxRegionIterator::HaveRects
}\label{wxregioniteratorhaverects
}
355 \constfunc{bool
}{HaveRects
}{\void}
357 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
360 \membersection{wxRegionIterator::Reset
}\label{wxregioniteratorreset
}
362 \func{void
}{Reset
}{\void}
364 Resets the iterator to the beginning of the rectangles.
366 \func{void
}{Reset
}{\param{const wxRegion\&
}{ region
}}
368 Resets the iterator to the given region.
371 \membersection{wxRegionIterator::operator $++$
}\label{wxregioniteratorinc
}
373 \func{void
}{operator $++$
}{\void}
375 Increment operator. Increments the iterator to the next region.
377 \pythonnote{A wxPython alias for this operator is called
{\tt Next
}.
}
380 \membersection{wxRegionIterator::operator bool
}\label{wxregioniteratorbool
}
382 \constfunc{}{operator bool
}{\void}
384 Returns
{\tt true
} if there are still some rectangles; otherwise returns
{\tt false
}.
386 You can use this to test the iterator object as if it were of type bool.