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
keyframe.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 KeyFrame_H
19#define KeyFrame_H
20
21#include <cstdint>
22#include <vector>
23#include <memory>
24#include <QString>
25#include "pencilerror.h"
26class KeyFrameEventListener;
27
28
29class KeyFrame
30{
31public:
32 explicit KeyFrame();
33 explicit KeyFrame(const KeyFrame& k2);
34 virtual ~KeyFrame();
35
36 KeyFrame& operator=(const KeyFrame& k2);
37
38 int pos() const { return mFrame; }
39 void setPos(int position) { mFrame = position; }
40
41 int length() const { return mLength; }
42 void setLength(int len) { mLength = len; }
43
44 void modification() { mIsModified = true; }
45 void setModified(bool b) { mIsModified = b; }
46 bool isModified() const { return mIsModified; }
47
48 QString fileName() const { return mAttachedFileName; }
49 void setFileName(QString strFileName) { mAttachedFileName = strFileName; }
50
51 void addEventListener(KeyFrameEventListener*);
52 void removeEventListner(KeyFrameEventListener*);
53
54 virtual KeyFrame* clone() const { return nullptr; }
56 virtual void loadFile() {}
57
60 virtual void unloadFile() {}
61
64 virtual bool isLoaded() const { return false; }
65
66 virtual quint64 memoryUsage() { return 0; }
67
68private:
69 int mFrame = -1;
70 int mLength = 1;
71 bool mIsModified = true;
72 QString mAttachedFileName;
73
74 std::vector<KeyFrameEventListener*> mEventListeners;
75};
76
77class KeyFrameEventListener
78{
79public:
80 virtual void onKeyFrameDestroy(KeyFrame*) = 0;
81};
82
83#endif // KeyFrame_H
KeyFrameEventListener
Definition: keyframe.h:78
KeyFrame
Definition: keyframe.h:30
KeyFrame::isLoaded
virtual bool isLoaded() const
A check to ensure that the keyframe holds valid data.
Definition: keyframe.h:64
KeyFrame::unloadFile
virtual void unloadFile()
Unloads the data from memory in order to save memory.
Definition: keyframe.h:60
KeyFrame::loadFile
virtual void loadFile()
Loads the backing file into memory if it exists, otherwise it does nothing.
Definition: keyframe.h:56
QString
Generated on Wed May 20 2026 06:16:32 for Pencil2D by doxygen 1.9.6 based on revision b8a30d7dfe4ff276bcca8087d5396d1507ed94fa