|
Krita Source Code Documentation
|
#include <kis_transform_worker.h>
Public Member Functions | |
| bool | forceSubPixelTranslation () const |
| KisTransformWorker (KisPaintDeviceSP dev, double xscale, double yscale, double xshear, double yshear, double rotation, qreal xtranslate, qreal ytranslate, KoUpdaterPtr progress, KisFilterStrategy *filter) | |
| bool | run () |
| bool | runPartial (const QRect &processRect) |
| void | setForceSubPixelTranslation (bool value) |
| QTransform | transform () const |
| void | transformPixelSelectionOutline (KisPixelSelectionSP pixelSelection) const |
| ~KisTransformWorker () | |
Static Public Member Functions | |
| static void | mirror (KisPaintDeviceSP dev, qreal axis, Qt::Orientation orientation) |
| static void | mirrorX (KisPaintDeviceSP dev) |
| static void | mirrorX (KisPaintDeviceSP dev, qreal axis) |
| static void | mirrorY (KisPaintDeviceSP dev) |
| static void | mirrorY (KisPaintDeviceSP dev, qreal axis) |
| static void | offset (KisPaintDeviceSP device, const QPoint &offsetPosition, const QRect &wrapRect) |
Private Member Functions | |
| template<class T > | |
| void | transformPass (KisPaintDevice *src, KisPaintDevice *dst, double xscale, double shear, double dx, KisFilterStrategy *filterStrategy, int portion) |
Static Private Member Functions | |
| static QRect | rotate180 (KisPaintDeviceSP dev, QRect boundRect, KoUpdaterPtr progressUpdater, int portion) |
| static QRect | rotateLeft90 (KisPaintDeviceSP dev, QRect boundRect, KoUpdaterPtr progressUpdater, int portion) |
| static QRect | rotateRight90 (KisPaintDeviceSP dev, QRect boundRect, KoUpdaterPtr progressUpdater, int portion) |
Private Attributes | |
| QRect | m_boundRect |
| KisPaintDeviceSP | m_dev |
| KisFilterStrategy * | m_filter |
| bool | m_forceSubPixelTranslation {false} |
| KoUpdaterPtr | m_progressUpdater |
| double | m_rotation |
| double | m_xscale |
| double | m_xshear |
| double | m_xshearOrigin |
| qreal | m_xtranslate |
| double | m_yscale |
| double | m_yshear |
| double | m_yshearOrigin |
| qreal | m_ytranslate |
Friends | |
| class | KisTransformWorkerTest |
Definition at line 22 of file kis_transform_worker.h.
| KisTransformWorker::KisTransformWorker | ( | KisPaintDeviceSP | dev, |
| double | xscale, | ||
| double | yscale, | ||
| double | xshear, | ||
| double | yshear, | ||
| double | rotation, | ||
| qreal | xtranslate, | ||
| qreal | ytranslate, | ||
| KoUpdaterPtr | progress, | ||
| KisFilterStrategy * | filter ) |
Definition at line 35 of file kis_transform_worker.cc.
References m_dev, m_filter, m_progressUpdater, m_rotation, m_xscale, m_xshear, m_xtranslate, m_yscale, m_yshear, and m_ytranslate.
| KisTransformWorker::~KisTransformWorker | ( | ) |
Definition at line 55 of file kis_transform_worker.cc.
| bool KisTransformWorker::forceSubPixelTranslation | ( | ) | const |
Definition at line 143 of file kis_transform_worker.cc.
References m_forceSubPixelTranslation.
|
static |
Mirror the specified device along the X or Y axis at the coordinate axis.
Definition at line 639 of file kis_transform_worker.cc.
References mirror_impl().
|
static |
Mirror the device relative to the center of its exactBounds()
Definition at line 627 of file kis_transform_worker.cc.
References bounds, KisPaintDevice::exactBounds(), and mirrorX().
|
static |
Convenience methods for mirror(dev, axis, orientation)
Definition at line 617 of file kis_transform_worker.cc.
References mirror_impl().
|
static |
Definition at line 633 of file kis_transform_worker.cc.
References bounds, KisPaintDevice::exactBounds(), and mirrorY().
|
static |
Definition at line 622 of file kis_transform_worker.cc.
References mirror_impl().
|
static |
Offset the specified device with wrapping around edges of rect specified as QRect(0,0,wrapSize.width, wrapSize.height)*
| device | device to be offset |
| offsetPosition | position where the new origin will be |
| wrapRect | width and height of the wrap edge, usual scenario is to use canvas width&height |
Definition at line 644 of file kis_transform_worker.cc.
References KisPaintDevice::colorSpace(), and KisPainter::copyAreaOptimized().
|
staticprivate |
Definition at line 133 of file kis_transform_worker.cc.
References KisPaintDevice::moveTo(), rotateWithTf(), KisPaintDevice::x(), and KisPaintDevice::y().
|
staticprivate |
Definition at line 123 of file kis_transform_worker.cc.
References KisPaintDevice::moveTo(), rotateWithTf(), KisPaintDevice::x(), and KisPaintDevice::y().
|
staticprivate |
Definition at line 113 of file kis_transform_worker.cc.
References KisPaintDevice::moveTo(), rotateWithTf(), KisPaintDevice::x(), and KisPaintDevice::y().
| bool KisTransformWorker::run | ( | ) |
Definition at line 229 of file kis_transform_worker.cc.
References KisPaintDevice::exactBounds(), m_dev, and runPartial().
| bool KisTransformWorker::runPartial | ( | const QRect & | processRect | ) |
We don't check for xtranslate and ytranslate to be integers here, because people expect the translation to be lossless, that is, not doing any resampling.
Theoretically, we could implement a separate option to allow translations with resampling in the transform tool, but I don't know how useful it would be. People who wo pixel art can set scale to something like 99.99% and it should do the trick.
See: https://bugs.kde.org/show_bug.cgi?id=445714
Pre-rotate the image to ensure the actual resampling is done for an angle -pi/4...pi/4. This is faster and produces better quality.
First X-pass, then Y-pass | a 0 0 | | 1 d 0 | m = | b 1 0 | x | 0 e 0 | (matrices are in Qt's notation) | c 0 1 | | 0 f 1 |
Purge the tiles which might be left after scaling down the image
Definition at line 234 of file kis_transform_worker.cc.
References bounds, KisSharedPtr< T >::data(), KisPaintDevice::exactBounds(), m_boundRect, m_dev, m_filter, m_forceSubPixelTranslation, M_PI, m_progressUpdater, m_rotation, m_xscale, m_xshear, m_xtranslate, m_yscale, m_yshear, m_ytranslate, mirrorX(), mirrorY(), KisPaintDevice::moveTo(), KisPaintDevice::purgeDefaultPixels(), qFuzzyCompare(), R, rotate180(), rotateLeft90(), rotateRight90(), swapValues(), updateBounds< KisHLineIteratorSP >(), KisPaintDevice::x(), and KisPaintDevice::y().
| void KisTransformWorker::setForceSubPixelTranslation | ( | bool | value | ) |
Definition at line 148 of file kis_transform_worker.cc.
References m_forceSubPixelTranslation, and value().
| QTransform KisTransformWorker::transform | ( | ) | const |
Returns a matrix of the transformation executed by the worker. Resulting transformation has the following form (in Qt's matrix notation (all the matrices are transposed)):
transform = SC * S * R * T
,where: SC - scale S - shear itself (shearX * shearY) R - rotation (rotation parameter) T - translation (xtranslate, ytranslate)
WARNING: due to some rounding problems in the worker the work it does not correspond to the matrix exactly! The result always differs 1-3 pixel. So be careful with it (or fix it)
Definition at line 59 of file kis_transform_worker.cc.
References m_rotation, m_xscale, m_xshear, m_xtranslate, m_yscale, m_yshear, m_ytranslate, R, and S.
|
private |
Definition at line 193 of file kis_transform_worker.cc.
References m_boundRect, m_progressUpdater, KisFilterWeightsApplicator::processLine(), KisProgressUpdateHelper::step(), KisFilterStrategy::support(), and KisFilterWeightsApplicator::LinePos::unite().
| void KisTransformWorker::transformPixelSelectionOutline | ( | KisPixelSelectionSP | pixelSelection | ) | const |
Transforms the outline of the pixel selection (if it is valid)
Definition at line 69 of file kis_transform_worker.cc.
References KisPixelSelection::outlineCache, KisPixelSelection::outlineCacheValid, KisPixelSelection::setOutlineCache(), and transform().
|
friend |
Definition at line 109 of file kis_transform_worker.h.
|
private |
Definition at line 134 of file kis_transform_worker.h.
|
private |
Definition at line 127 of file kis_transform_worker.h.
|
private |
Definition at line 133 of file kis_transform_worker.h.
|
private |
Definition at line 135 of file kis_transform_worker.h.
|
private |
Definition at line 132 of file kis_transform_worker.h.
|
private |
Definition at line 129 of file kis_transform_worker.h.
|
private |
Definition at line 128 of file kis_transform_worker.h.
|
private |
Definition at line 129 of file kis_transform_worker.h.
|
private |
Definition at line 130 of file kis_transform_worker.h.
|
private |
Definition at line 131 of file kis_transform_worker.h.
|
private |
Definition at line 128 of file kis_transform_worker.h.
|
private |
Definition at line 129 of file kis_transform_worker.h.
|
private |
Definition at line 130 of file kis_transform_worker.h.
|
private |
Definition at line 131 of file kis_transform_worker.h.