summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqregion.3qt
blob: c88f2760b9e403bb7f6ed91cb5a333ef339d4293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
'\" t
.TH TQRegion 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQRegion \- Clip region for a painter
.SH SYNOPSIS
\fC#include <tqregion.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBRegionType\fR { Rectangle, Ellipse }"
.br
.ti -1c
.BI "\fBTQRegion\fR ()"
.br
.ti -1c
.BI "\fBTQRegion\fR ( int x, int y, int w, int h, RegionType t = Rectangle )"
.br
.ti -1c
.BI "\fBTQRegion\fR ( const TQRect & r, RegionType t = Rectangle )"
.br
.ti -1c
.BI "\fBTQRegion\fR ( const TQPointArray & a, bool winding = FALSE )"
.br
.ti -1c
.BI "\fBTQRegion\fR ( const TQRegion & r )"
.br
.ti -1c
.BI "\fBTQRegion\fR ( const TQBitmap & bm )"
.br
.ti -1c
.BI "\fB~TQRegion\fR ()"
.br
.ti -1c
.BI "TQRegion & \fBoperator=\fR ( const TQRegion & r )"
.br
.ti -1c
.BI "bool \fBisNull\fR () const"
.br
.ti -1c
.BI "bool \fBisEmpty\fR () const"
.br
.ti -1c
.BI "bool \fBcontains\fR ( const TQPoint & p ) const"
.br
.ti -1c
.BI "bool \fBcontains\fR ( const TQRect & r ) const"
.br
.ti -1c
.BI "void \fBtranslate\fR ( int dx, int dy )"
.br
.ti -1c
.BI "TQRegion \fBunite\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "TQRegion \fBintersect\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "TQRegion \fBsubtract\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "TQRegion \fBeor\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "TQRect \fBboundingRect\fR () const"
.br
.ti -1c
.BI "TQMemArray<TQRect> \fBrects\fR () const"
.br
.ti -1c
.BI "const TQRegion \fBoperator|\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "const TQRegion \fBoperator+\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "const TQRegion \fBoperator&\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "const TQRegion \fBoperator-\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "const TQRegion \fBoperator^\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "TQRegion & \fBoperator|=\fR ( const TQRegion & r )"
.br
.ti -1c
.BI "TQRegion & \fBoperator+=\fR ( const TQRegion & r )"
.br
.ti -1c
.BI "TQRegion & \fBoperator&=\fR ( const TQRegion & r )"
.br
.ti -1c
.BI "TQRegion & \fBoperator-=\fR ( const TQRegion & r )"
.br
.ti -1c
.BI "TQRegion & \fBoperator^=\fR ( const TQRegion & r )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const TQRegion & r ) const"
.br
.ti -1c
.BI "HRGN \fBhandle\fR () const"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "TQDataStream & \fBoperator<<\fR ( TQDataStream & s, const TQRegion & r )"
.br
.ti -1c
.BI "TQDataStream & \fBoperator>>\fR ( TQDataStream & s, TQRegion & r )"
.br
.in -1c
.SH DESCRIPTION
The TQRegion class specifies a clip region for a painter.
.PP
TQRegion is used with TQPainter::setClipRegion() to limit the paint area to what needs to be painted. There is also a TQWidget::repaint() that takes a TQRegion parameter. TQRegion is the best tool for reducing flicker.
.PP
A region can be created from a rectangle, an ellipse, a polygon or a bitmap. Complex regions may be created by combining simple regions using unite(), intersect(), subtract() or eor() (exclusive or). You can move a region using translate().
.PP
You can test whether a region isNull(), isEmpty() or if it contains() a TQPoint or TQRect. The bounding rectangle is given by boundingRect().
.PP
The function rects() gives a decomposition of the region into rectangles.
.PP
Example of using complex regions:
.PP
.nf
.br
        void MyWidget::paintEvent( TQPaintEvent * )
.br
        {
.br
            TQPainter p;                         // our painter
.br
            TQRegion r1( TQRect(100,100,200,80),  // r1 = elliptic region
.br
                        TQRegion::Ellipse );
.br
            TQRegion r2( TQRect(100,120,90,30) ); // r2 = rectangular region
.br
            TQRegion r3 = r1.intersect( r2 );    // r3 = intersection
.br
            p.begin( this );                    // start painting widget
.br
            p.setClipRegion( r3 );              // set clip region
.br
            ...                                 // paint clipped graphics
.br
            p.end();                            // painting done
.br
        }
