File indexing completed on 2025-01-26 04:11:17

0001 /*
0002  *  SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
0003  *  SPDX-FileCopyrightText: 2004-2008 Boudewijn Rempt <boud@valdyas.org>
0004  *  SPDX-FileCopyrightText: 2004 Clarence Dang <dang@kde.org>
0005  *  SPDX-FileCopyrightText: 2004 Adrian Page <adrian@pagenet.plus.com>
0006  *  SPDX-FileCopyrightText: 2004 Cyrille Berger <cberger@cberger.net>
0007  *
0008  *  SPDX-License-Identifier: GPL-2.0-or-later
0009  */
0010 
0011 #ifndef KIS_DUPLICATEOP_H_
0012 #define KIS_DUPLICATEOP_H_
0013 
0014 #include "kis_brush_based_paintop.h"
0015 
0016 #include <klocalizedstring.h>
0017 
0018 #include <kis_types.h>
0019 #include <brushengine/kis_paintop_factory.h>
0020 #include <brushengine/kis_paintop_settings.h>
0021 #include <KisOpacityOption.h>
0022 #include <KisRotationOption.h>
0023 #include <KisSizeOptionWidget.h>
0024 #include <KisDuplicateOptionData.h>
0025 
0026 
0027 #include "kis_duplicateop_settings.h"
0028 
0029 class KisPaintInformation;
0030 
0031 
0032 class QPointF;
0033 class KisPainter;
0034 
0035 
0036 class KisDuplicateOp : public KisBrushBasedPaintOp
0037 {
0038 
0039 public:
0040 
0041     KisDuplicateOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image);
0042     ~KisDuplicateOp() override;
0043 
0044 protected:
0045     KisSpacingInformation paintAt(const KisPaintInformation& info) override;
0046 
0047     KisSpacingInformation updateSpacingImpl(const KisPaintInformation &info) const override;
0048 
0049 private:
0050 
0051     qreal minimizeEnergy(const qreal* m, qreal* sol, int w, int h);
0052 
0053 private:
0054 
0055     KisImageSP m_image;
0056     KisNodeSP m_node;
0057 
0058     KisDuplicateOptionData m_duplicateOptionData;
0059     KisDuplicateOpSettingsSP m_settings;
0060     KisPaintDeviceSP m_srcdev;
0061     KisPaintDeviceSP m_target;
0062     QPointF m_duplicateStart {QPointF(0.0, 0.0)};
0063     bool m_duplicateStartIsSet {false};
0064     KisSizeOption m_sizeOption;
0065     KisOpacityOption m_opacityOption;
0066     KisRotationOption m_rotationOption;
0067 };
0068 
0069 #endif // KIS_DUPLICATEOP_H_