|
Krita Source Code Documentation
|
#include "kis_transform_worker.h"#include <qmath.h>#include <klocalizedstring.h>#include <QTransform>#include <KoColorSpace.h>#include <KoCompositeOpRegistry.h>#include <KoColor.h>#include "kis_paint_device.h"#include "kis_debug.h"#include "kis_selection.h"#include "kis_iterator_ng.h"#include "kis_random_accessor_ng.h"#include "kis_filter_strategy.h"#include "kis_painter.h"#include "kis_filter_weights_applicator.h"#include "kis_progress_update_helper.h"#include "kis_pixel_selection.h"#include "kis_image.h"Go to the source code of this file.
Functions | |
| template<class iter > | |
| void | calcDimensions (QRect rc, qint32 &srcStart, qint32 &srcLen, qint32 &firstLine, qint32 &numLines) |
| template<> | |
| void | calcDimensions< KisHLineIteratorSP > (QRect rc, qint32 &srcStart, qint32 &srcLen, qint32 &firstLine, qint32 &numLines) |
| template<> | |
| void | calcDimensions< KisVLineIteratorSP > (QRect rc, qint32 &srcStart, qint32 &srcLen, qint32 &firstLine, qint32 &numLines) |
| void | mirror_impl (KisPaintDeviceSP dev, qreal axis, bool isHorizontal) |
| QRect | rotateWithTf (int rotation, KisPaintDeviceSP dev, QRect boundRect, KoUpdaterPtr progressUpdater, int portion) |
| template<typename T > | |
| void | swapValues (T *a, T *b) |
| template<class iter > | |
| void | updateBounds (QRect &boundRect, const KisFilterWeightsApplicator::LinePos &newBounds) |
| template<> | |
| void | updateBounds< KisHLineIteratorSP > (QRect &boundRect, const KisFilterWeightsApplicator::LinePos &newBounds) |
| template<> | |
| void | updateBounds< KisVLineIteratorSP > (QRect &boundRect, const KisFilterWeightsApplicator::LinePos &newBounds) |
| void calcDimensions | ( | QRect | rc, |
| qint32 & | srcStart, | ||
| qint32 & | srcLen, | ||
| qint32 & | firstLine, | ||
| qint32 & | numLines ) |
| void calcDimensions< KisHLineIteratorSP > | ( | QRect | rc, |
| qint32 & | srcStart, | ||
| qint32 & | srcLen, | ||
| qint32 & | firstLine, | ||
| qint32 & | numLines ) |
Definition at line 155 of file kis_transform_worker.cc.
| void calcDimensions< KisVLineIteratorSP > | ( | QRect | rc, |
| qint32 & | srcStart, | ||
| qint32 & | srcLen, | ||
| qint32 & | firstLine, | ||
| qint32 & | numLines ) |
Definition at line 164 of file kis_transform_worker.cc.
| void mirror_impl | ( | KisPaintDeviceSP | dev, |
| qreal | axis, | ||
| bool | isHorizontal ) |
We split the total mirror rect into two halves, which lay to the 'left' and 'right' from the axis. Effectively, these halves should be swapped, but there is a bit of optimization: some parts of these portions overlap and some don't. So former ones should be really swapped, but the latter ones just moved to the other side.
So the algorithm consists of two stages:
1) Move the non-overlapping portion of the mirror rect to the other side of the axis. The move may be either left-to-right or right-to-left.
2) Use slow 'swap' operation for the remaining portion of the mirrorRect.
NOTE: the algorithm works with (column, row) coordinates which are mapped to the real (x, y) depending on the value of 'isHorizontal' parameter.
If the axis is not aligned, that is crosses some pixel cell, we should just skip this column and not process it. Actually, how can we mirror the central single-pixel column?
Definition at line 444 of file kis_transform_worker.cc.
References KisPaintDevice::createRandomAccessorNG(), KoColor::data(), KisPaintDevice::defaultPixel(), KisPaintDevice::exactBounds(), KIS_ASSERT_RECOVER_RETURN, KisRandomConstAccessorNG::moveTo(), KisRandomConstAccessorNG::numContiguousColumns(), KisRandomConstAccessorNG::numContiguousRows(), KisPaintDevice::pixelSize(), KisBaseAccessor::rawData(), and KisRandomConstAccessorNG::rowStride().
| QRect rotateWithTf | ( | int | rotation, |
| KisPaintDeviceSP | dev, | ||
| QRect | boundRect, | ||
| KoUpdaterPtr | progressUpdater, | ||
| int | portion ) |
Definition at line 77 of file kis_transform_worker.cc.
References KisPaintDevice::colorSpace(), KisPaintDevice::createRandomAccessorNG(), KisPaintDevice::makeCloneFrom(), KisRandomConstAccessorNG::moveTo(), KisPaintDevice::pixelSize(), KisBaseAccessor::rawData(), and KisProgressUpdateHelper::step().
| void swapValues | ( | T * | a, |
| T * | b ) |
Definition at line 223 of file kis_transform_worker.cc.
| void updateBounds | ( | QRect & | boundRect, |
| const KisFilterWeightsApplicator::LinePos & | newBounds ) |
| void updateBounds< KisHLineIteratorSP > | ( | QRect & | boundRect, |
| const KisFilterWeightsApplicator::LinePos & | newBounds ) |
Definition at line 179 of file kis_transform_worker.cc.
References KisFilterWeightsApplicator::LinePos::size(), and KisFilterWeightsApplicator::LinePos::start().
| void updateBounds< KisVLineIteratorSP > | ( | QRect & | boundRect, |
| const KisFilterWeightsApplicator::LinePos & | newBounds ) |
Definition at line 186 of file kis_transform_worker.cc.
References KisFilterWeightsApplicator::LinePos::size(), and KisFilterWeightsApplicator::LinePos::start().