|
Krita Source Code Documentation
|
#include <KisRegion.h>
Inheritance diagram for KisRegion:Public Member Functions | |
| QRect | boundingRect () const |
| bool | isEmpty () const |
| KisRegion ()=default | |
| KisRegion (const KisRegion &rhs)=default | |
| KisRegion (const QRect &rect) | |
| KisRegion (const QVector< QRect > &rects) | |
| creates a region from a set of non-intersecting rectangles | |
| KisRegion (QVector< QRect > &&rects) | |
| KisRegion (std::initializer_list< QRect > rects) | |
| KisRegion & | operator&= (const QRect &rect) |
| KisRegion & | operator= (const KisRegion &rhs) |
| int | rectCount () const |
| QVector< QRect > | rects () const |
| QRegion | toQRegion () const |
| void | translate (int dx, int dy) |
| KisRegion | translated (int x, int y) const |
Static Public Member Functions | |
| static void | approximateOverlappingRects (QVector< QRect > &rects, int gridSize) |
| static KisRegion | fromOverlappingRects (const QVector< QRect > &rects, int gridSize) |
| static KisRegion | fromQRegion (const QRegion ®ion) |
| static void | makeGridLikeRectsUnique (QVector< QRect > &rects) |
| static QVector< QRect >::iterator | mergeSparseRects (QVector< QRect >::iterator beginIt, QVector< QRect >::iterator endIt) |
| merge a set of rectangles into a smaller set of bigger rectangles | |
Private Member Functions | |
| void | mergeAllRects () |
Private Attributes | |
| QVector< QRect > | m_rects |
Friends | |
| KRITAGLOBAL_EXPORT bool | operator== (const KisRegion &lhs, const KisRegion &rhs) |
An more efficient (and more limited) replacement for QRegion.
Its main purpose it to be able to merge a huge set of rectangles into a smaller set of bigger rectangles, the same thing that QRegion is supposed to do. The main difference (and limitation) is: all the input rects must be non-intersecting. This requirement is perfectly fine for Krita's tiles, which do never intersect.
Definition at line 25 of file KisRegion.h.
|
default |
|
default |
| KisRegion::KisRegion | ( | const QRect & | rect | ) |
Definition at line 285 of file KisRegion.cpp.
References m_rects.
| KisRegion::KisRegion | ( | std::initializer_list< QRect > | rects | ) |
Definition at line 290 of file KisRegion.cpp.
| KisRegion::KisRegion | ( | const QVector< QRect > & | rects | ) |
creates a region from a set of non-intersecting rectangles
| rects | rectangles that should be merged. Rectangles must not intersect. |
Definition at line 295 of file KisRegion.cpp.
References mergeAllRects().
| KisRegion::KisRegion | ( | QVector< QRect > && | rects | ) |
Definition at line 301 of file KisRegion.cpp.
References mergeAllRects().
Simplifies rects in a way that they don't overlap anymore. The actual resulting area may be larger than original rects, but not more than gridSize in any dimension.
Definition at line 240 of file KisRegion.cpp.
References isEmpty(), KIS_SAFE_ASSERT_RECOVER_NOOP, and rects().
| QRect KisRegion::boundingRect | ( | ) | const |
Definition at line 327 of file KisRegion.cpp.
References m_rects.
Approximates a KisRegion from rects, which may overlap. The resulting KisRegion may be larger than the original set of rects, but it is guaranteed to cover it completely.
Definition at line 385 of file KisRegion.cpp.
References approximateOverlappingRects(), KisRegion(), and rects().
|
static |
Definition at line 373 of file KisRegion.cpp.
References m_rects.
| bool KisRegion::isEmpty | ( | ) | const |
Definition at line 278 of file KisRegion.cpp.
References detail::HorizontalMergePolicy::elementIsLess(), and rects().
|
private |
Definition at line 392 of file KisRegion.cpp.
References m_rects, and mergeSparseRects().
|
static |
merge a set of rectangles into a smaller set of bigger rectangles
The algorithm does two passes over the rectangles. First it tries to merge all the rectangles horizontally, then vertically. The merge happens in-place, that is, all the merged elements will be moved to the front of the original range.
The final range is defined by [beginIt, retvalIt)
| beginIt | iterator to the beginning of the source range |
| endIt | iterator to the end of the source range |
Definition at line 233 of file KisRegion.cpp.
References detail::mergeRects().
| KisRegion & KisRegion::operator&= | ( | const QRect & | rect | ) |
Definition at line 313 of file KisRegion.cpp.
References m_rects, and mergeAllRects().
Definition at line 307 of file KisRegion.cpp.
References m_rects.
| int KisRegion::rectCount | ( | ) | const |
Definition at line 337 of file KisRegion.cpp.
References m_rects.
| QVector< QRect > KisRegion::rects | ( | ) | const |
| QRegion KisRegion::toQRegion | ( | ) | const |
Definition at line 347 of file KisRegion.cpp.
References m_rects.
| void KisRegion::translate | ( | int | dx, |
| int | dy ) |
| KisRegion KisRegion::translated | ( | int | x, |
| int | y ) const |
Definition at line 366 of file KisRegion.cpp.
References translate().
Definition at line 398 of file KisRegion.cpp.
|
private |
Definition at line 97 of file KisRegion.h.