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
overlaypainter.h
1#ifndef OVERLAYPAINTER_H
2#define OVERLAYPAINTER_H
3
4#include <QCoreApplication>
5#include <QPainter>
6#include <QPalette>
7
8class LayerCamera;
9class Camera;
10
11struct OverlayPainterOptions
12{
13 int nFrameIndex = 1;
14 bool bCenter = false;
15 bool bThirds = false;
16 bool bGoldenRatio = false;
17 bool bActionSafe = true;
18 int nActionSafe = 5;
19 bool bSafeArea = false;
20 bool bTitleSafe = true;
21 int nTitleSafe = 10;
22 bool bPerspective1 = false;
23 bool bPerspective2 = false;
24 bool bPerspective3 = false;
25 int nOverlayAngle = 15; // for perspective overlays
26 bool bShowSafeAreaHelperText = true;
27 bool bShowHandle = false;
28 bool bGrid = false;
29 int nGridSizeW = 50; /* This is the grid Width IN PIXELS. The grid will scale with the image, though */
30 int nGridSizeH = 50; /* This is the grid Height IN PIXELS. The grid will scale with the image, though */
31 QPointF mSinglePerspPoint;
32 QPointF mLeftPerspPoint;
33 QPointF mRightPerspPoint;
34 QPointF mMiddlePerspPoint;
35};
36
37class OverlayPainter
38{
39 Q_DECLARE_TR_FUNCTIONS(OverlayPainter)
40public:
41 explicit OverlayPainter();
42
43 void setViewTransform(const QTransform view);
44 void setOptions(const OverlayPainterOptions& p) { mOptions = p; }
45
46 void preparePainter(const LayerCamera* cameraLayer, const QPalette& palette);
47
48 void paint(QPainter& painter, const QRect& viewport);
49private:
50 void initializePainter(QPainter& painter);
51
52 void paintGrid(QPainter& painter) const;
53 void paintOverlayCenter(QPainter& painter, const QTransform& camTransform, const QRect& camRect) const;
54 void paintOverlayThirds(QPainter& painter, const QTransform& camTransform, const QRect& camRect) const;
55 void paintOverlayGolden(QPainter& painter, const QTransform& camTransform, const QRect& camRect) const;
56 void paintOverlaySafeAreas(QPainter& painter, const Camera& camera, const QTransform& camTransform, const QRect& camRect) const;
57 void paintOverlayPerspectiveOnePoint(QPainter& painter, const QRect& viewport, const QTransform& camTransform) const;
58 void paintOverlayPerspectiveTwoPoints(QPainter& painter, const QRect& viewport, const Camera& camera, const QTransform& camTransform) const;
59 void paintOverlayPerspectiveThreePoints(QPainter& painter, const QRect& viewport, const Camera& camera, const QTransform& camTransform) const;
60
61 int round100(double f, int gridSize) const;
62
63 OverlayPainterOptions mOptions;
64
65 QTransform mViewTransform;
66
67 const LayerCamera* mCameraLayer = nullptr;
68 QPalette mPalette;
69};
70
71#endif // OVERLAYPAINTER_H
Camera
Definition: camera.h:25
LayerCamera
Definition: layercamera.h:30
OverlayPainter
Definition: overlaypainter.h:38
QPainter
QPalette
QPointF
QRect
QTransform
OverlayPainterOptions
Definition: overlaypainter.h:12
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39