📄 qregion.3qt
字号:
'\" t.TH QRegion 3qt "24 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQRegion \- Clip region for a painter.br.PP\fC#include <qregion.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBRegionType\fR { Rectangle, Ellipse }".br.ti -1c.BI "\fBQRegion\fR () ".br.ti -1c.BI "\fBQRegion\fR ( int " "x" ", int " "y" ", int " "w" ", int " "h" ", RegionType = Rectangle ) ".br.ti -1c.BI "\fBQRegion\fR ( const QRect &, RegionType = Rectangle ) ".br.ti -1c.BI "\fBQRegion\fR ( const QPointArray &, bool " "winding" "=FALSE ) ".br.ti -1c.BI "\fBQRegion\fR ( const QRegion & ) ".br.ti -1c.BI "\fBQRegion\fR ( const QBitmap & ) ".br.ti -1c.BI "\fB~QRegion\fR () ".br.ti -1c.BI "QRegion& \fBoperator=\fR ( const QRegion & ) ".br.ti -1c.BI "bool \fBisNull\fR () const".br.ti -1c.BI "bool \fBisEmpty\fR () const".br.ti -1c.BI "bool \fBcontains\fR ( const QPoint & p ) const".br.ti -1c.BI "bool \fBcontains\fR ( const QRect & r ) const".br.ti -1c.BI "void \fBtranslate\fR ( int " "dx" ", int dy ) ".br.ti -1c.BI "QRegion \fBunite\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion \fBintersect\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion \fBsubtract\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion \fBeor\fR ( const QRegion & ) const".br.ti -1c.BI "QRect \fBboundingRect\fR () const".br.ti -1c.BI "QArray<QRect> \fBrects\fR () const".br.ti -1c.BI "void \fBsetRects\fR ( const QRect *, int ) ".br.ti -1c.BI "QRegion \fBoperator|\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion \fBoperator+\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion \fBoperator&\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion \fBoperator-\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion \fBoperator^\fR ( const QRegion & ) const".br.ti -1c.BI "QRegion& \fBoperator|=\fR ( const QRegion & ) ".br.ti -1c.BI "QRegion& \fBoperator+=\fR ( const QRegion & ) ".br.ti -1c.BI "QRegion& \fBoperator&=\fR ( const QRegion & ) ".br.ti -1c.BI "QRegion& \fBoperator-=\fR ( const QRegion & ) ".br.ti -1c.BI "QRegion& \fBoperator^=\fR ( const QRegion & ) ".br.ti -1c.BI "bool \fBoperator==\fR ( const QRegion & ) const".br.ti -1c.BI "bool \fBoperator!=\fR ( const QRegion & r ) const".br.in -1c.SH RELATED FUNCTION DOCUMENTATION(Note that these are not member functions.).in +1c.ti -1c.BI "QDataStream & \fBoperator>>\fR (QDataStream & " "s" ", QRegion & " "r" ")".br.ti -1c.BI "QDataStream & \fBoperator<<\fR (QDataStream & " "s" ", const QRegion & " "r" ")".br.in -1c.SH DESCRIPTIONThe QRegion class specifies a clip region for a painter..PPQRegion is used with QPainter::setClipRegion() to limit the paint area to what needs to be painted. There is also a QWidget::repaint() that takes a QRegion parameter. QRegion is the best tool for reducing flicker..PPA 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). Use translate() to move a region..PPYou can test if a region isNull(), isEmpty() or if it contains() a QPoint or QRect. The bounding rectangle is given by boundingRect()..PPThe function rects() gives a decomposition of the region into rectangles..PPExample of using complex regions:.PP.nf.br void MyWidget::paintEvent( QPaintEvent * ).br {.br QPainter p; // our painter.br QRegion r1( QRect(100,100,200,80), // r1 = elliptic region.br QRegion::Ellipse );.br QRegion r2( QRect(100,120,90,30) ); // r2 = rectangular region.br QRegion 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 }.fi.PPQRegion is an implicitely shared class..PPDue to window system limitations, the width and height of a region is limited to 65535 on Unix/X11..PPSome functions in QRegion are copyright (c) 1987 X Consortium. Please see src/3rdparty/kernel/qregion_qws.cpp for more information..PPSome functions in QRegion for Qt/Embedded are copyright Digital Equipment Corporation:.PPCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts..PPAll Rights Reserved.PPPermission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission..PPDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE..PPSee also QPainter::setClipRegion() and QPainter::setClipRect()..SS "Member Type Documentation".SH "QRegion::RegionType"Determines the shape of the region to be created..TP\fCRectangle\fR - the region covers the entire rectangle.TP\fCEllipse\fR - the region is an ellipse inside the rectangle.SH MEMBER FUNCTION DOCUMENTATION.SH "QRegion::QRegion ()"Constructs a null region..PPSee also isNull()..SH "QRegion::QRegion ( const QBitmap & bm )"Constructs a region from the bitmap \fIbm.\fR.PPThe resulting region consists of the pixels in \fIbm\fR that are \fCcolor1,\fR as if each pixel was a 1 by 1 rectangle..PPThis constructor may create complex regions that will slow down painting when used. Note that drawing masked pixmaps can be done much faster using QPixmap::setMask()..SH "QRegion::QRegion ( const QPointArray & a, bool winding=FALSE )"Constructs a polygon region from the point array \fIa.\fR.PPIf \fIwinding\fR is TRUE, the polygon region is filled using the winding algorithm, otherwise the default even-odd fill algorithm is used..PPThis constructor may create complex regions that will slow down painting when used..SH "QRegion::QRegion ( const QRegion & r )"Constructs a new region which is equal to \fIr.\fR.SH "QRegion::QRegion ( int x, int y, int w, int h, RegionType t = Rectangle )"Constructs a rectangular or elliptic region..PPIf \fIt\fR is \fCRectangle,\fR the region is the filled rectangle (\fIx, y, w, h).\fR If \fIt\fR is \fCEllipse,\fR the region is the filled ellipse ellipse with center at (\fIx\fR + \fIw\fR / 2, \fIy\fR + \fIh\fR / 2) and size (\fIw\fR ,\fIh\fR )..SH "QRegion::~QRegion ()"Destructs the region..SH "QRect QRegion::boundingRect () const"Returns the bounding rectangle of this region. An empty region gives a rectangle that is QRect::isNull()..SH "bool QRegion::contains ( const QPoint & p ) const"Returns TRUE if the region contains the point \fIp,\fR or FALSE if \fIp\fR is outside the region..SH "bool QRegion::contains ( const QRect & r ) const"Returns TRUE if the region overlaps the rectangle \fIr,\fR or FALSE if \fIr\fR is completely outside the region..SH "QRegion QRegion::eor ( const QRegion & r ) const"Returns a region which is the exclusive or (XOR) of this region and \fIr.\fR.PP.ce 1.B "[Image Omitted]".PPThe figure shows the exclusive or of two elliptical regions..SH "QRegion QRegion::intersect ( const QRegion & r ) const"Returns a region which is the intersection of this region and \fIr.\fR.PP.ce 1.B "[Image Omitted]".PPThe figure shows the intersection of two elliptical regions..SH "bool QRegion::isEmpty () const"Returns TRUE if the region is empty, or FALSE if it is non-empty. An empty region is a region that contains no points..PPExample:.PP.nf.br QRegion r1( 10, 10, 20, 20 );.br QRegion r2( 40, 40, 20, 20 );.br QRegion 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.fi.PPSee also isNull()..SH "bool QRegion::isNull () const"Returns TRUE if the region is a null region, otherwise FALSE..PPA null region is a region that has not been initialized. A null region is always empty..PPSee also isEmpty()..SH "bool QRegion::operator!= ( const QRegion & r ) const"Returns TRUE if the region is different from \fIr,\fR or FALSE if the regions are equal..SH "QRegion QRegion::operator& ( const QRegion & r ) const"\fCr1&r2\fR is equivalent to \fCr1.intersect(r2)\fR.PPSee also intersect()..SH "QRegion& QRegion::operator&= ( const QRegion & r )"\fCr1&=r2\fR is equivalent to \fCr1=r1.intersect(r2)\fR.PPSee also intersect()..SH "QRegion QRegion::operator+ ( const QRegion & r ) const"\fCr1+r2\fR is equivalent to \fCr1.unite(r2)\fR.PPSee also unite() and operator|()..SH "QRegion& QRegion::operator+= ( const QRegion & r )"\fCr1+=r2\fR is equivalent to \fCr1=r1.unite(r2)\fR.PPSee also intersect()..SH "QRegion QRegion::operator- ( const QRegion & r ) const"\fCr1-r2\fR is equivalent to \fCr1.subtract(r2)\fR.PPSee also subtract()..SH "QRegion& QRegion::operator-= ( const QRegion & r )"\fCr1-=r2\fR is equivalent to \fCr1=r1.subtract(r2)\fR.PPSee also subtract()..SH "QRegion & QRegion::operator= ( const QRegion & r )"Assigns \fIr\fR to this region and returns a reference to the region..SH "bool QRegion::operator== ( const QRegion & r ) const"Returns TRUE if the region is equal to \fIr,\fR or FALSE if the regions are different..SH "QRegion QRegion::operator^ ( const QRegion & r ) const"\fCr1^r2\fR is equivalent to \fCr1.eor(r2)\fR.PPSee also eor()..SH "QRegion& QRegion::operator^= ( const QRegion & r )"\fCr1^=r2\fR is equivalent to \fCr1=r1.eor(r2)\fR.PPSee also eor()..SH "QRegion QRegion::operator| ( const QRegion & r ) const"\fCr1|r2\fR is equivalent to \fCr1.unite(r2)\fR.PPSee also unite() and operator+()..SH "QRegion& QRegion::operator|= ( const QRegion & r )"\fCr1|=r2\fR is equivalent to \fCr1=r1.unite(r2)\fR.PPSee also unite()..SH "QArray<QRect> QRegion::rects () const"Returns an array of non-overlapping rectangles that make up the region..PPThe union of all the rectangles is equal to the original region..SH "void QRegion::setRects ( const QRect * rects, int num )"Sets the region to be the given set of rectangles. The rectangles \fImust\fR be optimal Y-X sorted bands as follows:.TPThe rectangles must not intersect.TPAll rectangles with a given top coordinate must have the same height..TPNo two rectangles may abut horizontally (they should be combined into a single wider rectangle in that case)..TPThe rectangles must be sorted ascendingly by Y as the major sort key and X as the minor sort key..SH "QRegion QRegion::subtract ( const QRegion & r ) const"Returns a region which is \fIr\fR subtracted from this region..PP.ce 1.B "[Image Omitted]".PPThe figure shows the result when the ellipse on the right is subtracted from the ellipse on the left. (\fCleft-right\fR )..SH "void QRegion::translate ( int dx, int dy )"Translates (moves) the region \fIdx\fR along the X axis and \fIdy\fR along the Y axis..SH "QRegion QRegion::unite ( const QRegion & r ) const"Returns a region which is the union of this region and \fIr.\fR.PP.ce 1.B "[Image Omitted]".PPThe figure shows the union of two elliptical regions..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator>> (QDataStream & s, QRegion & r)"Reads a region from the stream \fIs\fR into \fIr\fR and returns a reference to the stream..PPSee also Format of the QDataStream operators.SH "QDataStream & operator<< (QDataStream & s, const QRegion & r)"Writes the region \fIr\fR to the stream \fIs\fR and returns a reference to the stream..PPSee also Format of the QDataStream operators.SH "SEE ALSO".BR http://doc.trolltech.com/qregion.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qregion.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -