Qt 4.8
|
The QRegion class specifies a clip region for a painter. More...
#include <qregion.h>
Classes | |
struct | QRegionData |
Public Types | |
enum | RegionType { Rectangle, Ellipse } |
Specifies the shape of the region to be created. More... | |
Public Functions | |
QRect | boundingRect () const |
Returns the bounding rectangle of this region. More... | |
bool | contains (const QPoint &p) const |
Returns true if the region contains the point p; otherwise returns false. More... | |
bool | contains (const QRect &r) const |
Returns true if the region overlaps the rectangle r; otherwise returns false. More... | |
QRegion | eor (const QRegion &r) const |
Use xored(r) instead. More... | |
Handle | handle () const |
Returns a platform-specific region handle. More... | |
QRegion | intersect (const QRegion &r) const |
Use intersected(r) instead. More... | |
QRegion | intersect (const QRect &r) const |
Use intersected(rect) instead. More... | |
QRegion | intersected (const QRegion &r) const |
Returns a region which is the intersection of this region and r. More... | |
QRegion | intersected (const QRect &r) const |
Returns a region which is the intersection of this region and the given rect. More... | |
bool | intersects (const QRegion &r) const |
Returns true if this region intersects with region, otherwise returns false. More... | |
bool | intersects (const QRect &r) const |
Returns true if this region intersects with rect, otherwise returns false. More... | |
bool | isEmpty () const |
Returns true if the region is empty; otherwise returns false. More... | |
QT_DEPRECATED int | numRects () const |
Returns the number of rectangles that will be returned in rects(). More... | |
const QRegion | operator & (const QRegion &r) const |
const QRegion | operator & (const QRect &r) const |
QRegion & | operator &= (const QRegion &r) |
QRegion & | operator &= (const QRect &r) |
operator QVariant () const | |
Returns the region as a QVariant. More... | |
bool | operator!= (const QRegion &r) const |
Returns true if this region is different from the other region; otherwise returns false. More... | |
const QRegion | operator+ (const QRegion &r) const |
Applies the united() function to this region and r. More... | |
const QRegion | operator+ (const QRect &r) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
QRegion & | operator+= (const QRegion &r) |
Applies the united() function to this region and r and assigns the result to this region. More... | |
QRegion & | operator+= (const QRect &r) |
Returns a region that is the union of this region with the specified rect. More... | |
const QRegion | operator- (const QRegion &r) const |
Applies the subtracted() function to this region and r. More... | |
QRegion & | operator-= (const QRegion &r) |
Applies the subtracted() function to this region and r and assigns the result to this region. More... | |
QRegion & | operator= (const QRegion &) |
Assigns r to this region and returns a reference to the region. More... | |
bool | operator== (const QRegion &r) const |
Returns true if the region is equal to r; otherwise returns false. More... | |
const QRegion | operator^ (const QRegion &r) const |
Applies the xored() function to this region and r. More... | |
QRegion & | operator^= (const QRegion &r) |
Applies the xored() function to this region and r and assigns the result to this region. More... | |
const QRegion | operator| (const QRegion &r) const |
Applies the united() function to this region and r. More... | |
QRegion & | operator|= (const QRegion &r) |
Applies the united() function to this region and r and assigns the result to this region. More... | |
QRegion () | |
Constructs an empty region. More... | |
QRegion (int x, int y, int w, int h, RegionType t=Rectangle) | |
Constructs a rectangular or elliptic region. More... | |
QRegion (const QRect &r, RegionType t=Rectangle) | |
Create a region based on the rectange r with region type t. More... | |
QRegion (const QPolygon &pa, Qt::FillRule fillRule=Qt::OddEvenFill) | |
Constructs a polygon region from the point array a with the fill rule specified by fillRule. More... | |
QRegion (const QRegion ®ion) | |
Constructs a new region which is equal to region r. More... | |
QRegion (const QBitmap &bitmap) | |
Constructs a region from the bitmap bm. More... | |
int | rectCount () const |
Returns the number of rectangles that will be returned in rects(). More... | |
QVector< QRect > | rects () const |
Returns an array of non-overlapping rectangles that make up the region. More... | |
void | setRects (const QRect *rect, int num) |
Sets the region using the array of rectangles specified by rects and number. More... | |
QRegion | subtract (const QRegion &r) const |
Use subtracted(r) instead. More... | |
QRegion | subtracted (const QRegion &r) const |
Returns a region which is r subtracted from this region. More... | |
void | swap (QRegion &other) |
Swaps region other with this region. More... | |
void | translate (int dx, int dy) |
Translates (moves) the region dx along the X axis and dy along the Y axis. More... | |
void | translate (const QPoint &p) |
Translates the region {point}. More... | |
QRegion | translated (int dx, int dy) const |
Returns a copy of the region that is translated dx along the x axis and dy along the y axis, relative to the current position. More... | |
QRegion | translated (const QPoint &p) const |
Returns a copy of the regtion that is translated {p}. More... | |
QRegion | unite (const QRegion &r) const |
Use united(r) instead. More... | |
QRegion | unite (const QRect &r) const |
Use united(rect) instead. More... | |
QRegion | united (const QRegion &r) const |
Returns a region which is the union of this region and r. More... | |
QRegion | united (const QRect &r) const |
Returns a region which is the union of this region and the given rect. More... | |
QRegion | xored (const QRegion &r) const |
Returns a region which is the exclusive or (XOR) of this region and r. More... | |
~QRegion () | |
Destroys the region. More... | |
Private Functions | |
QRegion | copy () const |
void | detach () |
void | ensureHandle () const |
void | exec (const QByteArray &ba, int ver=0, QDataStream::ByteOrder byteOrder=QDataStream::BigEndian) |
QRegion | winCombine (const QRegion &r, int num) const |
Static Private Functions | |
static void | cleanUp (QRegionData *x) |
Properties | |
struct QRegionData * | d |
Static Private Attributes | |
static struct QRegionData | shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), 0 } |
Friends | |
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &, const QRegion &) |
Writes the region r to the stream s and returns a reference to the stream. More... | |
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QRegion &) |
Reads a region from the stream s into r and returns a reference to the stream. More... | |
class | QETWidget |
struct | QRegionPrivate |
bool | qt_region_strictContains (const QRegion ®ion, const QRect &rect) |
Returns true if rect is guaranteed to be fully contained in region. More... | |
The QRegion class specifies a clip region for a painter.
QRegion is used with QPainter::setClipRegion() to limit the paint area to what needs to be painted. There is also a QWidget::repaint() function that takes a QRegion parameter. QRegion is the best tool for minimizing the amount of screen area to be updated by a repaint.
This class is not suitable for constructing shapes for rendering, especially as outlines. Use QPainterPath to create paths and shapes for use with QPainter.
QRegion is an implicitly shared class.
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 united(), intersected(), subtracted(), or xored() (exclusive or). You can move a region using translate().
You can test whether a region isEmpty() or if it contains() a QPoint or QRect. The bounding rectangle can be found with boundingRect().
The function rects() gives a decomposition of the region into rectangles.
Example of using complex regions:
On Embedded Linux, Windows CE and X11 platforms, parts of this class rely on code obtained under the following licenses:
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission 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.
DIGITAL 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.
enum QRegion::RegionType |
Specifies the shape of the region to be created.
Enumerator | |
---|---|
Rectangle | |
Ellipse |
Definition at line 71 of file qregion.h.
QRegion::QRegion | ( | ) |
Constructs an empty region.
Definition at line 3961 of file qregion.cpp.
Referenced by eor(), exec(), intersect(), intersects(), operator|=(), QRegion(), qt_bitmapToRegion(), setRects(), and subtract().
QRegion::QRegion | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
RegionType | t = Rectangle |
||
) |
Constructs a rectangular or elliptic region.
If t is Rectangle
, the region is the filled rectangle (x, y, w, h). If t is Ellipse
, the region is the filled ellipse with center at (x + w / 2, y + h / 2) and size (w ,h).
Definition at line 272 of file qregion.cpp.
QRegion::QRegion | ( | const QRect & | r, |
RegionType | t = Rectangle |
||
) |
Create a region based on the rectange r with region type t.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
If the rectangle is invalid a null region will be created.
Definition at line 3967 of file qregion.cpp.
QRegion::QRegion | ( | const QPolygon & | a, |
Qt::FillRule | fillRule = Qt::OddEvenFill |
||
) |
Constructs a polygon region from the point array a with the fill rule specified by fillRule.
If fillRule is Qt::WindingFill, the polygon region is defined using the winding algorithm; if it is Qt::OddEvenFill, the odd-even fill algorithm is used.
Definition at line 3992 of file qregion.cpp.
QRegion::QRegion | ( | const QRegion & | region | ) |
QRegion::QRegion | ( | const QBitmap & | bm | ) |
Constructs a region from the bitmap bm.
The resulting region consists of the pixels in bitmap bm that are Qt::color1, as if each pixel was a 1 by 1 rectangle.
This 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().
Definition at line 4024 of file qregion.cpp.
QRegion::~QRegion | ( | ) |
Destroys the region.
Definition at line 4057 of file qregion.cpp.
Referenced by qt_bitmapToRegion().
QRect QRegion::boundingRect | ( | ) | const |
Returns the bounding rectangle of this region.
An empty region gives a rectangle that is QRect::isNull().
Definition at line 4363 of file qregion.cpp.
Referenced by _q_paintIntoCache(), QWidgetBackingStore::addDirtyWidget(), QOnScreenRasterPaintEngine::begin(), QScreen::blit(), blit_template(), QVGPaintEngine::clip(), QPaintEngineEx::clip(), QRasterPaintEngine::clip(), QPaintBufferEngine::clip(), QPainter::clipBoundingRect(), QPaintBuffer::commandDescription(), QScreen::compose(), QMultiScreen::connect(), QWindowsXPStylePrivate::drawBackgroundDirectly(), QMacStyle::drawComplexControl(), QGraphicsScenePrivate::drawItems(), QTreeView::drawTree(), effectiveState(), QDirectFBScreen::exposeRegion(), QScreen::exposeRegion(), QVGCompositionHelper::fillBackground(), QVGPaintEngine::fillRegion(), fillRegion(), QOpenGLPaintEnginePrivate::fillVertexArray(), QGraphicsViewPrivate::findItems(), QDirectFBScreen::flipSurface(), QVFbWindowSurface::flush(), QXcbWindowSurface::flush(), QCocoaWindowSurface::flush(), QX11GLWindowSurface::flush(), QX11WindowSurface::flush(), QWSWindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), QWSYellowSurface::flush(), intersects(), QVGPaintEngine::isDefaultClipRegion(), isFullUpdate(), isServerProcess(), make_widget_eventUPP(), QTransform::map(), QTransformedScreen::mapFromDevice(), QWidgetBackingStore::markDirty(), QWidgetPrivate::moveRect(), operator<<(), QDecorationStyled::paint(), QDecorationWindows::paint(), QDecorationDefault::paint(), QDeclarativePaintedItem::paint(), QScreen::paintBackground(), QWSMemorySurface::painterOffset(), QSystemTrayIconSys::paintEvent(), QWidgetPrivate::paintSiblingsRecursive(), QBBWindow::post(), QPainterReplayer::process(), QPaintEngineExReplayer::process(), qt_bitmapToRegion(), qt_mac_fill_background(), qt_mac_unregister_widget(), qt_regionToPath(), QWidgetPrivate::render(), QWidgetPrivate::render_helper(), QFbWindow::repaint(), QWSServerPrivate::request_region(), QDirectFbWindowSurface::scroll(), QMacWindowSurface::scroll(), QX11WindowSurface::scroll(), QDirectFBWindowSurface::scroll(), QGLWindowSurface::scroll(), QRasterWindowSurface::scroll(), QVGEGLWindowSurfaceDirect::scroll(), QWidgetPrivate::scrollRect(), QPainter::setClipRegion(), QClipData::setClipRegion(), PvrEglWindowSurface::setDirectRegion(), QVFbScreen::setDirty(), QMultiScreen::setDirty(), QDirectFBWindowSurface::setGeometry(), QX11WindowSurface::setGeometry(), QWSLocalMemSurface::setGeometry(), QMacStyle::sizeFromContents(), QTransformedScreen::solidFill(), QDirectFBScreen::solidFill(), QWidgetPrivate::subtractOpaqueSiblings(), QWidgetBackingStore::sync(), QGL2PaintEngineExPrivate::systemStateChanged(), QRasterPaintEnginePrivate::systemStateChanged(), QPaintEnginePrivate::transformSystemClip(), QETWidget::translateEmbedEvent(), QWidget::update(), QPicturePaintEngine::updateClipRegion(), QGL2PaintEngineExPrivate::updateClipScissorTest(), QETWidget::updateRegion(), QDesktopWidgetPrivate::updateScreenList(), QVGEGLWindowSurfacePrivate::windowSurfaceSize(), and QPicturePaintEngine::writeCmdLength().
|
staticprivate |
Definition at line 4042 of file qregion.cpp.
Referenced by copy(), operator=(), qt_bitmapToRegion(), and ~QRegion().
bool QRegion::contains | ( | const QPoint & | p | ) | const |
Returns true if the region contains the point p; otherwise returns false.
Definition at line 4104 of file qregion.cpp.
Referenced by QRegionPrivate::contains(), QWSServerPrivate::invokeSelectCursor(), QMultiScreenCursor::move(), QDeclarativePaintedItem::paint(), QDockAreaLayoutInfo::paintSeparators(), QDockAreaLayout::paintSeparators(), parseGeometry(), QWidgetPrivate::pointInsideRectAndMask(), qt_bitmapToRegion(), QDecoration::regionAt(), setMaxWindowRect(), QScreen::subScreenIndexAt(), QApplication::topLevelAt(), and QWSServer::windowAt().
bool QRegion::contains | ( | const QRect & | r | ) | const |
Returns true if the region overlaps the rectangle r; otherwise returns false.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4109 of file qregion.cpp.
|
private |
Definition at line 4077 of file qregion.cpp.
Referenced by detach(), exec(), qt_bitmapToRegion(), and QVector< QPoint >::replace().
|
private |
Definition at line 300 of file qregion.cpp.
Referenced by eor(), intersect(), operator+=(), qt_bitmapToRegion(), setRects(), subtract(), translate(), and unite().
|
private |
Definition at line 130 of file qregion_win.cpp.
Use xored(r) instead.
Definition at line 4345 of file qregion.cpp.
Referenced by qt_bitmapToRegion().
|
private |
Definition at line 336 of file qregion.cpp.
Referenced by exec().
Handle QRegion::handle | ( | ) | const |
Returns a platform-specific region handle.
The Handle
type is HRGN
on Windows, Region
on X11, and RgnHandle
on Mac OS X. On Qt for Embedded Linux it is {void
*}.
Referenced by do_size_hints(), QWindowsXPStylePrivate::drawBackgroundDirectly(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), qt_grab_cursor(), QETWidget::translatePaintEvent(), QWin32PrintEngine::updateClipPath(), QAxServerBase::updateMask(), and QGLContext::updatePaintDevice().
Use intersected(r) instead.
Definition at line 4249 of file qregion.cpp.
Referenced by QVGPaintEngine::clip(), clipTransformIsSimple(), intersects(), QRegionPrivate::operator=(), qt_bitmapToRegion(), PvrEglWindowSurface::setDirectRegion(), and QVGPaintEngine::updateScissor().
Use intersected(rect) instead.
Definition at line 4294 of file qregion.cpp.
Returns a region which is the intersection of this region and r.
The figure shows the intersection of two elliptical regions.
Definition at line 112 of file qregion.h.
Referenced by QFbScreen::doRedraw(), exec(), QBlitterPaintEngine::fillRect(), QGL2PaintEngineExPrivate::fillStencilWithVertexArray(), QBBRasterWindowSurface::flush(), QAlphaPaintEnginePrivate::fullyContained(), operator+(), QWidgetPrivate::scrollRect(), and QX11PaintEngine::updateClipRegion_dev().
Returns a region which is the intersection of this region and the given rect.
Definition at line 113 of file qregion.h.
bool QRegion::intersects | ( | const QRegion & | region | ) | const |
Returns true if this region intersects with region, otherwise returns false.
Definition at line 766 of file qregion.cpp.
Referenced by QWidgetBackingStore::bltRect(), QFbScreen::doRedraw(), QTableViewPrivate::drawAndClipSpans(), QGraphicsScenePrivate::drawSubtreeRecursive(), QDirectFBScreen::exposeRegion(), QScreen::exposeRegion(), QGL2PaintEngineExPrivate::fillStencilWithVertexArray(), QXcbShmImage::preparePaint(), QBBRasterWindowSurface::scroll(), and QWidgetBackingStore::sync().
bool QRegion::intersects | ( | const QRect & | rect | ) | const |
Returns true if this region intersects with rect, otherwise returns false.
Definition at line 4480 of file qregion.cpp.
bool QRegion::isEmpty | ( | ) | const |
Returns true if the region is empty; otherwise returns false.
An empty region is a region that contains no points.
Example:
Definition at line 4098 of file qregion.cpp.
Referenced by _q_paintIntoCache(), QGL2PaintEngineEx::begin(), QWidgetBackingStore::beginPaint(), QMultiScreen::blit(), QScreen::blit(), boundingRect(), QVGPaintEngine::clip(), QGL2PaintEngineEx::clip(), QScreen::compose(), QBBWindow::copyBack(), do_size_hints(), QFbScreen::doRedraw(), QWindowsXPStylePrivate::drawBackgroundDirectly(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QGraphicsScenePrivate::drawItemHelper(), QWidgetPrivate::drawWidget(), effectiveState(), QMultiScreen::exposeRegion(), QDirectFBScreen::exposeRegion(), QScreen::exposeRegion(), QWSServerPrivate::exposeRegion(), QWSWindowSurface::flush(), QWidgetBackingStore::flush(), QGLWindowSurface::flush(), QWidgetPrivate::getOpaqueChildren(), QWSTtyKbPrivate::handleConsoleSwitch(), QWindowSurface::hasStaticContents(), intersects(), QWidgetPrivate::invalidateBuffer(), QWidgetPrivate::invalidateBuffer_resizeHelper(), QWSWindow::isFullyObscured(), isServerProcess(), QWSServerPrivate::lowerWindow(), make_widget_eventUPP(), QTransformedScreen::mapFromDevice(), QWidgetBackingStore::markDirty(), QWidgetBackingStore::markDirtyOnScreen(), QMdiSubWindow::mouseMoveEvent(), QWidgetPrivate::moveRect(), QWSServerPrivate::moveWindowRegion(), operator==(), QDecorationStyled::paint(), QDeclarativePaintedItem::paint(), QScreen::paintBackground(), QWSMemorySurface::painterOffset(), QGraphicsWidget::paintWindowFrame(), parseGeometry(), QBBWindow::post(), QMacCGContext::QMacCGContext(), qt_bitmapToRegion(), qt_flush(), qt_grab_cursor(), qt_mac_clip_cg(), qt_mac_post_retranslateAppMenu(), qt_mac_unregister_widget(), qt_region_strictContains(), qt_tablet_cleanup_wce(), QWSServerPrivate::raiseWindow(), QWidgetBackingStore::removeDirtyWidget(), QWidget::render(), QWidgetPrivate::render(), QWidgetPrivate::render_helper(), QWidget::repaint(), QETWidget::repaintDecoration(), QWSServerPrivate::request_region(), QDirectFbWindowSurface::scroll(), QWidgetPrivate::scrollRect(), QCoreGraphicsPaintEnginePrivate::setClip(), QRasterPaintEngine::setClipRectInDeviceCoords(), QWSWindowSurface::setClipRegion(), QMenuPrivate::setCurrentAction(), PvrEglWindowSurface::setDirectRegion(), QMultiScreen::setDirty(), QWidget::setDisabled(), QWSWindowSurface::setGeometry(), QWSLocalMemSurface::setGeometry(), QWidget::setMask(), QWidgetPrivate::setMask_sys(), QPaintEnginePrivate::setSystemViewport(), QMultiScreen::solidFill(), QDirectFBScreen::solidFill(), QWidgetBackingStore::staticContents(), QWidgetPrivate::subtractOpaqueChildren(), QWidgetPrivate::subtractOpaqueSiblings(), QWidgetBackingStore::sync(), QGL2PaintEngineExPrivate::systemStateChanged(), QApplication::topLevelAt(), QPaintEnginePrivate::transformSystemClip(), QETWidget::translateEmbedEvent(), QETWidget::translatePaintEvent(), QWidgetBackingStore::unflushPaint(), QWidget::update(), QX11PaintEngine::updateBrush(), QOpenGLPaintEngine::updateClipRegion(), QX11PaintEngine::updateClipRegion_dev(), QMdiSubWindowPrivate::updateMask(), QWorkspaceChild::updateMask(), QGLContext::updatePaintDevice(), QX11PaintEngine::updatePen(), updateRedirectedToGraphicsProxyWidget(), QVGPaintEngine::updateScissor(), QApplication::widgetAt(), and QVGEGLWindowSurfacePrivate::windowSurfaceSize().
int QRegion::numRects | ( | ) | const |
Returns the number of rectangles that will be returned in rects().
Definition at line 4456 of file qregion.cpp.
Referenced by QRegionPrivate::append(), QRegionPrivate::canAppend(), QRegionPrivate::canPrepend(), clipTransformIsSimple(), QFbScreen::doRedraw(), QRegionPrivate::intersect(), QDeclarativePaintedItem::paint(), and QRegionPrivate::prepend().
Referenced by operator+(), and qt_bitmapToRegion().
Referenced by operator|=(), and qt_bitmapToRegion().
QRegion::operator QVariant | ( | ) | const |
Returns the region as a QVariant.
Definition at line 677 of file qregion.cpp.
|
inline |
Returns true if this region is different from the other region; otherwise returns false.
Definition at line 144 of file qregion.h.
Applies the united() function to this region and r.
r1+r2
is equivalent to r1.united(r2)
.
Definition at line 523 of file qregion.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 530 of file qregion.cpp.
Applies the united() function to this region and r and assigns the result to this region.
r1+=r2
is equivalent to {r1
= r1.united(r2)}.
Definition at line 4158 of file qregion.cpp.
Referenced by operator|=(), and qt_bitmapToRegion().
Returns a region that is the union of this region with the specified rect.
Definition at line 4220 of file qregion.cpp.
Applies the subtracted() function to this region and r.
r1-r2
is equivalent to r1.subtracted(r2)
.
Definition at line 557 of file qregion.cpp.
Applies the subtracted() function to this region and r and assigns the result to this region.
r1-=r2
is equivalent to {r1
= r1.subtracted(r2)}.
Definition at line 651 of file qregion.cpp.
Assigns r to this region and returns a reference to the region.
Definition at line 4064 of file qregion.cpp.
Referenced by qt_bitmapToRegion().
bool QRegion::operator== | ( | const QRegion & | r | ) | const |
Returns true if the region is equal to r; otherwise returns false.
Definition at line 4467 of file qregion.cpp.
Referenced by qt_region_strictContains().
Applies the xored() function to this region and r.
r1^r2
is equivalent to r1.xored(r2)
.
Definition at line 566 of file qregion.cpp.
Applies the xored() function to this region and r and assigns the result to this region.
r1^=r2
is equivalent to {r1
= r1.xored(r2)}.
Definition at line 661 of file qregion.cpp.
Applies the united() function to this region and r.
r1|r2
is equivalent to r1.united(r2)
.
Definition at line 514 of file qregion.cpp.
Applies the united() function to this region and r and assigns the result to this region.
r1|=r2
is equivalent to {r1
= r1.united(r2)}.
Definition at line 576 of file qregion.cpp.
int QRegion::rectCount | ( | ) | const |
Returns the number of rectangles that will be returned in rects().
Definition at line 4461 of file qregion.cpp.
Referenced by _q_paintIntoCache(), blit_template(), QVGPaintEngine::clip(), QPaintEngineEx::clip(), QRasterPaintEngine::clip(), QDirectFBScreen::exposeRegion(), QScreen::exposeRegion(), QVGCompositionHelper::fillBackground(), QVGPaintEngine::fillRegion(), QGraphicsViewPrivate::findItems(), QDirectFBScreen::flipSurface(), QRasterWindowSurface::flush(), intersects(), QVGPaintEngine::isDefaultClipRegion(), isFullUpdate(), QTransform::map(), qt_regionToPath(), QDirectFbWindowSurface::scroll(), QDirectFBWindowSurface::scroll(), QClipData::setClipRegion(), PvrEglWindowSurface::setDirectRegion(), QDirectFBScreen::solidFill(), and QGL2PaintEngineExPrivate::systemStateChanged().
Returns an array of non-overlapping rectangles that make up the region.
The union of all the rectangles is equal to the original region.
Definition at line 4412 of file qregion.cpp.
Referenced by QPainterPath::addRegion(), QRegionPrivate::append(), QXcbWindowSurface::beginPaint(), QXlibWindowSurface::beginPaint(), QX11WindowSurface::beginPaint(), QRasterWindowSurface::beginPaint(), QWSMemorySurface::beginPaint(), QTransformedScreen::blit(), blit_template(), QGraphicsItem::boundingRegion(), QRegionPrivate::canAppend(), QRegionPrivate::canPrepend(), QPaintEngineEx::clip(), QScreen::compose(), QBBWindow::copyBack(), QLinuxFbScreen::doRedraw(), QVNCScreen::doRedraw(), QFbScreen::doRedraw(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QGraphicsScenePrivate::drawItemHelper(), QBlitterPaintEngine::drawPixmap(), QTreeView::drawTree(), QQnxScreen::exposeRegion(), QProxyScreen::exposeRegion(), QDirectFBScreen::exposeRegion(), QScreen::exposeRegion(), QVGCompositionHelper::fillBackground(), QBlitterPaintEngine::fillRect(), QBlitterPaintEnginePrivate::fillRect(), QVGPaintEngine::fillRegion(), fillRegion(), QGL2PaintEngineExPrivate::fillStencilWithVertexArray(), QGraphicsViewPrivate::findItems(), QDirectFBScreen::flipSurface(), QDirectFbWindowSurface::flush(), QXcbWindowSurface::flush(), QWaylandShmWindowSurface::flush(), QMacWindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), QFbScreen::generateRects(), QClipData::initialize(), QGraphicsItemPrivate::initStyleOption(), QRegionPrivate::intersect(), intersects(), make_widget_eventUPP(), QTransformedScreen::mapFromDevice(), QVGPaintEnginePrivate::modifyMask(), QVNCCursor::move(), operator<<(), QDeclarativePaintedItem::paint(), QScreen::paintBackground(), QBlittablePixmapData::paintEngine(), QTableView::paintEvent(), QMdiArea::paintEvent(), QRasterWindowSurface::prepareBuffer(), QRegionPrivate::prepend(), qt_mac_clip_cg(), qt_mac_fill_background(), qt_mac_post_retranslateAppMenu(), qt_region_strictContains(), qt_regionToPath(), QVNCDirtyMap::QVNCDirtyMap(), QmlJSDebugger::regionToPolygon(), QWSDisplay::repaintRegion(), QDirectFbWindowSurface::scroll(), QXcbWindowSurface::scroll(), QXlibWindowSurface::scroll(), QX11GLWindowSurface::scroll(), QRasterWindowSurface::scroll(), QWSMemorySurface::scroll(), QGraphicsItem::scroll(), QVNCCursor::set(), QPainter::setClipRegion(), QClipData::setClipRegion(), QWSRegionEvent::setData(), QWSRegionCommand::setData(), PvrEglWindowSurface::setDirectRegion(), setRects(), QVGCompositionHelper::setScissor(), QWidgetPrivate::setWindowOpacity_sys(), showYellowThing_win(), QDirectFBScreen::solidFill(), solidFill_template(), QEglContext::swapBuffersRegion2NOK(), QWidgetBackingStore::sync(), QOpenGLPaintEngine::updateClipRegion(), QGLContext::updatePaintDevice(), updateRedirectedToGraphicsProxyWidget(), QVGPaintEngine::updateScissor(), QPdfBaseEngine::updateState(), and QRfbRawEncoder::write().
void QRegion::setRects | ( | const QRect * | rects, |
int | number | ||
) |
Sets the region using the array of rectangles specified by rects and number.
The rectangles must be optimally Y-X sorted and follow these restrictions:
Definition at line 4424 of file qregion.cpp.
Referenced by QWSServerPrivate::invokeRepaintRegion(), qt_region_strictContains(), QApplication::qwsProcessEvent(), and QETWidget::translateRegionEvent().
Use subtracted(r) instead.
Definition at line 4320 of file qregion.cpp.
Referenced by qt_bitmapToRegion().
Returns a region which is r subtracted from this region.
The figure shows the result when the ellipse on the right is subtracted from the ellipse on the left ({left
- right}).
Definition at line 114 of file qregion.h.
Referenced by QPlastiqueStyle::drawControl(), QGtkStyle::drawControl(), exec(), operator-(), and QmlJSDebugger::SubcomponentMaskLayerItem::setCurrentItem().
|
inline |
void QRegion::translate | ( | int | dx, |
int | dy | ||
) |
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition at line 4116 of file qregion.cpp.
Referenced by QOnScreenRasterPaintEngine::begin(), QWidgetBackingStore::beginPaint(), effectiveState(), exec(), QX11WindowSurface::flush(), QWSWindowSurface::flush(), QWSYellowSurface::flush(), QWidgetPrivate::getOpaqueChildren(), isServerProcess(), make_widget_eventUPP(), QMatrix::map(), QTransform::map(), QWidgetPrivate::moveRect(), QWSServerPrivate::moveWindowRegion(), QWidgetPrivate::paintSiblingsRecursive(), QMacCGContext::QMacCGContext(), qt_bitmapToRegion(), qt_mac_unregister_widget(), QGraphicsItem::scroll(), QWidgetPrivate::scrollRect(), QWSWindowSurface::setClipRegion(), QWidget::setMask(), QWidgetBackingStore::showYellowThing(), QWidgetBackingStore::staticContents(), QWidgetPrivate::subtractOpaqueSiblings(), QWidgetBackingStore::sync(), QPaintEnginePrivate::transformSystemClip(), translated(), QETWidget::translateRegionEvent(), and QETWidget::updateRegion().
|
inline |
Translates the region {point}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
x() along the x axis and {point}.y() along the y axis, relative to the current position. Positive values move the region to the right and down.
Translates to the given point.
Definition at line 98 of file qregion.h.
Referenced by translate().
QRegion QRegion::translated | ( | int | dx, |
int | dy | ||
) | const |
Returns a copy of the region that is translated dx along the x axis and dy along the y axis, relative to the current position.
Positive values move the region to the right and down.
Definition at line 743 of file qregion.cpp.
Referenced by QWidgetBackingStore::beginPaint(), QWidgetPrivate::clipToEffectiveMask(), QWidgetBackingStore::dirtyRegion(), QWindowsXPStylePrivate::drawBackgroundDirectly(), QWidgetPrivate::drawWidget(), effectiveState(), QBBRasterWindowSurface::flush(), QWSWindowSurface::flush(), QDirectFBWindowSurface::flush(), QWidgetPrivate::invalidateBuffer_resizeHelper(), QWidgetPrivate::isOverlapped(), QWidgetBackingStore::markDirty(), QWidgetBackingStore::markDirtyOnScreen(), QWidgetPrivate::moveRect(), QTableView::paintEvent(), QWidgetPrivate::paintSiblingsRecursive(), QWidgetBackingStore::removeDirtyWidget(), QWidgetPrivate::render(), QBBRasterWindowSurface::scroll(), QGraphicsView::scrollContentsBy(), QWidgetPrivate::scrollRect(), QWidget::setDisabled(), QWSWindowSurface::setGeometry(), QScreen::solidFill(), QWidgetPrivate::subtractOpaqueSiblings(), QWidgetBackingStore::sync(), and QWidget::visibleRegion().
Returns a copy of the regtion that is translated {p}.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
x() along the x axis and {p}.y() along the y axis, relative to the current position. Positive values move the rectangle to the right and down.
Definition at line 100 of file qregion.h.
Referenced by translated().
Use united(r) instead.
Definition at line 4125 of file qregion.cpp.
Referenced by clipTransformIsSimple(), qt_bitmapToRegion(), and QColumnView::visualRegionForSelection().
Use united(rect) instead.
Definition at line 4188 of file qregion.cpp.
Returns a region which is the union of this region and r.
The figure shows the union of two elliptical regions.
Definition at line 110 of file qregion.h.
Referenced by exec(), operator+(), and operator|().
Returns a region which is the union of this region and the given rect.
Definition at line 111 of file qregion.h.
Returns a region which is the exclusive or (XOR) of this region and r.
The figure shows the exclusive or of two elliptical regions.
Definition at line 115 of file qregion.h.
Referenced by exec(), and operator^().
|
friend |
Writes the region r to the stream s and returns a reference to the stream.
Definition at line 446 of file qregion.cpp.
|
friend |
Reads a region from the stream s into r and returns a reference to the stream.
Definition at line 482 of file qregion.cpp.
|
friend |
Definition at line 195 of file qregion.h.
Referenced by copy(), QRegion(), qt_bitmapToRegion(), and UnionRectWithRegion().
Returns true if rect is guaranteed to be fully contained in region.
A false return value does not guarantee the opposite.
Definition at line 4380 of file qregion.cpp.
|
private |
Definition at line 217 of file qregion.h.
Referenced by boundingRect(), contains(), copy(), detach(), ensureHandle(), eor(), intersect(), intersects(), isEmpty(), numRects(), operator+=(), operator=(), operator==(), QRegion(), qt_bitmapToRegion(), qt_region_strictContains(), rectCount(), rects(), setRects(), subtract(), swap(), translate(), unite(), and ~QRegion().
|
staticprivate |
Definition at line 218 of file qregion.h.
Referenced by QRegionPrivate::canPrepend(), isEmpty(), isEmptyHelper(), and QRegion().