krita
kis_rotate_visitor.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KIS_ROTATE_VISITOR_H_
00019 #define KIS_ROTATE_VISITOR_H_
00020
00021 #include "kis_types.h"
00022 #include "kis_progress_subject.h"
00023
00024 class QRect;
00025 class KisPaintDevice;
00026 class KisProgressDisplayInterface;
00027
00028 class KisRotateVisitor : public KisProgressSubject {
00029 typedef KisProgressSubject super;
00030
00031
00032
00033 public:
00034 KisRotateVisitor();
00035 ~KisRotateVisitor();
00036
00037 void visitKisPaintDevice(KisPaintDevice* dev);
00038
00039 void rotate(double angle, bool rotateAboutImageCentre, KisProgressDisplayInterface *progress);
00040 void shear(double angleX, double angleY, KisProgressDisplayInterface *progress);
00041
00042 private:
00043 KisPaintDeviceSP m_dev;
00044
00045
00046 bool m_cancelRequested;
00047 virtual void cancel() { m_cancelRequested = true; }
00048
00049 void initProgress(Q_INT32 totalSteps);
00050 void incrementProgress();
00051 void setProgressDone();
00052
00053 KisProgressDisplayInterface *m_progress;
00054 Q_INT32 m_progressStep;
00055 Q_INT32 m_progressTotalSteps;
00056 Q_INT32 m_lastProgressPerCent;
00057
00058 KisPaintDeviceSP rotateRight90(KisPaintDeviceSP src);
00059 KisPaintDeviceSP rotateLeft90(KisPaintDeviceSP src);
00060 KisPaintDeviceSP rotate180(KisPaintDeviceSP src);
00061 KisPaintDeviceSP rotate(KisPaintDeviceSP src, double angle, KisPoint centreOfRotation);
00062
00063 KisPaintDeviceSP xShear(KisPaintDeviceSP src, double shearX);
00064 KisPaintDeviceSP yShear(KisPaintDeviceSP src, double shearY);
00065
00066 };
00067
00068 inline KisRotateVisitor::KisRotateVisitor()
00069 {
00070 }
00071
00072 inline KisRotateVisitor::~KisRotateVisitor()
00073 {
00074 }
00075
00076 inline void KisRotateVisitor::visitKisPaintDevice(KisPaintDevice* dev)
00077 {
00078 m_dev = dev;
00079 }
00080 #endif // KIS_ROTATE_VISITOR_H_
|