Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_image_animation_interface.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef __KIS_IMAGE_ANIMATION_INTERFACE_H
8#define __KIS_IMAGE_ANIMATION_INTERFACE_H
9
10#include <QObject>
11#include <QScopedPointer>
12
13#include "kis_types.h"
14#include "kritaimage_export.h"
15
17class KisTimeSpan;
19class KoColor;
20class KisRegion;
21class KisLockFrameGenerationLock;
22
23namespace KisLayerUtils {
24 struct SwitchFrameCommand;
25}
26
27class KRITAIMAGE_EXPORT KisImageAnimationInterface : public QObject
28{
29 Q_OBJECT
30
31public:
35
39 bool hasAnimation() const;
40
45 int currentTime() const;
46
51 int currentUITime() const;
52
65 bool externalFrameActive() const;
66
67 void requestTimeSwitchWithUndo(int time);
68
69 void requestTimeSwitchNonGUI(int time, bool useUndo = false);
70
87 void requestFrameRegeneration(int frameId, const KisRegion &dirtyRegion, bool isCancellable, KisLockFrameGenerationLock &&lock);
88
89 void notifyNodeChanged(const KisNode *node, const QRect &rect, bool recursive);
90 void notifyNodeChanged(const KisNode *node, const QVector<QRect> &rects, bool recursive);
91 void invalidateFrames(const KisTimeSpan &range, const QRect &rect);
92 void invalidateFrame(const int time, KisNodeSP target);
93
99 void setDefaultProjectionColor(const KoColor &color);
100
106 const KisTimeSpan& documentPlaybackRange() const;
107 void setDocumentRange(const KisTimeSpan range);
108
115 const KisTimeSpan &activePlaybackRange() const;
116 void setActivePlaybackRange(const KisTimeSpan range);
117
118 int framerate() const;
119
120 QString exportSequenceFilePath();
121 void setExportSequenceFilePath(const QString &filePath);
122
123 QString exportSequenceBaseName();
124 void setExportSequenceBaseName(const QString &baseName);
125
126 int exportInitialFrameNumber();
127 void setExportInitialFrameNumber(const int frameNum);
128
129 QSet<int> activeLayerSelectedTimes();
130 void setActiveLayerSelectedTimes(const QSet<int> &times);
131
132 KisImageWSP image() const;
133
134 int totalLength();
135
148 void blockBackgroundFrameGeneration();
149
155 void unblockBackgroundFrameGeneration();
156
162 bool backgroundFrameGenerationBlocked() const;
163
181 void lockFrameGeneration();
182
188 void unlockFrameGeneration();
189
195 bool tryLockFrameGeneration();
196
198 STAO_NONE = 0,
199 STAO_USE_UNDO = 1 << 1,
200 STAO_FORCE_REGENERATION = 1 << 2
201 };
203
204public Q_SLOTS:
205
210 void switchCurrentTimeAsync(int frameId, SwitchTimeAsyncFlags options = STAO_NONE);
211
212 void setDocumentRangeStartFrame(int column);
213 void setDocumentRangeEndFrame(int column);
214
215 void setFramerate(int fps);
216
217Q_SIGNALS:
226 void sigFrameReady(int time);
227
236 void sigFrameRegenerated(int time);
237
246
248 void sigUiTimeChanged(int newTime);
249 void sigFramesChanged(const KisTimeSpan &range, const QRect &rect);
250
251 void sigInternalRequestTimeSwitch(int frameId, bool useUndo);
252
256
257 void sigKeyframeAdded(const KisKeyframeChannel* channel, int time);
258 void sigKeyframeRemoved(const KisKeyframeChannel* channel, int time);
259
260private:
261 // interface for:
263 friend class KisSuspendProjectionUpdatesStrokeStrategy; //TODO These friend classes are ugly. Let's refactor after Krita 5 release.
264 friend class KisAnimationFrameCacheTest;
266 friend class KisImageTest;
267 void saveAndResetCurrentTime(int frameId, int *savedValue);
268 void restoreCurrentTime(int *savedValue);
269 void notifyFrameReady();
270 void notifyFrameCancelled();
271 void notifyFrameRegenerated();
272 bool requiresOnionSkinRendering();
273
274 KisUpdatesFacade* updatesFacade() const;
275
276 void blockFrameInvalidation(bool value);
277
280 void explicitlySetCurrentTime(int frameId);
281 struct Private;
282 const QScopedPointer<Private> m_d;
283};
284
285#endif /* __KIS_IMAGE_ANIMATION_INTERFACE_H */
float value(const T *src, size_t ch)
KisMagneticGraph::vertex_descriptor target(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
void sigFrameReady(int time)
sigFrameReady notifies when an External frame has been regenerated and is available.
void sigKeyframeRemoved(const KisKeyframeChannel *channel, int time)
void sigUiTimeChanged(int newTime)
void sigFrameRegenerationSkipped(int time)
sigFrameRegenerationSkipped notified when async frame changes are skipped.
Q_DECLARE_FLAGS(SwitchTimeAsyncFlags, SwitchTimeAsyncOption)
void sigInternalRequestTimeSwitch(int frameId, bool useUndo)
void sigKeyframeAdded(const KisKeyframeChannel *channel, int time)
void sigFrameRegenerated(int time)
sigFrameRegenerated notifies when internal frame has been fully regenerated.
void sigFramesChanged(const KisTimeSpan &range, const QRect &rect)
const QScopedPointer< Private > m_d
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
The SwitchFrameCommand struct Switches to frame with undo/redo support.