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
3
Pencil2D - Traditional Animation Software
4
Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5
Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; version 2 of the License.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU 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
30
class
LayerCamera
;
31
class
Object
;
32
class
QPalette
;
33
class
QPixmap
;
34
class
QRect
;
35
class
KeyFrame
;
36
37
class
CameraPainter
38
{
39
public
:
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
51
private
:
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