chalk

kis_transform_worker.h
1/*
2 * Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
3 * Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef KIS_TRANSFORM_WORKER_H_
21#define KIS_TRANSFORM_WORKER_H_
22
23#include "kis_types.h"
24#include "kis_progress_subject.h"
25
26class KisPaintDevice;
27class KisProgressDisplayInterface;
29class KisVLineIteratorPixel;
30class KisFilterStrategy;
31
32class KisTransformWorker : public KisProgressSubject {
33 typedef KisProgressSubject super;
34
35public:
36 KisTransformWorker(KisPaintDeviceSP dev, double xscale, double yscale,
37 double xshear, double yshear, double rotation,
38 TQ_INT32 xtranslate, TQ_INT32 ytranslate,
39 KisProgressDisplayInterface *progress, KisFilterStrategy *filter, bool fixBorderAlpha=false);
40 ~KisTransformWorker();
41
42public:
43 bool isCanceled() { return m_cancelRequested;};
44
45 bool run();
46
47private:
48 // XXX (BSAR): Why didn't we use the shared-pointer versions of the paint device classes?
49 template <class T> void transformPass(KisPaintDevice *src, KisPaintDevice *dst, double xscale, double shear, TQ_INT32 dx, KisFilterStrategy *filterStrategy, bool fixBorderAlpha);
50
51public:
52 void rotateNone(KisPaintDeviceSP src, KisPaintDeviceSP dst);
53 void rotateRight90(KisPaintDeviceSP src, KisPaintDeviceSP dst);
54 void rotateLeft90(KisPaintDeviceSP src, KisPaintDeviceSP dst);
55 void rotate180(KisPaintDeviceSP src, KisPaintDeviceSP dst);
56
57private:
58 KisPaintDeviceSP m_dev;
59 double m_xscale, m_yscale;
60 double m_xshear, m_yshear, m_rotation;
61 TQ_INT32 m_xtranslate, m_ytranslate;
62 KisProgressDisplayInterface *m_progress;
63 KisFilterStrategy *m_filter;
64 // Implement KisProgressSubject
65 bool m_cancelRequested;
66 virtual void cancel() { m_cancelRequested = true; }
67 TQ_INT32 m_progressTotalSteps;
68 TQ_INT32 m_progressStep;
69 TQ_INT32 m_progressScaler;
70 TQ_INT32 m_lastProgressReport;
71 bool m_fixBorderAlpha;
72};
73
74
75inline KisTransformWorker::~KisTransformWorker()
76{
77}
78
79#endif // KIS_TRANSFORM_VISITOR_H_
The pixel iterators are high level iterarators.
A paint device contains the actual pixel data and offers methods to read and write pixels.