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
camerapainter.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17
18#ifndef CAMERAPAINTER_H
19#define CAMERAPAINTER_H
20
21#include <memory>
22#include <QColor>
23#include <QTransform>
24#include <QPen>
25
26#include "onionskinpainteroptions.h"
27#include "onionskinsubpainter.h"
28#include "pencildef.h"
29
30class LayerCamera;
31class Object;
32class QPalette;
33class QPixmap;
34class QRect;
35class KeyFrame;
36
37class CameraPainter
38{
39public:
40 explicit CameraPainter(QPixmap& canvas);
41
42 void paint(const QRect& blitRect);
43 void paintCached(const QRect& blitRect);
44
45 void setOnionSkinPainterOptions(const OnionSkinPainterOptions& options) { mOnionSkinOptions = options; }
46 void preparePainter(const Object* object, int layerIndex, int frameIndex, const QTransform& transform, bool isPlaying, LayerVisibility layerVisibility, float relativeLayerOpacityThreshold, qreal viewScale);
47 void reset();
48
49 void resetCache();
50
51private:
52 void initializePainter(QPainter& painter, QPixmap& pixmap, const QRect& blitRect, bool blitEnabled);
53 void paintVisuals(QPainter& painter, const QRect& blitRect);
54 void paintBorder(QPainter& painter, const QTransform& camTransform, const QRect& camRect);
55 void paintOnionSkinning(QPainter& painter, const LayerCamera* cameraLayer);
56
57 const Object* mObject = nullptr;
58 QPixmap& mCanvas;
59
60 QPixmap mCameraPixmap;
61 QTransform mViewTransform;
62
63 const QPointF mZeroPoint;
64
65 OnionSkinSubPainter mOnionSkinPainter;
66 OnionSkinPainterOptions mOnionSkinOptions;
67
68 int mFrameIndex = 0;
69 int mCurrentLayerIndex = 0;
70 LayerVisibility mLayerVisibility;
71 float mRelativeLayerOpacityThreshold = 0;
72 qreal mViewScale = 0;
73
74 bool mIsPlaying = false;
75 bool mCameraCacheValid = false;
76};
77
78#endif // CAMERAPAINTER_H
CameraPainter
Definition: camerapainter.h:38
KeyFrame
Definition: keyframe.h:30
LayerCamera
Definition: layercamera.h:30
Object
Definition: object.h:42
OnionSkinSubPainter
A Sub Painter class is meant to be used in existing painter classes It does not and should not cary t...
Definition: onionskinsubpainter.h:32
QPainter
QPalette
QPixmap
QPointF
QRect
QTransform
OnionSkinPainterOptions
Definition: onionskinpainteroptions.h:20
Generated on Thu Jun 5 2025 14:06:43 for Pencil2D by doxygen 1.9.6 based on revision 4c63407997b2c03e5048716586dec6fbbb755173