.br
.fi
.PP
TQRegion is an implicitly shared class.
.PP
\fBWarning:\fR Due to window system limitations, the whole coordinate space for a region is limited to the points between -32767 and 32767 on Mac OS X and Windows 95/98/ME.
.PP
See also TQPainter::setClipRegion(), TQPainter::setClipRect(), Graphics Classes, and Image Processing Classes.
.SS "Member Type Documentation"
.SH "TQRegion::RegionType"
Specifies the shape of the region to be created.
.TP
\fCTQRegion::Rectangle\fR - the region covers the entire rectangle.
.TP
\fCTQRegion::Ellipse\fR - the region is an ellipse inside the rectangle.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQRegion::TQRegion ()"
Constructs a null region.
.PP
See also isNull().
.SH "TQRegion::TQRegion ( int x, int y, int w, int h, RegionType t = Rectangle )"
Constructs a rectangular or elliptic region.
.PP
If \fIt\fR is Rectangle, the region is the filled rectangle (\fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR). If \fIt\fR is Ellipse, the region is the filled ellipse with center at (\fIx\fR + \fIw\fR / 2, \fIy\fR + \fIh\fR / 2) and size (\fIw\fR ,\fIh\fR ).
.SH "TQRegion::TQRegion ( const TQRect & r, RegionType t = Rectangle )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Create a region based on the rectange \fIr\fR with region type \fIt\fR.
.PP
If the rectangle is invalid a null region will be created.
.PP
See also TQRegion::RegionType.
.SH "TQRegion::TQRegion ( const TQPointArray & a, bool winding = FALSE )"
Constructs a polygon region from the point array \fIa\fR.
.PP
If \fIwinding\fR is TRUE, the polygon region is filled using the winding algorithm, otherwise the default even-odd fill algorithm is used.
.PP
This constructor may create complex regions that will slow down painting when used.
.SH "TQRegion::TQRegion ( const TQRegion & r )"
Constructs a new region which is equal to region \fIr\fR.
.SH "TQRegion::TQRegion ( const TQBitmap & bm )"
Constructs a region from the bitmap \fIbm\fR.
.PP
The resulting region consists of the pixels in bitmap \fIbm\fR that are \fCcolor1\fR, as if each pixel was a 1 by 1 rectangle.
.PP
This constructor may create complex regions that will slow down painting when used. Note that drawing masked pixmaps can be done much faster using TQPixmap::setMask().
.SH "TQRegion::~TQRegion ()"
Destroys the region.
.SH "TQRect TQRegion::boundingRect () const"
Returns the bounding rectangle of this region. An empty region gives a rectangle that is TQRect::isNull().
.SH "bool TQRegion::contains ( const TQPoint & p ) const"
Returns TRUE if the region contains the point \fIp\fR; otherwise returns FALSE.
.SH "bool TQRegion::contains ( const TQRect & r ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the region overlaps the rectangle \fIr\fR; otherwise returns FALSE.
.SH "TQRegion TQRegion::eor ( const TQRegion & r ) const"
Returns a region which is the exclusive or (XOR) of this region and \fIr\fR.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
The figure shows the exclusive or of two elliptical regions.
.SH "HRGN TQRegion::handle () const"
Returns the region's handle.
.SH "TQRegion TQRegion::intersect ( const TQRegion & r ) const"
Returns a region which is the intersection of this region and \fIr\fR.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
The figure shows the intersection of two elliptical regions.
.SH "bool TQRegion::isEmpty () const"
Returns TRUE if the region is empty; otherwise returns FALSE. An empty region is a region that contains no points.
.PP
Example:
.PP
.nf
.br
        TQRegion r1( 10, 10, 20, 20 );
.br
        TQRegion r2( 40, 40, 20, 20 );
.br
        TQRegion r3;
.br
        r1.isNull();             // FALSE
.br
        r1.isEmpty();            // FALSE
.br
        r3.isNull();             // TRUE
.br
        r3.isEmpty();            // TRUE
.br
        r3 = r1.intersect( r2 ); // r3 = intersection of r1 and r2
.br
        r3.isNull();             // FALSE
.br
        r3.isEmpty();            // TRUE
.br
        r3 = r1.unite( r2 );     // r3 = union of r1 and r2
.br
        r3.isNull();             // FALSE
.br
        r3.isEmpty();            // FALSE
