Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_transform_worker.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
3 * SPDX-FileCopyrightText: 2005 C. Boemann <cbo@boemann.dk>
4 * SPDX-FileCopyrightText: 2010 Marc Pegon <pe.marc@free.fr>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#ifndef KIS_TRANSFORM_WORKER_H_
10#define KIS_TRANSFORM_WORKER_H_
11
12#include "kis_types.h"
13#include "kritaimage_export.h"
14
15#include <QRect>
16#include <KoUpdater.h>
17
18class KisPaintDevice;
20class QTransform;
21
22class KRITAIMAGE_EXPORT KisTransformWorker
23{
24
25public:
27 double xscale, double yscale,
28 double xshear, double yshear,
29 double rotation,
30 qreal xtranslate, qreal ytranslate,
31 KoUpdaterPtr progress,
32 KisFilterStrategy *filter);
34
35
40 static void mirror(KisPaintDeviceSP dev, qreal axis, Qt::Orientation orientation);
41
45 static void mirrorX(KisPaintDeviceSP dev, qreal axis);
46 static void mirrorY(KisPaintDeviceSP dev, qreal axis);
47
51 static void mirrorX(KisPaintDeviceSP dev);
52 static void mirrorY(KisPaintDeviceSP dev);
53
61 static void offset(KisPaintDeviceSP device, const QPoint &offsetPosition, const QRect &wrapRect);
62
63
64public:
65
66 // returns false if interrupted
67 bool run();
68 bool runPartial(const QRect &processRect);
69
88 QTransform transform() const;
89
93 void transformPixelSelectionOutline(KisPixelSelectionSP pixelSelection) const;
94
95 bool forceSubPixelTranslation() const;
96 void setForceSubPixelTranslation(bool value);
97
98private:
99 // XXX (BSAR): Why didn't we use the shared-pointer versions of the paint device classes?
100 // CBR: because the template functions used within don't work if it's not true pointers
101 template <class T> void transformPass(KisPaintDevice* src,
102 KisPaintDevice* dst,
103 double xscale,
104 double shear,
105 double dx,
106 KisFilterStrategy *filterStrategy,
107 int portion);
108
109 friend class KisTransformWorkerTest;
110
111 static QRect rotateRight90(KisPaintDeviceSP dev,
112 QRect boundRect,
113 KoUpdaterPtr progressUpdater,
114 int portion);
115
116 static QRect rotateLeft90(KisPaintDeviceSP dev,
117 QRect boundRect,
118 KoUpdaterPtr progressUpdater,
119 int portion);
120
121 static QRect rotate180(KisPaintDeviceSP dev,
122 QRect boundRect,
123 KoUpdaterPtr progressUpdater,
124 int portion);
125
126private:
128 double m_xscale, m_yscale;
129 double m_xshear, m_yshear, m_rotation;
130 double m_xshearOrigin, m_yshearOrigin;
131 qreal m_xtranslate, m_ytranslate;
135 bool m_forceSubPixelTranslation {false};
136};
137
138#endif // KIS_TRANSFORM_VISITOR_H_
float value(const T *src, size_t ch)
KisFilterStrategy * m_filter