/usr/share/qt3/doc/html/qregion.html is in qt3-doc 3:3.3.8-b-8ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qregion.cpp:44 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QRegion Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QRegion Class Reference</h1>
<p>The QRegion class specifies a clip region for a painter.
<a href="#details">More...</a>
<p><tt>#include <<a href="qregion-h.html">qregion.h</a>></tt>
<p><a href="qregion-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#RegionType-enum"><b>RegionType</b></a> { Rectangle, Ellipse }</li>
<li class=fn><a href="#QRegion"><b>QRegion</b></a> ()</li>
<li class=fn><a href="#QRegion-2"><b>QRegion</b></a> ( int x, int y, int w, int h, RegionType t = Rectangle )</li>
<li class=fn><a href="#QRegion-3"><b>QRegion</b></a> ( const QRect & r, RegionType t = Rectangle )</li>
<li class=fn><a href="#QRegion-4"><b>QRegion</b></a> ( const QPointArray & a, bool winding = FALSE )</li>
<li class=fn><a href="#QRegion-5"><b>QRegion</b></a> ( const QRegion & r )</li>
<li class=fn><a href="#QRegion-6"><b>QRegion</b></a> ( const QBitmap & bm )</li>
<li class=fn><a href="#~QRegion"><b>~QRegion</b></a> ()</li>
<li class=fn>QRegion & <a href="#operator-eq"><b>operator=</b></a> ( const QRegion & r )</li>
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
<li class=fn>bool <a href="#contains"><b>contains</b></a> ( const QPoint & p ) const</li>
<li class=fn>bool <a href="#contains-2"><b>contains</b></a> ( const QRect & r ) const</li>
<li class=fn>void <a href="#translate"><b>translate</b></a> ( int dx, int dy )</li>
<li class=fn>QRegion <a href="#unite"><b>unite</b></a> ( const QRegion & r ) const</li>
<li class=fn>QRegion <a href="#intersect"><b>intersect</b></a> ( const QRegion & r ) const</li>
<li class=fn>QRegion <a href="#subtract"><b>subtract</b></a> ( const QRegion & r ) const</li>
<li class=fn>QRegion <a href="#eor"><b>eor</b></a> ( const QRegion & r ) const</li>
<li class=fn>QRect <a href="#boundingRect"><b>boundingRect</b></a> () const</li>
<li class=fn>QMemArray<QRect> <a href="#rects"><b>rects</b></a> () const</li>
<li class=fn>const QRegion <a href="#operator|"><b>operator|</b></a> ( const QRegion & r ) const</li>
<li class=fn>const QRegion <a href="#operator+"><b>operator+</b></a> ( const QRegion & r ) const</li>
<li class=fn>const QRegion <a href="#operator-and"><b>operator&</b></a> ( const QRegion & r ) const</li>
<li class=fn>const QRegion <a href="#operator-"><b>operator-</b></a> ( const QRegion & r ) const</li>
<li class=fn>const QRegion <a href="#operator^"><b>operator^</b></a> ( const QRegion & r ) const</li>
<li class=fn>QRegion & <a href="#operator|-eq"><b>operator|=</b></a> ( const QRegion & r )</li>
<li class=fn>QRegion & <a href="#operator+-eq"><b>operator+=</b></a> ( const QRegion & r )</li>
<li class=fn>QRegion & <a href="#operator-and-eq"><b>operator&=</b></a> ( const QRegion & r )</li>
<li class=fn>QRegion & <a href="#operator--eq"><b>operator-=</b></a> ( const QRegion & r )</li>
<li class=fn>QRegion & <a href="#operator^-eq"><b>operator^=</b></a> ( const QRegion & r )</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QRegion & r ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QRegion & r ) const</li>
<li class=fn>HRGN <a href="#handle"><b>handle</b></a> () const</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QRegion & r )</li>
<li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QRegion & r )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QRegion class specifies a clip region for a painter.
<p>
<p> QRegion is used with <a href="qpainter.html#setClipRegion">QPainter::setClipRegion</a>() to limit the paint
area to what needs to be painted. There is also a
<a href="qwidget.html#repaint">QWidget::repaint</a>() that takes a QRegion parameter. QRegion is the
best tool for reducing flicker.
<p> 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 <a href="#unite">unite</a>(), <a href="#intersect">intersect</a>(), <a href="#subtract">subtract</a>() or <a href="#eor">eor</a>() (exclusive
or). You can move a region using <a href="#translate">translate</a>().
<p> You can test whether a region <a href="#isNull">isNull</a>(), <a href="#isEmpty">isEmpty</a>() or if it
<a href="#contains">contains</a>() a <a href="qpoint.html">QPoint</a> or <a href="qrect.html">QRect</a>. The bounding rectangle is given by
<a href="#boundingRect">boundingRect</a>().
<p> The function <a href="#rects">rects</a>() gives a decomposition of the region into
rectangles.
<p> Example of using complex regions:
<pre>
void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
{
<a href="qpainter.html">QPainter</a> p; // our painter
QRegion r1( QRect(100,100,200,80), // r1 = elliptic region
QRegion::<a href="#RegionType-enum">Ellipse</a> );
QRegion r2( QRect(100,120,90,30) ); // r2 = rectangular region
QRegion r3 = r1.<a href="#intersect">intersect</a>( r2 ); // r3 = intersection
p.<a href="qpainter.html#begin">begin</a>( this ); // start painting widget
p.<a href="qpainter.html#setClipRegion">setClipRegion</a>( r3 ); // set clip region
... // paint clipped graphics
p.<a href="qpainter.html#end">end</a>(); // painting done
}
</pre>
<p> QRegion is an <a href="shclass.html">implicitly shared</a> class.
<p> <b>Warning:</b> 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.
<p> <p>See also <a href="qpainter.html#setClipRegion">QPainter::setClipRegion</a>(), <a href="qpainter.html#setClipRect">QPainter::setClipRect</a>(), <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="RegionType-enum"></a>QRegion::RegionType</h3>
<p> Specifies the shape of the region to be created.
<ul>
<li><tt>QRegion::Rectangle</tt> - the region covers the entire rectangle.
<li><tt>QRegion::Ellipse</tt> - the region is an ellipse inside the rectangle.
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QRegion"></a>QRegion::QRegion ()
</h3>
Constructs a null region.
<p> <p>See also <a href="#isNull">isNull</a>().
<h3 class=fn><a name="QRegion-2"></a>QRegion::QRegion ( int x, int y, int w, int h, <a href="qregion.html#RegionType-enum">RegionType</a> t = Rectangle )
</h3>
Constructs a rectangular or elliptic region.
<p> If <em>t</em> is <a href="#RegionType-enum">Rectangle</a>, the region is the filled rectangle (<em>x</em>,
<em>y</em>, <em>w</em>, <em>h</em>). If <em>t</em> is <a href="#RegionType-enum">Ellipse</a>, the region is the filled
ellipse with center at (<em>x</em> + <em>w</em> / 2, <em>y</em> + <em>h</em> / 2) and size
(<em>w</em> ,<em>h</em> ).
<h3 class=fn><a name="QRegion-3"></a>QRegion::QRegion ( const <a href="qrect.html">QRect</a> & r, <a href="qregion.html#RegionType-enum">RegionType</a> t = Rectangle )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Create a region based on the rectange <em>r</em> with region type <em>t</em>.
<p> If the rectangle is invalid a null region will be created.
<p> <p>See also <a href="#RegionType-enum">QRegion::RegionType</a>.
<h3 class=fn><a name="QRegion-4"></a>QRegion::QRegion ( const <a href="qpointarray.html">QPointArray</a> & a, bool winding = FALSE )
</h3>
Constructs a polygon region from the point array <em>a</em>.
<p> If <em>winding</em> is TRUE, the polygon region is filled using the
winding algorithm, otherwise the default even-odd fill algorithm
is used.
<p> This constructor may create complex regions that will slow down
painting when used.
<h3 class=fn><a name="QRegion-5"></a>QRegion::QRegion ( const <a href="qregion.html">QRegion</a> & r )
</h3>
Constructs a new region which is equal to region <em>r</em>.
<h3 class=fn><a name="QRegion-6"></a>QRegion::QRegion ( const <a href="qbitmap.html">QBitmap</a> & bm )
</h3>
Constructs a region from the bitmap <em>bm</em>.
<p> The resulting region consists of the pixels in bitmap <em>bm</em> that
are <tt>color1</tt>, as if each pixel was a 1 by 1 rectangle.
<p> This constructor may create complex regions that will slow down
painting when used. Note that drawing masked pixmaps can be done
much faster using <a href="qpixmap.html#setMask">QPixmap::setMask</a>().
<h3 class=fn><a name="~QRegion"></a>QRegion::~QRegion ()
</h3>
Destroys the region.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="boundingRect"></a>QRegion::boundingRect () const
</h3>
Returns the bounding rectangle of this region. An empty region
gives a rectangle that is <a href="qrect.html#isNull">QRect::isNull</a>().
<h3 class=fn>bool <a name="contains"></a>QRegion::contains ( const <a href="qpoint.html">QPoint</a> & p ) const
</h3>
Returns TRUE if the region contains the point <em>p</em>; otherwise
returns FALSE.
<h3 class=fn>bool <a name="contains-2"></a>QRegion::contains ( const <a href="qrect.html">QRect</a> & r ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if the region overlaps the rectangle <em>r</em>; otherwise
returns FALSE.
<h3 class=fn><a href="qregion.html">QRegion</a> <a name="eor"></a>QRegion::eor ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Returns a region which is the exclusive or (XOR) of this region
and <em>r</em>.
<p> <center><img src="rxor.png" alt="Region XORed"></center>
<p> The figure shows the exclusive or of two elliptical regions.
<h3 class=fn>HRGN <a name="handle"></a>QRegion::handle () const
</h3>
<p> Returns the region's handle.
<h3 class=fn><a href="qregion.html">QRegion</a> <a name="intersect"></a>QRegion::intersect ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Returns a region which is the intersection of this region and <em>r</em>.
<p> <center><img src="rintersect.png" alt="Region Intersection"></center>
<p> The figure shows the intersection of two elliptical regions.
<h3 class=fn>bool <a name="isEmpty"></a>QRegion::isEmpty () const
</h3>
Returns TRUE if the region is empty; otherwise returns FALSE. An
empty region is a region that contains no points.
<p> Example:
<pre>
QRegion r1( 10, 10, 20, 20 );
QRegion r2( 40, 40, 20, 20 );
QRegion r3;
r1.<a href="#isNull">isNull</a>(); // FALSE
r1.<a href="#isEmpty">isEmpty</a>(); // FALSE
r3.<a href="#isNull">isNull</a>(); // TRUE
r3.<a href="#isEmpty">isEmpty</a>(); // TRUE
r3 = r1.<a href="#intersect">intersect</a>( r2 ); // r3 = intersection of r1 and r2
r3.<a href="#isNull">isNull</a>(); // FALSE
r3.<a href="#isEmpty">isEmpty</a>(); // TRUE
r3 = r1.<a href="#unite">unite</a>( r2 ); // r3 = union of r1 and r2
r3.<a href="#isNull">isNull</a>(); // FALSE
r3.<a href="#isEmpty">isEmpty</a>(); // FALSE
</pre>
<p> <p>See also <a href="#isNull">isNull</a>().
<h3 class=fn>bool <a name="isNull"></a>QRegion::isNull () const
</h3>
Returns TRUE if the region is a null region; otherwise returns
FALSE.
<p> A null region is a region that has not been initialized. A null
region is always empty.
<p> <p>See also <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator!-eq"></a>QRegion::operator!= ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
<p> Returns TRUE if the region is different from <em>r</em>; otherwise
returns FALSE.
<h3 class=fn>const <a href="qregion.html">QRegion</a> <a name="operator-and"></a>QRegion::operator& ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Applies the <a href="#intersect">intersect</a>() function to this region and <em>r</em>. <tt>r1&r2</tt>
is equivalent to <tt>r1.intersect(r2)</tt>
<p> <p>See also <a href="#intersect">intersect</a>().
<h3 class=fn><a href="qregion.html">QRegion</a> & <a name="operator-and-eq"></a>QRegion::operator&= ( const <a href="qregion.html">QRegion</a> & r )
</h3>
Applies the <a href="#intersect">intersect</a>() function to this region and <em>r</em> and
assigns the result to this region. <tt>r1&=r2</tt> is equivalent to <tt>r1=r1.intersect(r2)</tt>
<p> <p>See also <a href="#intersect">intersect</a>().
<h3 class=fn>const <a href="qregion.html">QRegion</a> <a name="operator+"></a>QRegion::operator+ ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Applies the <a href="#unite">unite</a>() function to this region and <em>r</em>. <tt>r1+r2</tt> is
equivalent to <tt>r1.unite(r2)</tt>
<p> <p>See also <a href="#unite">unite</a>() and <a href="#operator|">operator|</a>().
<h3 class=fn><a href="qregion.html">QRegion</a> & <a name="operator+-eq"></a>QRegion::operator+= ( const <a href="qregion.html">QRegion</a> & r )
</h3>
Applies the <a href="#unite">unite</a>() function to this region and <em>r</em> and assigns
the result to this region. <tt>r1+=r2</tt> is equivalent to <tt>r1=r1.unite(r2)</tt>
<p> <p>See also <a href="#intersect">intersect</a>().
<h3 class=fn>const <a href="qregion.html">QRegion</a> <a name="operator-"></a>QRegion::operator- ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Applies the <a href="#subtract">subtract</a>() function to this region and <em>r</em>. <tt>r1-r2</tt>
is equivalent to <tt>r1.subtract(r2)</tt>
<p> <p>See also <a href="#subtract">subtract</a>().
<h3 class=fn><a href="qregion.html">QRegion</a> & <a name="operator--eq"></a>QRegion::operator-= ( const <a href="qregion.html">QRegion</a> & r )
</h3>
Applies the <a href="#subtract">subtract</a>() function to this region and <em>r</em> and
assigns the result to this region. <tt>r1-=r2</tt> is equivalent to <tt>r1=r1.subtract(r2)</tt>
<p> <p>See also <a href="#subtract">subtract</a>().
<h3 class=fn><a href="qregion.html">QRegion</a> & <a name="operator-eq"></a>QRegion::operator= ( const <a href="qregion.html">QRegion</a> & r )
</h3>
Assigns <em>r</em> to this region and returns a reference to the region.
<h3 class=fn>bool <a name="operator-eq-eq"></a>QRegion::operator== ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Returns TRUE if the region is equal to <em>r</em>; otherwise returns
FALSE.
<h3 class=fn>const <a href="qregion.html">QRegion</a> <a name="operator^"></a>QRegion::operator^ ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Applies the <a href="#eor">eor</a>() function to this region and <em>r</em>. <tt>r1^r2</tt> is
equivalent to <tt>r1.eor(r2)</tt>
<p> <p>See also <a href="#eor">eor</a>().
<h3 class=fn><a href="qregion.html">QRegion</a> & <a name="operator^-eq"></a>QRegion::operator^= ( const <a href="qregion.html">QRegion</a> & r )
</h3>
Applies the <a href="#eor">eor</a>() function to this region and <em>r</em> and
assigns the result to this region. <tt>r1^=r2</tt> is equivalent to <tt>r1=r1.eor(r2)</tt>
<p> <p>See also <a href="#eor">eor</a>().
<h3 class=fn>const <a href="qregion.html">QRegion</a> <a name="operator|"></a>QRegion::operator| ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Applies the <a href="#unite">unite</a>() function to this region and <em>r</em>. <tt>r1|r2</tt> is
equivalent to <tt>r1.unite(r2)</tt>
<p> <p>See also <a href="#unite">unite</a>() and <a href="#operator+">operator+</a>().
<h3 class=fn><a href="qregion.html">QRegion</a> & <a name="operator|-eq"></a>QRegion::operator|= ( const <a href="qregion.html">QRegion</a> & r )
</h3>
Applies the <a href="#unite">unite</a>() function to this region and <em>r</em> and assigns
the result to this region. <tt>r1|=r2</tt> is equivalent to <tt>r1=r1.unite(r2)</tt>
<p> <p>See also <a href="#unite">unite</a>().
<h3 class=fn><a href="qmemarray.html">QMemArray</a><QRect> <a name="rects"></a>QRegion::rects () const
</h3>
Returns an array of non-overlapping rectangles that make up the
region.
<p> The union of all the rectangles is equal to the original region.
<h3 class=fn><a href="qregion.html">QRegion</a> <a name="subtract"></a>QRegion::subtract ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Returns a region which is <em>r</em> subtracted from this region.
<p> <center><img src="rsubtract.png" alt="Region Subtraction"></center>
<p> The figure shows the result when the ellipse on the right is
subtracted from the ellipse on the left. (<tt>left-right</tt> )
<h3 class=fn>void <a name="translate"></a>QRegion::translate ( int dx, int dy )
</h3>
Translates (moves) the region <em>dx</em> along the X axis and <em>dy</em>
along the Y axis.
<h3 class=fn><a href="qregion.html">QRegion</a> <a name="unite"></a>QRegion::unite ( const <a href="qregion.html">QRegion</a> & r ) const
</h3>
Returns a region which is the union of this region and <em>r</em>.
<p> <center><img src="runion.png" alt="Region Union"></center>
<p> The figure shows the union of two elliptical regions.
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qregion.html">QRegion</a> & r )
</h3>
<p> Writes the region <em>r</em> to the stream <em>s</em> and returns a reference
to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qregion.html">QRegion</a> & r )
</h3>
<p> Reads a region from the stream <em>s</em> into <em>r</em> and returns a
reference to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>
|