Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • structure
camera.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2012-2020 Matthew Chiawen Chang
5
6This program is free software; you can redistribute it and/or
7modify it under the terms of the GNU General Public License
8as published by the Free Software Foundation; version 2 of the License.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15*/
16
17#ifndef CAMERA_H
18#define CAMERA_H
19
20#include <QTransform>
21#include "keyframe.h"
22#include "cameraeasingtype.h"
23
24class Camera : public KeyFrame
25{
26public:
27 explicit Camera();
28 explicit Camera(QPointF translation, qreal rotation, qreal scaling);
29 explicit Camera(QPointF translation, qreal rotation, qreal scaling, CameraEasingType type);
30 explicit Camera(const Camera&);
31 ~Camera() override;
32
33 Camera* clone() const override;
34
35 QTransform getView();
36 void resetTransform();
37 void updateViewTransform();
38 void assign(const Camera& rhs);
39
40 void translate(qreal dx, qreal dy);
41 void translate(const QPointF);
42 QPointF translation() const { return mTranslate; }
43
44 void rotate(qreal degree);
45 qreal rotation() const { return mRotate; }
46
47 void scale(qreal scaleValue);
48 qreal scaling() const { return mScale; }
49
50 bool compare(const Camera& rhs) const;
51
52 void setEasingType(CameraEasingType type);
53 CameraEasingType getEasingType() const { return mEasingType; }
54
55 void setPathControlPoint(QPointF point);
56 QPointF getPathControlPoint() const { return mPathControlPoint; }
57
58 void setPathControlPointMoved(bool pathMoved);
59 bool pathControlPointMoved() const { return mPathControlPointMoved; }
60
61private:
62 QTransform mView;
63 QPointF mTranslate;
64 qreal mRotate = 0.;
65 qreal mScale = 1.;
66 bool mNeedUpdateView = true;
67
68 CameraEasingType mEasingType = CameraEasingType::LINEAR;
69 QPointF mPathControlPoint = QPointF();
70 bool mPathControlPointMoved = false;
71};
72
73#endif // CAMERA_H
Camera
Definition: camera.h:25
KeyFrame
Definition: keyframe.h:30
QPointF
QTransform
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39