Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMergeLabeledLayersCommand.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Agata Cacko <cacko.azh@gmail.com>
3 * SPDX-FileCopyrightText: 2022 Deif Lou <ginoba@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#ifndef __KIS_MERGE_LABELED_LAYERS_H
9#define __KIS_MERGE_LABELED_LAYERS_H
10
11#include <QList>
12#include <QString>
13#include <QSharedPointer>
14
15#include "kundo2command.h"
16#include "kritaimage_export.h"
17#include "kis_types.h"
18#include "kis_image.h"
19
21
22class KRITAIMAGE_EXPORT KisMergeLabeledLayersCommand : public KUndo2Command
23{
24public:
48
54 {
55 QUuid nodeId;
58
59 bool operator==(const ReferenceNodeInfo &other) const
60 {
61 return nodeId == other.nodeId && sequenceNumber == other.sequenceNumber && opacity == other.opacity;
62 }
63 };
64
67
78 KisPaintDeviceSP newRefPaintDevice,
79 QList<int> selectedLabels,
80 GroupSelectionPolicy groupSelectionPolicy = GroupSelectionPolicy_SelectAlways);
81
100 ReferenceNodeInfoListSP prevRefNodeInfoList,
101 ReferenceNodeInfoListSP newRefNodeInfoList,
102 KisPaintDeviceSP prevRefPaintDevice,
103 KisPaintDeviceSP newRefPaintDevice,
104 QList<int> selectedLabels,
105 GroupSelectionPolicy groupSelectionPolicy = GroupSelectionPolicy_SelectAlways,
106 bool forceRegeneration = false,
107 KisNodeSP activeNode = nullptr);
108
110
111 void undo() override;
112 void redo() override;
113
114 static KisPaintDeviceSP createRefPaintDevice(KisImageSP originalImage, QString name = "Merge Labeled Layers Reference Paint Device");
115
116private:
117 void mergeLabeledLayers();
118 bool hasToCheckForChangesInNodes() const;
119 QPair<KisNodeSP, QPair<bool, bool>> collectNode(KisNodeSP node) const;
120 bool collectNodes(KisNodeSP node, QList<KisNodeSP> &nodeList, ReferenceNodeInfoList &nodeInfoList) const;
121
122private:
133};
134
135#endif /* __KIS_MERGE_LABELED_LAYERS_H */
virtual void undo()
virtual void redo()
GroupSelectionPolicy
Policies to stablish how the groups should be treated.
@ GroupSelectionPolicy_SelectIfColorLabeled
Groups will be taken into account only if they have set an explicit color label. This ignores groups ...
@ GroupSelectionPolicy_SelectAlways
Groups will be taken into account if their color label matches one of the selected color labels,...
Basic info about a node. This is used to compare and see if the node changed.
bool operator==(const ReferenceNodeInfo &other) const