File indexing completed on 2024-06-09 04:21:52
0001 /* 0002 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org> 0003 * SPDX-FileCopyrightText: 2005 C. Boemann <cbo@boemann.dk> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 #ifndef KIS_NODE_OPACITY_COMMAND_H 0008 #define KIS_NODE_OPACITY_COMMAND_H 0009 0010 #include "kis_node_command.h" 0011 #include "commands_new/KisAsynchronouslyMergeableCommandInterface.h" 0012 #include "boost/optional.hpp" 0013 0014 /// The command for setting the node opacity 0015 class KRITAIMAGE_EXPORT KisNodeOpacityCommand : public KisNodeCommand, public KisAsynchronouslyMergeableCommandInterface 0016 { 0017 0018 public: 0019 /** 0020 * Constructor 0021 * @param node The node the command will be working on. 0022 * @param oldOpacity the old node opacity 0023 * @param newOpacity the new node opacity 0024 */ 0025 KisNodeOpacityCommand(KisNodeSP node, quint8 newOpacity); 0026 0027 void redo() override; 0028 void undo() override; 0029 0030 int id() const override; 0031 bool mergeWith(const KUndo2Command *command) override; 0032 bool canMergeWith(const KUndo2Command *command) const override; 0033 bool canAnnihilateWith(const KUndo2Command *command) const override; 0034 0035 private: 0036 boost::optional<quint8> m_oldOpacity; 0037 QScopedPointer<KUndo2Command> m_autokey; 0038 quint8 m_newOpacity; 0039 }; 0040 0041 #endif /* KIS_NODE_OPACITY_COMMAND_H */