1 /* 2 * Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 #ifndef KISSAVEGROUPVISITOR_H 19 #define KISSAVEGROUPVISITOR_H 20 21 #include "kritaui_export.h" 22 23 #include <QUrl> 24 #include <QString> 25 26 #include <kis_types.h> 27 #include <kis_node_visitor.h> 28 #include <kis_layer.h> 29 #include <kis_group_layer.h> 30 #include <kis_node.h> 31 #include <kis_image.h> 32 33 34 /** 35 * @brief The KisSaveGroupVisitor class saves the groups in 36 * a Krita image to separate images. 37 */ 38 class KRITAUI_EXPORT KisSaveGroupVisitor : public KisNodeVisitor 39 { 40 public: 41 42 /** 43 * Create a KisSaveGroupVisitor 44 * 45 * @param image: the image to save 46 * @param saveInvisible: also save invisible layers 47 * @param saveTopLevelOnly: if true, only save the toplevel layers, otherwise 48 * descend into groups and save the bottom-most groups (groups that do 49 * not contain another group. 50 * @param path the base location where the images will be saved 51 * @param baseName the basename of the images 52 * @param extension the file format extension 53 * @param mimeFilter the export image type 54 */ 55 KisSaveGroupVisitor(KisImageWSP image, 56 bool saveInvisible, 57 bool saveTopLevelOnly, 58 const QString &path, 59 const QString &baseName, 60 const QString &extension, 61 const QString &mimeFilter); 62 63 ~KisSaveGroupVisitor() override; 64 65 public: 66 67 bool visit(KisNode* ) override; 68 69 bool visit(KisPaintLayer *) override; 70 71 bool visit(KisAdjustmentLayer *) override; 72 73 bool visit(KisExternalLayer *) override; 74 75 bool visit(KisCloneLayer *) override; 76 77 bool visit(KisFilterMask *) override; 78 79 bool visit(KisTransformMask *) override; 80 81 bool visit(KisTransparencyMask *) override; 82 83 bool visit(KisGeneratorLayer * ) override; 84 85 bool visit(KisSelectionMask* ) override; 86 87 bool visit(KisColorizeMask* ) override; 88 89 bool visit(KisGroupLayer *layer) override; 90 91 private: 92 93 KisImageWSP m_image; 94 bool m_saveInvisible; 95 bool m_saveTopLevelOnly; 96 QString m_path; 97 QString m_baseName; 98 QString m_extension; 99 QString m_mimeFilter; 100 }; 101 102 103 #endif // KISSAVEGROUPVISITOR_H 104