krita

kis_transform_worker.h

00001 /*
00002  *  Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
00003  *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KIS_TRANSFORM_WORKER_H_
00021 #define KIS_TRANSFORM_WORKER_H_
00022 
00023 #include "kis_types.h"
00024 #include "kis_progress_subject.h"
00025 
00026 class KisPaintDevice;
00027 class KisProgressDisplayInterface;
00028 class KisHLineIteratorPixel;
00029 class KisVLineIteratorPixel;
00030 class KisFilterStrategy;
00031 
00032 class KisTransformWorker : public KisProgressSubject {
00033     typedef KisProgressSubject super;
00034 
00035 public:
00036     KisTransformWorker(KisPaintDeviceSP dev, double  xscale, double  yscale,
00037         double  xshear, double  yshear, double rotation,
00038         Q_INT32  xtranslate, Q_INT32  ytranslate,
00039         KisProgressDisplayInterface *progress, KisFilterStrategy *filter);
00040     ~KisTransformWorker();
00041 
00042 public:
00043     bool isCanceled() { return m_cancelRequested;};
00044 
00045     bool run();
00046 
00047 private:    
00048     // XXX (BSAR): Why didn't we use the shared-pointer versions of the paint device classes?
00049     template <class T> void transformPass(KisPaintDevice *src, KisPaintDevice *dst, double xscale, double  shear, Q_INT32 dx,   KisFilterStrategy *filterStrategy);
00050     
00051     void rotateRight90(KisPaintDeviceSP src, KisPaintDeviceSP dst);
00052     void rotateLeft90(KisPaintDeviceSP src, KisPaintDeviceSP dst);
00053     void rotate180(KisPaintDeviceSP src, KisPaintDeviceSP dst);
00054 
00055 private:
00056     KisPaintDeviceSP m_dev;
00057     double  m_xscale, m_yscale;
00058     double  m_xshear, m_yshear, m_rotation;
00059     Q_INT32  m_xtranslate, m_ytranslate;
00060     KisProgressDisplayInterface *m_progress;
00061     KisFilterStrategy *m_filter;
00062     // Implement KisProgressSubject
00063     bool m_cancelRequested;
00064     virtual void cancel() { m_cancelRequested = true; }
00065     Q_INT32 m_progressTotalSteps;
00066     Q_INT32 m_progressStep;
00067     Q_INT32 m_progressScaler;
00068     Q_INT32 m_lastProgressReport;
00069 };
00070 
00071 
00072 inline KisTransformWorker::~KisTransformWorker()
00073 {
00074 }
00075 
00076 #endif // KIS_TRANSFORM_VISITOR_H_
KDE Home | KDE Accessibility Home | Description of Access Keys