krita

kis_rotate_visitor.h

00001 /*
00002  *  copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
00003  *
00004  *  this program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the gnu general public license as published by
00006  *  the free software foundation; either version 2 of the license, or
00007  *  (at your option) any later version.
00008  *
00009  *  this program is distributed in the hope that it will be useful,
00010  *  but without any warranty; without even the implied warranty of
00011  *  merchantability or fitness for a particular purpose.  see the
00012  *  gnu general public license for more details.
00013  *
00014  *  you should have received a copy of the gnu general public license
00015  *  along with this program; if not, write to the free software
00016  *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
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         /* Structs for the image rescaling routine */
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     // Implement KisProgressSubject
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_
KDE Home | KDE Accessibility Home | Description of Access Keys