.br
.fi
.PP
See also isNull().
.SH "bool TQRegion::isNull () const"
Returns TRUE if the region is a null region; otherwise returns FALSE.
.PP
A null region is a region that has not been initialized. A null region is always empty.
.PP
See also isEmpty().
.SH "bool TQRegion::operator!= ( const TQRegion & r ) const"
Returns TRUE if the region is different from \fIr\fR; otherwise returns FALSE.
.SH "const TQRegion TQRegion::operator& ( const TQRegion & r ) const"
Applies the intersect() function to this region and \fIr\fR. \fCr1&r2\fR is equivalent to \fCr1.intersect(r2)\fR
.PP
See also intersect().
.SH "TQRegion & TQRegion::operator&= ( const TQRegion & r )"
Applies the intersect() function to this region and \fIr\fR and assigns the result to this region. \fCr1&=r2\fR is equivalent to \fCr1=r1.intersect(r2)\fR
.PP
See also intersect().
.SH "const TQRegion TQRegion::operator+ ( const TQRegion & r ) const"
Applies the unite() function to this region and \fIr\fR. \fCr1+r2\fR is equivalent to \fCr1.unite(r2)\fR
.PP
See also unite() and operator|().
.SH "TQRegion & TQRegion::operator+= ( const TQRegion & r )"
Applies the unite() function to this region and \fIr\fR and assigns the result to this region. \fCr1+=r2\fR is equivalent to \fCr1=r1.unite(r2)\fR
.PP
See also intersect().
.SH "const TQRegion TQRegion::operator- ( const TQRegion & r ) const"
Applies the subtract() function to this region and \fIr\fR. \fCr1-r2\fR is equivalent to \fCr1.subtract(r2)\fR
.PP
See also subtract().
.SH "TQRegion & TQRegion::operator-= ( const TQRegion & r )"
Applies the subtract() function to this region and \fIr\fR and assigns the result to this region. \fCr1-=r2\fR is equivalent to \fCr1=r1.subtract(r2)\fR
.PP
See also subtract().
.SH "TQRegion & TQRegion::operator= ( const TQRegion & r )"
Assigns \fIr\fR to this region and returns a reference to the region.
.SH "bool TQRegion::operator== ( const TQRegion & r ) const"
Returns TRUE if the region is equal to \fIr\fR; otherwise returns FALSE.
.SH "const TQRegion TQRegion::operator^ ( const TQRegion & r ) const"
Applies the eor() function to this region and \fIr\fR. \fCr1^r2\fR is equivalent to \fCr1.eor(r2)\fR
.PP
See also eor().
.SH "TQRegion & TQRegion::operator^= ( const TQRegion & r )"
Applies the eor() function to this region and \fIr\fR and assigns the result to this region. \fCr1^=r2\fR is equivalent to \fCr1=r1.eor(r2)\fR
.PP
See also eor().
.SH "const TQRegion TQRegion::operator| ( const TQRegion & r ) const"
Applies the unite() function to this region and \fIr\fR. \fCr1|r2\fR is equivalent to \fCr1.unite(r2)\fR
.PP
See also unite() and operator+().
.SH "TQRegion & TQRegion::operator|= ( const TQRegion & r )"
Applies the unite() function to this region and \fIr\fR and assigns the result to this region. \fCr1|=r2\fR is equivalent to \fCr1=r1.unite(r2)\fR
.PP
See also unite().
.SH "TQMemArray<TQRect> TQRegion::rects () const"
Returns an array of non-overlapping rectangles that make up the region.
.PP
The union of all the rectangles is equal to the original region.
.SH "TQRegion TQRegion::subtract ( const TQRegion & r ) const"
Returns a region which is \fIr\fR subtracted from this region.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
The figure shows the result when the ellipse on the right is subtracted from the ellipse on the left. (\fCleft-right\fR )
.SH "void TQRegion::translate ( int dx, int dy )"
Translates (moves) the region \fIdx\fR along the X axis and \fIdy\fR along the Y axis.
.SH "TQRegion TQRegion::unite ( const TQRegion & r ) const"
Returns a region which is the union of this region and \fIr\fR.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
The figure shows the union of two elliptical regions.
.SH RELATED FUNCTION DOCUMENTATION
.SH "TQDataStream & operator<< ( TQDataStream & s, const TQRegion & r )"
Writes the region \fIr\fR to the stream \fIs\fR and returns a reference to the stream.
.PP
See also Format of the TQDataStream operators.
.SH "TQDataStream & operator>> ( TQDataStream & s, TQRegion & r )"
Reads a region from the stream \fIs\fR into \fIr\fR and returns a reference to the stream.
.PP
See also Format of the TQDataStream operators.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqregion.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqregion.3qt) and the Qt
version (3.3.8).