File indexing completed on 2024-05-12 16:01:54

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #ifndef KISSAVEGROUPVISITOR_H
0007 #define KISSAVEGROUPVISITOR_H
0008 
0009 #include "kritaui_export.h"
0010 
0011 #include <QUrl>
0012 #include <QString>
0013 
0014 #include <kis_types.h>
0015 #include <kis_node_visitor.h>
0016 #include <kis_layer.h>
0017 #include <kis_group_layer.h>
0018 #include <kis_node.h>
0019 #include <kis_image.h>
0020 
0021 
0022 /**
0023  * @brief The KisSaveGroupVisitor class saves the groups in
0024  * a Krita image to separate images.
0025  */
0026 class KRITAUI_EXPORT KisSaveGroupVisitor : public KisNodeVisitor
0027 {
0028 public:
0029 
0030     /**
0031      * Create a KisSaveGroupVisitor
0032      *
0033      * @param image: the image to save
0034      * @param saveInvisible: also save invisible layers
0035      * @param saveTopLevelOnly: if true, only save the toplevel layers, otherwise
0036      *        descend into groups and save the bottom-most groups (groups that do
0037      *        not contain another group.
0038      * @param path the base location where the images will be saved
0039      * @param baseName the basename of the images
0040      * @param extension the file format extension
0041      * @param mimeFilter the export image type
0042      */
0043     KisSaveGroupVisitor(KisImageWSP image,
0044                         bool saveInvisible,
0045                         bool saveTopLevelOnly,
0046                         const QString &path,
0047                         const QString &baseName,
0048                         const QString &extension,
0049                         const QString &mimeFilter);
0050 
0051     ~KisSaveGroupVisitor() override;
0052 
0053 public:
0054 
0055     bool visit(KisNode* ) override;
0056 
0057     bool visit(KisPaintLayer *) override;
0058 
0059     bool visit(KisAdjustmentLayer *) override;
0060 
0061     bool visit(KisExternalLayer *) override;
0062 
0063     bool visit(KisCloneLayer *) override;
0064 
0065     bool visit(KisFilterMask *) override;
0066 
0067     bool visit(KisTransformMask *) override;
0068 
0069     bool visit(KisTransparencyMask *) override;
0070 
0071     bool visit(KisGeneratorLayer * ) override;
0072 
0073     bool visit(KisSelectionMask* ) override;
0074 
0075     bool visit(KisColorizeMask* ) override;
0076 
0077     bool visit(KisGroupLayer *layer) override;
0078 
0079 private:
0080 
0081     KisImageWSP m_image;
0082     bool m_saveInvisible;
0083     bool m_saveTopLevelOnly;
0084     QString m_path;
0085     QString m_baseName;
0086     QString m_extension;
0087     QString m_mimeFilter;
0088 };
0089 
0090 
0091 #endif // KISSAVEGROUPVISITOR_H