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

0001 /*
0002  *  SPDX-FileCopyrightText: 2019 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISDECORATIONSWRAPPERLAYER_H
0008 #define KISDECORATIONSWRAPPERLAYER_H
0009 
0010 #include "kis_types.h"
0011 #include "kis_external_layer_iface.h"
0012 #include <QScopedPointer>
0013 
0014 class KisDocument;
0015 
0016 /**
0017  * KisDecorationsWrapperLayer is a fake node for connecting Grids, Guides and Assistants
0018  * the KisNodeVisitor system. This allows things like crops and transformations to be
0019  * applied to these decoration style items.
0020  */
0021 class KisDecorationsWrapperLayer : public KisExternalLayer
0022 {
0023     Q_OBJECT
0024 public:
0025     KisDecorationsWrapperLayer(KisDocument *document);
0026     KisDecorationsWrapperLayer(const KisDecorationsWrapperLayer &rhs);
0027     ~KisDecorationsWrapperLayer();
0028 
0029     void setDocument(KisDocument *document);
0030     KisDocument* document() const;
0031 
0032 
0033 public:
0034     // reimplemented from KisLayer
0035 
0036     bool allowAsChild(KisNodeSP) const override;
0037 
0038     bool accept(KisNodeVisitor&) override;
0039     void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
0040 
0041     KisNodeSP clone() const override;
0042 
0043     KisPaintDeviceSP original() const override;
0044     KisPaintDeviceSP paintDevice() const override;
0045     bool isFakeNode() const override;
0046 
0047     KUndo2Command* crop(const QRect & rect) override;
0048 
0049     KUndo2Command* transform(const QTransform &transform) override;
0050 
0051     bool supportsPerspectiveTransform() const override;
0052 
0053     void setImage(KisImageWSP image) override;
0054 
0055 private:
0056     struct Private;
0057     const QScopedPointer<Private> m_d;
0058 };
0059 
0060 typedef KisSharedPtr<KisDecorationsWrapperLayer> KisDecorationsWrapperLayerSP;
0061 typedef KisWeakSharedPtr<KisDecorationsWrapperLayer> KisDecorationsWrapperLayerWSP;
0062 
0063 
0064 #endif // KISDECORATIONSWRAPPERLAYER_H