All Classes Namespaces Functions Variables Enumerations Properties Pages
overlaypainter.h
1 #ifndef OVERLAYPAINTER_H
2 #define OVERLAYPAINTER_H
3 
4 
5 #include <QCoreApplication>
6 #include <QPainter>
7 #include "movemode.h"
8 
10 {
11  bool bCenter = false;
12  bool bThirds = false;
13  bool bGoldenRatio = false;
14  bool bActionSafe = true;
15  int nActionSafe = 5;
16  bool bSafeArea = false;
17  bool bTitleSafe = true;
18  int nTitleSafe = 10;
19  bool bPerspective1 = false;
20  bool bPerspective2 = false;
21  bool bPerspective3 = false;
22  int nOverlayAngle = 15; // for perspective overlays
23  bool bShowSafeAreaHelperText = true;
24  bool mIsCamera = false;
25  QRect mRect; // camera rect!
26  QPointF mSinglePerspPoint = QPointF(0.0, 0.0);
27  QPointF mLeftPerspPoint = QPointF(mRect.left(), 0.0);// = QPointF(-300, 0);
28  QPointF mRightPerspPoint = QPointF(mRect.right(), 0.0);// = QPointF(300, 0);
29  QPointF mMiddlePerspPoint = QPointF(0.0, mRect.bottom());// = QPointF(0, 200);
30 
32 };
33 
35 {
36  Q_DECLARE_TR_FUNCTIONS(OverlayPainter)
37 public:
38  explicit OverlayPainter();
39 
40  void setViewTransform(const QTransform view);
41  void setOptions(const OverlayPainterOptions& p) { mOptions = p; }
42  OverlayPainterOptions getOptions() { return mOptions; }
43 
44  void renderOverlays(QPainter& painter, MoveMode mode);
45 
46  void paintOverlayCenter(QPainter& painter);
47  void paintOverlayThirds(QPainter& painter);
48  void paintOverlayGolden(QPainter& painter);
49  void paintOverlaySafeAreas(QPainter& painter);
50  void paintOverlayPerspective1(QPainter& painter);
51  void paintOverlayPerspective2(QPainter& painter);
52  void paintOverlayPerspective3(QPainter& painter);
53 
54  void setCameraRect(QRect rect) { mOptions.mRect = rect; }
55  void setIsCamera(bool isCamera) { mOptions.mIsCamera = isCamera; }
56  void setSinglePoint(QPoint point) { mOptions.mSinglePerspPoint = point; }
57  QPoint getSinglePoint() const { return mOptions.mSinglePerspPoint.toPoint(); }
58  void setLeftPoint(QPoint point) { mOptions.mLeftPerspPoint = point; }
59  QPoint getLeftPoint() const { return mOptions.mLeftPerspPoint.toPoint(); }
60  void setRightPoint(QPoint point) { mOptions.mRightPerspPoint = point; }
61  QPoint getRightPoint() const { return mOptions.mRightPerspPoint.toPoint(); }
62  void setMiddlePoint(QPoint point) { mOptions.mMiddlePerspPoint = point; }
63  QPoint getMiddlePoint() const { return mOptions.mMiddlePerspPoint.toPoint(); }
64  void setMoveMode(MoveMode mode) { mMoveMode = mode; }
65  MoveMode getMoveMode() const { return mMoveMode; }
66 
67 private:
68  OverlayPainterOptions mOptions;
69  MoveMode mMoveMode = MoveMode::NONE;
70 
71  QTransform mViewTransform;
72 };
73 
74 #endif // OVERLAYPAINTER_H
QPoint toPoint() const const