File indexing completed on 2024-05-12 15:58:24
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Sven Langkamp <sven.langkamp@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _KIS_LAYERCOMPOSITION_H 0008 #define _KIS_LAYERCOMPOSITION_H 0009 0010 #include "kritaimage_export.h" 0011 0012 #include <QMap> 0013 #include <QUuid> 0014 #include <QDomDocument> 0015 #include <QDomElement> 0016 0017 #include "kis_image.h" 0018 0019 /** 0020 * Storage class for layer compositions. Layer compositions allow to have several states for visible layers 0021 * e.g. used in storyboarding with one background and different foregrounds 0022 */ 0023 class KRITAIMAGE_EXPORT KisLayerComposition 0024 { 0025 public: 0026 KisLayerComposition(KisImageWSP image, const QString& name); 0027 ~KisLayerComposition(); 0028 0029 KisLayerComposition(const KisLayerComposition &rhs, KisImageWSP otherImage = 0); 0030 0031 /** 0032 * Sets name of the composition 0033 */ 0034 void setName(const QString& name); 0035 0036 /** 0037 * Name of the composition as show in the docker 0038 * \return name of the composition 0039 */ 0040 QString name(); 0041 0042 /** 0043 * Stores the current visibility of all layers in the composition 0044 */ 0045 void store(); 0046 0047 /** 0048 * Applies the stored visibility to all the nodes 0049 */ 0050 void apply(); 0051 0052 /** 0053 * Set the export enabled flag, if false the compositions will not be exported 0054 */ 0055 void setExportEnabled(bool enabled); 0056 0057 /** 0058 * Export enabled flag, if false the compositions will not be exported 0059 * \return name of the composition 0060 */ 0061 bool isExportEnabled(); 0062 0063 void setVisible(QUuid id, bool visible); 0064 0065 void setCollapsed(QUuid id, bool collapsed); 0066 0067 void save(QDomDocument& doc, QDomElement& element); 0068 0069 private: 0070 KisImageWSP m_image; 0071 QString m_name; 0072 QMap<QUuid, bool> m_visibilityMap; 0073 QMap<QUuid, bool> m_collapsedMap; 0074 bool m_exportEnabled; 0075 0076 friend class KisCompositionVisitor; 0077 }; 0078 0079 #endif