]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/region.tex
don't declare inline function with dllexport declaration, this provokes mingw32 warni...
[wxWidgets.git] / docs / latex / wx / region.tex
CommitLineData
320bf9ce
WS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: region.tex
3%% Purpose: wxRegion documentation
4%% Author: wxTeam
5%% Created:
6%% RCS-ID: $Id$
7%% Copyright: (c) wxTeam
8%% License: wxWindows license
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
a660d684
KB
11\section{\class{wxRegion}}\label{wxregion}
12
a95bfca7
RR
13A wxRegion represents a simple or complex region on a device context or window.
14
15This class uses \helpref{reference counting and copy-on-write}{trefcount}
16internally so that assignments between two instances of this class are very
17cheap. You can therefore use actual objects instead of pointers without
18efficiency problems. If an instance of this class is changed it will create
19its own data internally so that other instances, which previously shared the
20data using the reference counting, are not affected.
a660d684
KB
21
22\wxheading{Derived from}
23
24\helpref{wxGDIObject}{wxgdiobject}\\
25\helpref{wxObject}{wxobject}
26
954b8ae6
JS
27\wxheading{Include files}
28
29<wx/region.h>
30
76c5df24
JS
31\wxheading{See also}
32
33\helpref{wxRegionIterator}{wxregioniterator}
34
a660d684
KB
35\latexignore{\rtfignore{\wxheading{Members}}}
36
8a16d737 37
39275175 38\membersection{wxRegion::wxRegion}\label{wxregionctor}
a660d684
KB
39
40\func{}{wxRegion}{\void}
41
42Default constructor.
43
0fb067bb 44\func{}{wxRegion}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
45
46Constructs a rectangular region with the given position and size.
47
48\func{}{wxRegion}{\param{const wxPoint\&}{ topLeft}, \param{const wxPoint\&}{ bottomRight}}
49
50Constructs a rectangular region from the top left point and the bottom right point.
51
52\func{}{wxRegion}{\param{const wxRect\&}{ rect}}
53
54Constructs a rectangular region a wxRect object.
55
56\func{}{wxRegion}{\param{const wxRegion\&}{ region}}
57
a91225b2 58Copy constructor, uses \helpref{reference counting}{trefcount}.
a660d684 59
5549e9f7
VZ
60\func{}{wxRegion}{\param{size\_t}{ n}, \param{const wxPoint }{*points}, \param{int }{fillStyle = wxWINDING\_RULE}}
61
62Constructs a region corresponding to the polygon made of {\it n} points in the
1542ea39 63provided array. {\it fillStyle} parameter may have values
5549e9f7
VZ
64{\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}.
65
85f6b408
VS
66\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp}}
67
bf43ff9a 68\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp},
85f6b408 69 \param{const wxColour\&}{ transColour},
8a16d737 70 \param{int}{ tolerance = 0}}
1542ea39
RD
71
72Constructs a region using the non-transparent pixels of a bitmap. See
73\helpref{Union}{wxregionunion} for more details.
74
75
8a16d737 76
39275175 77\membersection{wxRegion::\destruct{wxRegion}}\label{wxregiondtor}
a660d684
KB
78
79\func{}{\destruct{wxRegion}}{\void}
80
81Destructor.
55ccdb93 82See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
a660d684 83
8a16d737 84
a660d684
KB
85\membersection{wxRegion::Clear}\label{wxregionclear}
86
87\func{void}{Clear}{\void}
88
89Clears the current region.
90
8a16d737 91
a660d684
KB
92\membersection{wxRegion::Contains}\label{wxregioncontains}
93
94\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}}
95
96Returns a value indicating whether the given point is contained within the region.
97
98\constfunc{wxRegionContain}{Contains}{\param{const wxPoint\&}{ pt}}
99
100Returns a value indicating whether the given point is contained within the region.
101
102\constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}}
103
104Returns a value indicating whether the given rectangle is contained within the region.
105
106\constfunc{wxRegionContain}{Contains}{\param{const wxRect\& }{rect}}
107
108Returns a value indicating whether the given rectangle is contained within the region.
109
110\wxheading{Return value}
111
112The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
113
114On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
115all or some part of the region is contained in this region.
116
8a16d737 117
1542ea39
RD
118\membersection{wxRegion::ConvertToBitmap}\label{wxregionconverttobitmap}
119
120\constfunc{wxBitmap}{ConvertToBitmap}{}
121
819451b6 122Convert the region to a black and white bitmap with the white pixels
1542ea39
RD
123being inside the region.
124
8a16d737 125
a660d684
KB
126\membersection{wxRegion::GetBox}\label{wxregiongetbox}
127
9a75ba66 128\constfunc{void}{GetBox}{\param{wxCoord\& }{x}, \param{wxCoord\& }{y}, \param{wxCoord\& }{width}, \param{wxCoord\& }{height}}
a660d684
KB
129
130Returns the outer bounds of the region.
131
132\constfunc{wxRect}{GetBox}{\void}
133
134Returns the outer bounds of the region.
135
8a16d737 136
a660d684
KB
137\membersection{wxRegion::Intersect}\label{wxregionintersect}
138
0fb067bb 139\func{bool}{Intersect}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
140
141Finds the intersection of this region and another, rectangular region, specified using position and size.
142
143\func{bool}{Intersect}{\param{const wxRect\&}{ rect}}
144
145Finds the intersection of this region and another, rectangular region.
146
147\func{bool}{Intersect}{\param{const wxRegion\&}{ region}}
148
149Finds the intersection of this region and another region.
150
151\wxheading{Return value}
152
cc81d32f 153{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
154
155\wxheading{Remarks}
156
157Creates the intersection of the two regions, that is, the parts which are in both regions. The result
158is stored in this region.
159
8a16d737 160
a660d684
KB
161\membersection{wxRegion::IsEmpty}\label{wxregionisempty}
162
163\constfunc{bool}{IsEmpty}{\void}
164
cc81d32f 165Returns {\tt true} if the region is empty, {\tt false} otherwise.
a660d684 166
8a16d737
VZ
167
168\membersection{wxRegion::IsEqual}\label{wxregionisequal}
169
170\constfunc{bool}{IsEqual}{\param{const wxRegion\& }{region}}
171
172Returns {\tt true} if the region is equal to, i.e. covers the same area as,
173another one. Note that if both this region and \arg{region} are invalid, they
174are considered to be equal.
175
176
dbd94b75 177\membersection{wxRegion::Subtract}\label{wxregionsubtract}
f3339684 178
a660d684
KB
179\func{bool}{Subtract}{\param{const wxRect\&}{ rect}}
180
181Subtracts a rectangular region from this region.
182
183\func{bool}{Subtract}{\param{const wxRegion\&}{ region}}
184
185Subtracts a region from this region.
186
187\wxheading{Return value}
188
cc81d32f 189{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
190
191\wxheading{Remarks}
192
193This operation combines the parts of 'this' region that are not part of the second region.
194The result is stored in this region.
195
8a16d737 196
0fb067bb
VZ
197\membersection{wxRegion::Offset}\label{wxregionoffset}
198
199\func{bool}{Offset}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
200
8a16d737
VZ
201\func{bool}{Offset}{\param{const wxPoint\& }{ pt}}
202
0fb067bb
VZ
203Moves the region by the specified offsets in horizontal and vertical
204directions.
205
206\wxheading{Return value}
207
cc81d32f 208{\tt true} if successful, {\tt false} otherwise (the region is unchanged then).
0fb067bb 209
8a16d737 210
a660d684
KB
211\membersection{wxRegion::Union}\label{wxregionunion}
212
0fb067bb 213\func{bool}{Union}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
214
215Finds the union of this region and another, rectangular region, specified using position and size.
216
217\func{bool}{Union}{\param{const wxRect\&}{ rect}}
218
219Finds the union of this region and another, rectangular region.
220
221\func{bool}{Union}{\param{const wxRegion\&}{ region}}
222
223Finds the union of this region and another region.
224
85f6b408
VS
225\func{bool}{Union}{\param{const wxBitmap\&}{ bmp}}
226
43e8916f 227Finds the union of this region and the non-transparent pixels of a
85f6b408
VS
228bitmap. Bitmap's mask is used to determine transparency. If the bitmap doesn't
229have a mask, solid rectangle of bitmap's dimensions is used.
230
bf43ff9a 231\func{bool}{Union}{\param{const wxBitmap\&}{ bmp},
85f6b408 232 \param{const wxColour\&}{ transColour},
8a16d737 233 \param{int}{ tolerance = 0}}
1542ea39 234
43e8916f 235Finds the union of this region and the non-transparent pixels of a
85f6b408
VS
236bitmap. Colour to be treated as transparent is specified in the
237\arg{transColour} argument, along with an
1542ea39
RD
238optional colour tolerance value.
239
a660d684
KB
240\wxheading{Return value}
241
cc81d32f 242{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
243
244\wxheading{Remarks}
245
246This operation creates a region that combines all of this region and the second region.
247The result is stored in this region.
248
8a16d737 249
a660d684
KB
250\membersection{wxRegion::Xor}\label{wxregionxor}
251
0fb067bb 252\func{bool}{Xor}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
a660d684
KB
253
254Finds the Xor of this region and another, rectangular region, specified using position and size.
255
256\func{bool}{Xor}{\param{const wxRect\&}{ rect}}
257
258Finds the Xor of this region and another, rectangular region.
259
260\func{bool}{Xor}{\param{const wxRegion\&}{ region}}
261
262Finds the Xor of this region and another region.
263
264\wxheading{Return value}
265
cc81d32f 266{\tt true} if successful, {\tt false} otherwise.
a660d684
KB
267
268\wxheading{Remarks}
269
270This operation creates a region that combines all of this region and the second region, except
271for any overlapping areas. The result is stored in this region.
272
8a16d737 273
a660d684
KB
274\membersection{wxRegion::operator $=$}\label{wxregionassign}
275
276\func{void}{operator $=$}{\param{const wxRegion\&}{ region}}
277
a91225b2
RR
278Assignment operator, using \helpref{reference counting}{trefcount}.
279
280
a660d684 281
76c5df24
JS
282\section{\class{wxRegionIterator}}\label{wxregioniterator}
283
284This class is used to iterate through the rectangles in a region,
285typically when examining the damaged regions of a window within an OnPaint call.
286
287To use it, construct an iterator object on the stack and loop through the
288regions, testing the object and incrementing the iterator at the end of the loop.
289
f4fcc291 290See \helpref{wxPaintEvent}{wxpaintevent} for an example of use.
76c5df24
JS
291
292\wxheading{Derived from}
293
294\helpref{wxObject}{wxobject}
295
954b8ae6
JS
296\wxheading{Include files}
297
298<wx/region.h>
299
76c5df24
JS
300\wxheading{See also}
301
f4fcc291 302\helpref{wxPaintEvent}{wxpaintevent}
76c5df24
JS
303
304\latexignore{\rtfignore{\wxheading{Members}}}
305
8a16d737 306
39275175 307\membersection{wxRegionIterator::wxRegionIterator}\label{wxregioniteratorctor}
76c5df24
JS
308
309\func{}{wxRegionIterator}{\void}
310
311Default constructor.
312
313\func{}{wxRegionIterator}{\param{const wxRegion\&}{ region}}
314
315Creates an iterator object given a region.
316
8a16d737 317
39275175 318\membersection{wxRegionIterator::GetX}\label{wxregioniteratorgetx}
76c5df24 319
0fb067bb 320\constfunc{wxCoord}{GetX}{\void}
76c5df24
JS
321
322Returns the x value for the current region.
323
8a16d737 324
39275175 325\membersection{wxRegionIterator::GetY}\label{wxregioniteratorgety}
76c5df24 326
0fb067bb 327\constfunc{wxCoord}{GetY}{\void}
76c5df24
JS
328
329Returns the y value for the current region.
330
8a16d737 331
39275175 332\membersection{wxRegionIterator::GetW}\label{wxregioniteratorgetw}
76c5df24 333
0fb067bb 334\constfunc{wxCoord}{GetW}{\void}
76c5df24
JS
335
336An alias for GetWidth.
337
8a16d737 338
f6e9a818 339\membersection{wxRegionIterator::GetHeight}\label{wxregioniteratorgetheight}
76c5df24 340
f6e9a818 341\constfunc{wxCoord}{GetHeight}{\void}
76c5df24 342
f6e9a818 343Returns the height value for the current region.
76c5df24 344
8a16d737 345
39275175 346\membersection{wxRegionIterator::GetH}\label{wxregioniteratorgeth}
76c5df24 347
0fb067bb 348\constfunc{wxCoord}{GetH}{\void}
76c5df24
JS
349
350An alias for GetHeight.
351
8a16d737 352
39275175 353\membersection{wxRegionIterator::GetRect}\label{wxregioniteratorgetrect}
76c5df24
JS
354
355\constfunc{wxRect}{GetRect}{\void}
356
357Returns the current rectangle.
358
8a16d737 359
f6e9a818
RN
360\membersection{wxRegionIterator::GetWidth}\label{wxregioniteratorgetwidth}
361
362\constfunc{wxCoord}{GetWidth}{\void}
363
364Returns the width value for the current region.
365
8a16d737 366
39275175 367\membersection{wxRegionIterator::HaveRects}\label{wxregioniteratorhaverects}
76c5df24
JS
368
369\constfunc{bool}{HaveRects}{\void}
370
cc81d32f 371Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
76c5df24 372
8a16d737 373
39275175 374\membersection{wxRegionIterator::Reset}\label{wxregioniteratorreset}
76c5df24
JS
375
376\func{void}{Reset}{\void}
377
378Resets the iterator to the beginning of the rectangles.
379
380\func{void}{Reset}{\param{const wxRegion\&}{ region}}
381
382Resets the iterator to the given region.
383
8a16d737 384
39275175 385\membersection{wxRegionIterator::operator $++$}\label{wxregioniteratorinc}
76c5df24
JS
386
387\func{void}{operator $++$}{\void}
388
389Increment operator. Increments the iterator to the next region.
390
c9110876 391\pythonnote{A wxPython alias for this operator is called {\tt Next}.}
06d20283 392
8a16d737 393
39275175 394\membersection{wxRegionIterator::operator bool}\label{wxregioniteratorbool}
76c5df24
JS
395
396\constfunc{}{operator bool}{\void}
397
cc81d32f 398Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
76c5df24
JS
399
400You can use this to test the iterator object as if it were of type bool.
59b48b46 401