chalk

kis_rotate_visitor.h
1/*
2 * copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
3 *
4 * this program is free software; you can redistribute it and/or modify
5 * it under the terms of the gnu general public license as published by
6 * the free software foundation; either version 2 of the license, or
7 * (at your option) any later version.
8 *
9 * this program is distributed in the hope that it will be useful,
10 * but without any warranty; without even the implied warranty of
11 * merchantability or fitness for a particular purpose. see the
12 * gnu general public license for more details.
13 *
14 * you should have received a copy of the gnu general public license
15 * along with this program; if not, write to the free software
16 * foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
17 */
18#ifndef KIS_ROTATE_VISITOR_H_
19#define KIS_ROTATE_VISITOR_H_
20
21#include "kis_types.h"
22#include "kis_progress_subject.h"
23
24class TQRect;
25class KisPaintDevice;
26class KisProgressDisplayInterface;
27
28class KisRotateVisitor : public KisProgressSubject {
29 typedef KisProgressSubject super;
30
31 /* Structs for the image rescaling routine */
32
33public:
34 KisRotateVisitor();
35 ~KisRotateVisitor();
36
37 void visitKisPaintDevice(KisPaintDevice* dev);
38
39 void rotate(double angle, bool rotateAboutImageCentre, KisProgressDisplayInterface *progress);
40 void shear(double angleX, double angleY, KisProgressDisplayInterface *progress);
41
42private:
43 KisPaintDeviceSP m_dev;
44
45 // Implement KisProgressSubject
46 bool m_cancelRequested;
47 virtual void cancel() { m_cancelRequested = true; }
48
49 void initProgress(TQ_INT32 totalSteps);
50 void incrementProgress();
51 void setProgressDone();
52
53 KisProgressDisplayInterface *m_progress;
54 TQ_INT32 m_progressStep;
55 TQ_INT32 m_progressTotalSteps;
56 TQ_INT32 m_lastProgressPerCent;
57
58 KisPaintDeviceSP rotateRight90(KisPaintDeviceSP src);
59 KisPaintDeviceSP rotateLeft90(KisPaintDeviceSP src);
60 KisPaintDeviceSP rotate180(KisPaintDeviceSP src);
61 KisPaintDeviceSP rotate(KisPaintDeviceSP src, double angle, KisPoint centreOfRotation);
62
63 KisPaintDeviceSP xShear(KisPaintDeviceSP src, double shearX);
64 KisPaintDeviceSP yShear(KisPaintDeviceSP src, double shearY);
65
66};
67
68inline KisRotateVisitor::KisRotateVisitor()
69{
70}
71
72inline KisRotateVisitor::~KisRotateVisitor()
73{
74}
75
76inline void KisRotateVisitor::visitKisPaintDevice(KisPaintDevice* dev)
77{
78 m_dev = dev;
79}
80#endif // KIS_ROTATE_VISITOR_H_
A paint device contains the actual pixel data and offers methods to read and write pixels.