]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/region.tex
reSWIGged
[wxWidgets.git] / docs / latex / wx / region.tex
CommitLineData
a660d684
KB
1\section{\class{wxRegion}}\label{wxregion}
2
3A wxRegion represents a simple or complex region on a device context or window. It uses
4reference counting, so copying and assignment operations are fast.
5
6\wxheading{Derived from}
7
8\helpref{wxGDIObject}{wxgdiobject}\\
9\helpref{wxObject}{wxobject}
10
954b8ae6
JS
11\wxheading{Include files}
12
13<wx/region.h>
14
76c5df24
JS
15\wxheading{See also}
16
17\helpref{wxRegionIterator}{wxregioniterator}
18
a660d684
KB
19\latexignore{\rtfignore{\wxheading{Members}}}
20
21\membersection{wxRegion::wxRegion}\label{wxregionconstr}
22
23\func{}{wxRegion}{\void}
24
25Default constructor.
26
0fb067bb 27\func{}{wxRegion}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
28
29Constructs a rectangular region with the given position and size.
30
31\func{}{wxRegion}{\param{const wxPoint\&}{ topLeft}, \param{const wxPoint\&}{ bottomRight}}
32
33Constructs a rectangular region from the top left point and the bottom right point.
34
35\func{}{wxRegion}{\param{const wxRect\&}{ rect}}
36
37Constructs a rectangular region a wxRect object.
38
39\func{}{wxRegion}{\param{const wxRegion\&}{ region}}
40
41Constructs a region by copying another region.
42
5549e9f7
VZ
43\func{}{wxRegion}{\param{size\_t}{ n}, \param{const wxPoint }{*points}, \param{int }{fillStyle = wxWINDING\_RULE}}
44
45Constructs a region corresponding to the polygon made of {\it n} points in the
1542ea39 46provided array. {\it fillStyle} parameter may have values
5549e9f7
VZ
47{\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}.
48
fc2171bd 49{\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWidgets ports.
5549e9f7 50
bf43ff9a
VZ
51\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp},
52 \param{const wxColour\&}{ transColour = wxNullColour},
1542ea39
RD
53 \param{int}{ tolerance = 0}}
54
55Constructs a region using the non-transparent pixels of a bitmap. See
56\helpref{Union}{wxregionunion} for more details.
57
58
a660d684
KB
59\membersection{wxRegion::\destruct{wxRegion}}
60
61\func{}{\destruct{wxRegion}}{\void}
62
63Destructor.
64
65\membersection{wxRegion::Clear}\label{wxregionclear}
66
67\func{void}{Clear}{\void}
68
69Clears the current region.
70
71\membersection{wxRegion::Contains}\label{wxregioncontains}
72
73\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}}
74
75Returns a value indicating whether the given point is contained within the region.
76
77\constfunc{wxRegionContain}{Contains}{\param{const wxPoint\&}{ pt}}
78
79Returns a value indicating whether the given point is contained within the region.
80
81\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}}
82
83Returns a value indicating whether the given rectangle is contained within the region.
84
85\constfunc{wxRegionContain}{Contains}{\param{const wxRect\& }{rect}}
86
87Returns a value indicating whether the given rectangle is contained within the region.
88
89\wxheading{Return value}
90
91The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
92
93On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
94all or some part of the region is contained in this region.
95
1542ea39
RD
96\membersection{wxRegion::ConvertToBitmap}\label{wxregionconverttobitmap}
97
98\constfunc{wxBitmap}{ConvertToBitmap}{}
99
819451b6 100Convert the region to a black and white bitmap with the white pixels
1542ea39
RD
101being inside the region.
102
a660d684
KB
103\membersection{wxRegion::GetBox}\label{wxregiongetbox}
104
105\constfunc{void}{GetBox}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}}
106
107Returns the outer bounds of the region.
108
109\constfunc{wxRect}{GetBox}{\void}
110
111Returns the outer bounds of the region.
112
113\membersection{wxRegion::Intersect}\label{wxregionintersect}
114
0fb067bb 115\func{bool}{Intersect}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
116
117Finds the intersection of this region and another, rectangular region, specified using position and size.
118
119\func{bool}{Intersect}{\param{const wxRect\&}{ rect}}
120
121Finds the intersection of this region and another, rectangular region.
122
123\func{bool}{Intersect}{\param{const wxRegion\&}{ region}}
124
125Finds the intersection of this region and another region.
126
127\wxheading{Return value}
128
cc81d32f 129{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
130
131\wxheading{Remarks}
132
133Creates the intersection of the two regions, that is, the parts which are in both regions. The result
134is stored in this region.
135
136\membersection{wxRegion::IsEmpty}\label{wxregionisempty}
137
138\constfunc{bool}{IsEmpty}{\void}
139
cc81d32f 140Returns {\tt true} if the region is empty, {\tt false} otherwise.
a660d684 141
f3339684
VZ
142\membersection{wxRegion::Subtract}\label{wxregionsubstract}
143
a660d684
KB
144\func{bool}{Subtract}{\param{const wxRect\&}{ rect}}
145
146Subtracts a rectangular region from this region.
147
148\func{bool}{Subtract}{\param{const wxRegion\&}{ region}}
149
150Subtracts a region from this region.
151
152\wxheading{Return value}
153
cc81d32f 154{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
155
156\wxheading{Remarks}
157
158This operation combines the parts of 'this' region that are not part of the second region.
159The result is stored in this region.
160
0fb067bb
VZ
161\membersection{wxRegion::Offset}\label{wxregionoffset}
162
163\func{bool}{Offset}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
164
165Moves the region by the specified offsets in horizontal and vertical
166directions.
167
168\wxheading{Return value}
169
cc81d32f 170{\tt true} if successful, {\tt false} otherwise (the region is unchanged then).
0fb067bb 171
a660d684
KB
172\membersection{wxRegion::Union}\label{wxregionunion}
173
0fb067bb 174\func{bool}{Union}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
175
176Finds the union of this region and another, rectangular region, specified using position and size.
177
178\func{bool}{Union}{\param{const wxRect\&}{ rect}}
179
180Finds the union of this region and another, rectangular region.
181
182\func{bool}{Union}{\param{const wxRegion\&}{ region}}
183
184Finds the union of this region and another region.
185
bf43ff9a
VZ
186\func{bool}{Union}{\param{const wxBitmap\&}{ bmp},
187 \param{const wxColour\&}{ transColour = wxNullColour},
1542ea39
RD
188 \param{int}{ tolerance = 0}}
189
190Finds the union of this region and the the non-transparent pixels of a
191bitmap. If the bitmap has a mask then it will be used, otherwise the
192colour to be treated as transparent may be specified, along with an
193optional colour tolerance value.
194
a660d684
KB
195\wxheading{Return value}
196
cc81d32f 197{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
198
199\wxheading{Remarks}
200
201This operation creates a region that combines all of this region and the second region.
202The result is stored in this region.
203
204\membersection{wxRegion::Xor}\label{wxregionxor}
205
0fb067bb 206\func{bool}{Xor}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
207
208Finds the Xor of this region and another, rectangular region, specified using position and size.
209
210\func{bool}{Xor}{\param{const wxRect\&}{ rect}}
211
212Finds the Xor of this region and another, rectangular region.
213
214\func{bool}{Xor}{\param{const wxRegion\&}{ region}}
215
216Finds the Xor of this region and another region.
217
218\wxheading{Return value}
219
cc81d32f 220{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
221
222\wxheading{Remarks}
223
224This operation creates a region that combines all of this region and the second region, except
225for any overlapping areas. The result is stored in this region.
226
227\membersection{wxRegion::operator $=$}\label{wxregionassign}
228
229\func{void}{operator $=$}{\param{const wxRegion\&}{ region}}
230
231Copies {\it region} by reference counting.
232
76c5df24
JS
233\section{\class{wxRegionIterator}}\label{wxregioniterator}
234
235This class is used to iterate through the rectangles in a region,
236typically when examining the damaged regions of a window within an OnPaint call.
237
238To use it, construct an iterator object on the stack and loop through the
239regions, testing the object and incrementing the iterator at the end of the loop.
240
f4fcc291 241See \helpref{wxPaintEvent}{wxpaintevent} for an example of use.
76c5df24
JS
242
243\wxheading{Derived from}
244
245\helpref{wxObject}{wxobject}
246
954b8ae6
JS
247\wxheading{Include files}
248
249<wx/region.h>
250
76c5df24
JS
251\wxheading{See also}
252
f4fcc291 253\helpref{wxPaintEvent}{wxpaintevent}
76c5df24
JS
254
255\latexignore{\rtfignore{\wxheading{Members}}}
256
257\membersection{wxRegionIterator::wxRegionIterator}
258
259\func{}{wxRegionIterator}{\void}
260
261Default constructor.
262
263\func{}{wxRegionIterator}{\param{const wxRegion\&}{ region}}
264
265Creates an iterator object given a region.
266
267\membersection{wxRegionIterator::GetX}
268
0fb067bb 269\constfunc{wxCoord}{GetX}{\void}
76c5df24
JS
270
271Returns the x value for the current region.
272
273\membersection{wxRegionIterator::GetY}
274
0fb067bb 275\constfunc{wxCoord}{GetY}{\void}
76c5df24
JS
276
277Returns the y value for the current region.
278
279\membersection{wxRegionIterator::GetW}
280
0fb067bb 281\constfunc{wxCoord}{GetW}{\void}
76c5df24
JS
282
283An alias for GetWidth.
284
285\membersection{wxRegionIterator::GetWidth}
286
0fb067bb 287\constfunc{wxCoord}{GetWidth}{\void}
76c5df24
JS
288
289Returns the width value for the current region.
290
291\membersection{wxRegionIterator::GetH}
292
0fb067bb 293\constfunc{wxCoord}{GetH}{\void}
76c5df24
JS
294
295An alias for GetHeight.
296
297\membersection{wxRegionIterator::GetHeight}
298
0fb067bb 299\constfunc{wxCoord}{GetWidth}{\void}
76c5df24
JS
300
301Returns the width value for the current region.
302
303\membersection{wxRegionIterator::GetRect}
304
305\constfunc{wxRect}{GetRect}{\void}
306
307Returns the current rectangle.
308
309\membersection{wxRegionIterator::HaveRects}
310
311\constfunc{bool}{HaveRects}{\void}
312
cc81d32f 313Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
76c5df24
JS
314
315\membersection{wxRegionIterator::Reset}
316
317\func{void}{Reset}{\void}
318
319Resets the iterator to the beginning of the rectangles.
320
321\func{void}{Reset}{\param{const wxRegion\&}{ region}}
322
323Resets the iterator to the given region.
324
325\membersection{wxRegionIterator::operator $++$}
326
327\func{void}{operator $++$}{\void}
328
329Increment operator. Increments the iterator to the next region.
330
c9110876 331\pythonnote{A wxPython alias for this operator is called {\tt Next}.}
06d20283 332
76c5df24
JS
333\membersection{wxRegionIterator::operator bool}
334
335\constfunc{}{operator bool}{\void}
336
cc81d32f 337Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
76c5df24
JS
338
339You can use this to test the iterator object as if it were of type bool.
a660d684 340