]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/region.tex
Added default value for "pos" parameter in constructor and Create function.
[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
39275175 21\membersection{wxRegion::wxRegion}\label{wxregionctor}
a660d684
KB
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
85f6b408
VS
51\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp}}
52
bf43ff9a 53\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp},
85f6b408 54 \param{const wxColour\&}{ transColour},
1542ea39
RD
55 \param{int}{ tolerance = 0}}
56
57Constructs a region using the non-transparent pixels of a bitmap. See
58\helpref{Union}{wxregionunion} for more details.
59
60
39275175 61\membersection{wxRegion::\destruct{wxRegion}}\label{wxregiondtor}
a660d684
KB
62
63\func{}{\destruct{wxRegion}}{\void}
64
65Destructor.
66
67\membersection{wxRegion::Clear}\label{wxregionclear}
68
69\func{void}{Clear}{\void}
70
71Clears the current region.
72
73\membersection{wxRegion::Contains}\label{wxregioncontains}
74
75\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}}
76
77Returns a value indicating whether the given point is contained within the region.
78
79\constfunc{wxRegionContain}{Contains}{\param{const wxPoint\&}{ pt}}
80
81Returns a value indicating whether the given point is contained within the region.
82
83\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}}
84
85Returns a value indicating whether the given rectangle is contained within the region.
86
87\constfunc{wxRegionContain}{Contains}{\param{const wxRect\& }{rect}}
88
89Returns a value indicating whether the given rectangle is contained within the region.
90
91\wxheading{Return value}
92
93The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
94
95On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
96all or some part of the region is contained in this region.
97
1542ea39
RD
98\membersection{wxRegion::ConvertToBitmap}\label{wxregionconverttobitmap}
99
100\constfunc{wxBitmap}{ConvertToBitmap}{}
101
819451b6 102Convert the region to a black and white bitmap with the white pixels
1542ea39
RD
103being inside the region.
104
a660d684
KB
105\membersection{wxRegion::GetBox}\label{wxregiongetbox}
106
9a75ba66 107\constfunc{void}{GetBox}{\param{wxCoord\& }{x}, \param{wxCoord\& }{y}, \param{wxCoord\& }{width}, \param{wxCoord\& }{height}}
a660d684
KB
108
109Returns the outer bounds of the region.
110
111\constfunc{wxRect}{GetBox}{\void}
112
113Returns the outer bounds of the region.
114
115\membersection{wxRegion::Intersect}\label{wxregionintersect}
116
0fb067bb 117\func{bool}{Intersect}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
118
119Finds the intersection of this region and another, rectangular region, specified using position and size.
120
121\func{bool}{Intersect}{\param{const wxRect\&}{ rect}}
122
123Finds the intersection of this region and another, rectangular region.
124
125\func{bool}{Intersect}{\param{const wxRegion\&}{ region}}
126
127Finds the intersection of this region and another region.
128
129\wxheading{Return value}
130
cc81d32f 131{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
132
133\wxheading{Remarks}
134
135Creates the intersection of the two regions, that is, the parts which are in both regions. The result
136is stored in this region.
137
138\membersection{wxRegion::IsEmpty}\label{wxregionisempty}
139
140\constfunc{bool}{IsEmpty}{\void}
141
cc81d32f 142Returns {\tt true} if the region is empty, {\tt false} otherwise.
a660d684 143
dbd94b75 144\membersection{wxRegion::Subtract}\label{wxregionsubtract}
f3339684 145
a660d684
KB
146\func{bool}{Subtract}{\param{const wxRect\&}{ rect}}
147
148Subtracts a rectangular region from this region.
149
150\func{bool}{Subtract}{\param{const wxRegion\&}{ region}}
151
152Subtracts a region from this region.
153
154\wxheading{Return value}
155
cc81d32f 156{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
157
158\wxheading{Remarks}
159
160This operation combines the parts of 'this' region that are not part of the second region.
161The result is stored in this region.
162
0fb067bb
VZ
163\membersection{wxRegion::Offset}\label{wxregionoffset}
164
165\func{bool}{Offset}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
166
167Moves the region by the specified offsets in horizontal and vertical
168directions.
169
170\wxheading{Return value}
171
cc81d32f 172{\tt true} if successful, {\tt false} otherwise (the region is unchanged then).
0fb067bb 173
a660d684
KB
174\membersection{wxRegion::Union}\label{wxregionunion}
175
0fb067bb 176\func{bool}{Union}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
177
178Finds the union of this region and another, rectangular region, specified using position and size.
179
180\func{bool}{Union}{\param{const wxRect\&}{ rect}}
181
182Finds the union of this region and another, rectangular region.
183
184\func{bool}{Union}{\param{const wxRegion\&}{ region}}
185
186Finds the union of this region and another region.
187
85f6b408
VS
188\func{bool}{Union}{\param{const wxBitmap\&}{ bmp}}
189
43e8916f 190Finds the union of this region and the non-transparent pixels of a
85f6b408
VS
191bitmap. Bitmap's mask is used to determine transparency. If the bitmap doesn't
192have a mask, solid rectangle of bitmap's dimensions is used.
193
bf43ff9a 194\func{bool}{Union}{\param{const wxBitmap\&}{ bmp},
85f6b408 195 \param{const wxColour\&}{ transColour},
1542ea39
RD
196 \param{int}{ tolerance = 0}}
197
43e8916f 198Finds the union of this region and the non-transparent pixels of a
85f6b408
VS
199bitmap. Colour to be treated as transparent is specified in the
200\arg{transColour} argument, along with an
1542ea39
RD
201optional colour tolerance value.
202
a660d684
KB
203\wxheading{Return value}
204
cc81d32f 205{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
206
207\wxheading{Remarks}
208
209This operation creates a region that combines all of this region and the second region.
210The result is stored in this region.
211
212\membersection{wxRegion::Xor}\label{wxregionxor}
213
0fb067bb 214\func{bool}{Xor}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
215
216Finds the Xor of this region and another, rectangular region, specified using position and size.
217
218\func{bool}{Xor}{\param{const wxRect\&}{ rect}}
219
220Finds the Xor of this region and another, rectangular region.
221
222\func{bool}{Xor}{\param{const wxRegion\&}{ region}}
223
224Finds the Xor of this region and another region.
225
226\wxheading{Return value}
227
cc81d32f 228{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
229
230\wxheading{Remarks}
231
232This operation creates a region that combines all of this region and the second region, except
233for any overlapping areas. The result is stored in this region.
234
235\membersection{wxRegion::operator $=$}\label{wxregionassign}
236
237\func{void}{operator $=$}{\param{const wxRegion\&}{ region}}
238
239Copies {\it region} by reference counting.
240
76c5df24
JS
241\section{\class{wxRegionIterator}}\label{wxregioniterator}
242
243This class is used to iterate through the rectangles in a region,
244typically when examining the damaged regions of a window within an OnPaint call.
245
246To use it, construct an iterator object on the stack and loop through the
247regions, testing the object and incrementing the iterator at the end of the loop.
248
f4fcc291 249See \helpref{wxPaintEvent}{wxpaintevent} for an example of use.
76c5df24
JS
250
251\wxheading{Derived from}
252
253\helpref{wxObject}{wxobject}
254
954b8ae6
JS
255\wxheading{Include files}
256
257<wx/region.h>
258
76c5df24
JS
259\wxheading{See also}
260
f4fcc291 261\helpref{wxPaintEvent}{wxpaintevent}
76c5df24
JS
262
263\latexignore{\rtfignore{\wxheading{Members}}}
264
39275175 265\membersection{wxRegionIterator::wxRegionIterator}\label{wxregioniteratorctor}
76c5df24
JS
266
267\func{}{wxRegionIterator}{\void}
268
269Default constructor.
270
271\func{}{wxRegionIterator}{\param{const wxRegion\&}{ region}}
272
273Creates an iterator object given a region.
274
39275175 275\membersection{wxRegionIterator::GetX}\label{wxregioniteratorgetx}
76c5df24 276
0fb067bb 277\constfunc{wxCoord}{GetX}{\void}
76c5df24
JS
278
279Returns the x value for the current region.
280
39275175 281\membersection{wxRegionIterator::GetY}\label{wxregioniteratorgety}
76c5df24 282
0fb067bb 283\constfunc{wxCoord}{GetY}{\void}
76c5df24
JS
284
285Returns the y value for the current region.
286
39275175 287\membersection{wxRegionIterator::GetW}\label{wxregioniteratorgetw}
76c5df24 288
0fb067bb 289\constfunc{wxCoord}{GetW}{\void}
76c5df24
JS
290
291An alias for GetWidth.
292
f6e9a818 293\membersection{wxRegionIterator::GetHeight}\label{wxregioniteratorgetheight}
76c5df24 294
f6e9a818 295\constfunc{wxCoord}{GetHeight}{\void}
76c5df24 296
f6e9a818 297Returns the height value for the current region.
76c5df24 298
39275175 299\membersection{wxRegionIterator::GetH}\label{wxregioniteratorgeth}
76c5df24 300
0fb067bb 301\constfunc{wxCoord}{GetH}{\void}
76c5df24
JS
302
303An alias for GetHeight.
304
39275175 305\membersection{wxRegionIterator::GetRect}\label{wxregioniteratorgetrect}
76c5df24
JS
306
307\constfunc{wxRect}{GetRect}{\void}
308
309Returns the current rectangle.
310
f6e9a818
RN
311\membersection{wxRegionIterator::GetWidth}\label{wxregioniteratorgetwidth}
312
313\constfunc{wxCoord}{GetWidth}{\void}
314
315Returns the width value for the current region.
316
39275175 317\membersection{wxRegionIterator::HaveRects}\label{wxregioniteratorhaverects}
76c5df24
JS
318
319\constfunc{bool}{HaveRects}{\void}
320
cc81d32f 321Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
76c5df24 322
39275175 323\membersection{wxRegionIterator::Reset}\label{wxregioniteratorreset}
76c5df24
JS
324
325\func{void}{Reset}{\void}
326
327Resets the iterator to the beginning of the rectangles.
328
329\func{void}{Reset}{\param{const wxRegion\&}{ region}}
330
331Resets the iterator to the given region.
332
39275175 333\membersection{wxRegionIterator::operator $++$}\label{wxregioniteratorinc}
76c5df24
JS
334
335\func{void}{operator $++$}{\void}
336
337Increment operator. Increments the iterator to the next region.
338
c9110876 339\pythonnote{A wxPython alias for this operator is called {\tt Next}.}
06d20283 340
39275175 341\membersection{wxRegionIterator::operator bool}\label{wxregioniteratorbool}
76c5df24
JS
342
343\constfunc{}{operator bool}{\void}
344
cc81d32f 345Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
76c5df24
JS
346
347You can use this to test the iterator object as if it were of type bool.
a660d684 348