File indexing completed on 2025-01-26 04:06:01

0001 /*
0002  *  SPDX-FileCopyrightText: 2013 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_MIRROR_PROCESSING_VISITOR_H
0008 #define __KIS_MIRROR_PROCESSING_VISITOR_H
0009 
0010 #include "kis_simple_processing_visitor.h"
0011 #include <QRect>
0012 #include "kis_types.h"
0013 
0014 #include "KisSelectionBasedProcessingHelper.h"
0015 
0016 
0017 class KRITAIMAGE_EXPORT KisMirrorProcessingVisitor : public KisSimpleProcessingVisitor
0018 {
0019 public:
0020     KisMirrorProcessingVisitor(const QRect &bounds, Qt::Orientation orientation);
0021     KisMirrorProcessingVisitor(KisSelectionSP selection, Qt::Orientation orientation);
0022 
0023 private:
0024     void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter) override;
0025     void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
0026 
0027     void visitColorizeMask(KisColorizeMask *node, KisUndoAdapter *undoAdapter) override;
0028 
0029     KUndo2Command* createInitCommand() override;
0030 
0031     void mirrorDevice(KisPaintDeviceSP device);
0032 
0033 private:
0034     void transformPaintDevice(KisPaintDeviceSP device, KisUndoAdapter *undoAdapter);
0035 
0036     QRect m_bounds;
0037     Qt::Orientation m_orientation;
0038     qreal m_axis = 0.0;
0039 
0040     KisSelectionBasedProcessingHelper m_selectionHelper;
0041 };
0042 
0043 #endif /* __KIS_MIRROR_PROCESSING_VISITOR_H */