|
Krita Source Code Documentation
|
#include <kis_qimage_pyramid.h>
Classes | |
| struct | PyramidLevel |
Public Member Functions | |
| QImage | createImage (KisDabShape const &, qreal subPixelX, qreal subPixelY) const |
| QImage | getClosest (QTransform transform, qreal *scale) const |
| QImage | getClosestWithoutWorkaroundBorder (QTransform transform, qreal *scale) const |
| KisQImagePyramid ()=default | |
| KisQImagePyramid (const QImage &baseImage, bool useSmoothingForEnlarging=true) | |
| ~KisQImagePyramid () | |
Static Public Member Functions | |
| static QSizeF | characteristicSize (const QSize &originalSize, KisDabShape const &) |
| static QSize | imageSize (const QSize &originalSize, KisDabShape const &, qreal subPixelX, qreal subPixelY) |
Private Member Functions | |
| void | appendPyramidLevel (const QImage &image) |
| int | findNearestLevel (qreal scale, qreal *baseScale) const |
Static Private Member Functions | |
| static void | calculateParams (KisDabShape const &shape, qreal subPixelX, qreal subPixelY, const QSize &originalSize, QTransform *outputTransform, QSize *outputSize) |
| static void | calculateParams (KisDabShape shape, qreal subPixelX, qreal subPixelY, const QSize &originalSize, qreal baseScale, const QSize &baseSize, QTransform *outputTransform, QSize *outputSize) |
Private Attributes | |
| qreal | m_baseScale {0.0} |
| QVector< PyramidLevel > | m_levels |
| QSize | m_originalSize |
Friends | |
| class | KisGbrBrushTest |
Definition at line 16 of file kis_qimage_pyramid.h.
|
default |
| KisQImagePyramid::KisQImagePyramid | ( | const QImage & | baseImage, |
| bool | useSmoothingForEnlarging = true ) |
Definition at line 19 of file kis_qimage_pyramid.cpp.
References appendPyramidLevel(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_baseScale, m_levels, m_originalSize, MAX_MIPMAP_SCALE, and MIPMAP_SIZE_THRESHOLD.
| KisQImagePyramid::~KisQImagePyramid | ( | ) |
Definition at line 66 of file kis_qimage_pyramid.cpp.
|
private |
QPainter has a bug: when doing a transformation it decides that all the pixels outside of the image (source rect) are equal to the border pixels (CLAMP in terms of openGL). This means that there will be no smooth scaling on the border of the image when it is rotated. To workaround this bug we need to add one pixel wide border to the image, so that it transforms smoothly.
See a unittest in: KisGbrBrushTest::testQPainterTransformationBorder
Definition at line 238 of file kis_qimage_pyramid.cpp.
References m_levels, and QPAINTER_WORKAROUND_BORDER.
|
staticprivate |
Definition at line 134 of file kis_qimage_pyramid.cpp.
References calculateParams().
|
staticprivate |
Definition at line 145 of file kis_qimage_pyramid.cpp.
References baseBrushTransform(), KIS_SAFE_ASSERT_RECOVER_NOOP, ppVar, KisDabShape::rotation(), roundRect(), KisDabShape::scaleX(), KisDabShape::scaleY(), and warnKrita.
|
static |
Definition at line 227 of file kis_qimage_pyramid.cpp.
References baseBrushTransform().
| QImage KisQImagePyramid::createImage | ( | KisDabShape const & | shape, |
| qreal | subPixelX, | ||
| qreal | subPixelY ) const |
QPainter has one more bug: when a QTransform is TxTranslate, it does wrong sampling (probably, Nearest Neighbour) even though we tell it directly that we need SmoothPixmapTransform.
So here is a workaround: we set a negligible scale to convince Qt we use a non-only-translating transform.
Definition at line 260 of file kis_qimage_pyramid.cpp.
References calculateParams(), findNearestLevel(), m_levels, m_originalSize, QPAINTER_WORKAROUND_BORDER, and KisDabShape::scale().
|
private |
Definition at line 70 of file kis_qimage_pyramid.cpp.
References m_baseScale, and m_levels.
| QImage KisQImagePyramid::getClosest | ( | QTransform | transform, |
| qreal * | scale ) const |
Definition at line 315 of file kis_qimage_pyramid.cpp.
References findNearestLevel(), and m_levels.
| QImage KisQImagePyramid::getClosestWithoutWorkaroundBorder | ( | QTransform | transform, |
| qreal * | scale ) const |
Definition at line 329 of file kis_qimage_pyramid.cpp.
References getClosest(), and QPAINTER_WORKAROUND_BORDER.
|
static |
Definition at line 213 of file kis_qimage_pyramid.cpp.
References calculateParams().
|
friend |
Definition at line 37 of file kis_qimage_pyramid.h.
|
private |
Definition at line 54 of file kis_qimage_pyramid.h.
|
private |
Definition at line 64 of file kis_qimage_pyramid.h.
|
private |
Definition at line 53 of file kis_qimage_pyramid.h.