File indexing completed on 2024-05-12 15:58:48

0001 /*
0002  *  SPDX-FileCopyrightText: 2021 Eoin O 'Neill <eoinoneill1991@gmail.com>
0003  *  SPDX-FileCopyrightText: 2021 Emmet O 'Neill <emmetoneill.pdx@gmail.com>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef KIS_PROPERTY_WRAPPER_H
0009 #define KIS_PROPERTY_WRAPPER_H
0010 
0011 #include <QObject>
0012 #include <QPointer>
0013 #include <QVariant>
0014 
0015 #include "kis_scalar_keyframe_channel.h"
0016 #include "kis_time_span.h"
0017 #include "kis_image.h"
0018 #include "KoProperties.h"
0019 
0020 #include "kritaimage_export.h"
0021 
0022 class KRITAIMAGE_EXPORT KisAnimatedOpacityProperty : public QObject {
0023     Q_OBJECT
0024 public:
0025     KisAnimatedOpacityProperty(KisDefaultBoundsBaseSP bounds, KoProperties* const props, quint8 defaultValue, QObject *parent = nullptr);
0026 
0027     quint8 get();
0028     void set(const quint8 value);
0029 
0030     bool hasChannel() { return !m_channel.isNull(); }
0031     KisScalarKeyframeChannel* channel() const { return m_channel.data(); }
0032 
0033     void makeAnimated(KisNode* parentNode);
0034     void transferKeyframeData(const KisAnimatedOpacityProperty &rhs);
0035 
0036     void updateDefaultBounds(KisDefaultBoundsBaseSP bounds);
0037 
0038 Q_SIGNALS:
0039     void changed(quint8 value);
0040 
0041 public Q_SLOTS:
0042     void slotKeyChanged(const KisKeyframeChannel*, int time);
0043     void slotKeyRemoval(const KisKeyframeChannel*, int);
0044 
0045 private:
0046     KisDefaultBoundsBaseSP m_bounds;
0047     KoProperties* const m_props;
0048     QScopedPointer<KisScalarKeyframeChannel> m_channel;
0049     quint8 m_defaultValue;
0050 };
0051 
0052 #endif // KISLAMBDAPROPERTY_H