digiKam
healingclonetool.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2017-06-15
7  * Description : a tool to replace part of the image using another
8  *
9  * Copyright (C) 2004-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2017 by Shaza Ismail Kaoud <shaza dot ismail dot k at gmail dot com>
11  * Copyright (C) 2019 by Ahmed Fathi <ahmed dot fathi dot abdelmageed at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_EDITOR_HEALING_CLONE_TOOL_H
27 #define DIGIKAM_EDITOR_HEALING_CLONE_TOOL_H
28 
29 // C++ includes
30 
31 #include <vector>
32 
33 // Local includes
34 
35 #include "editortool.h"
36 #include "dimg.h"
37 
38 using namespace Digikam;
39 
41 {
42 
44 {
45  Q_OBJECT
46 
47 public:
48 
54  explicit HealingCloneTool(QObject* const parent);
55 
59  ~HealingCloneTool() override;
60 
61 private Q_SLOTS:
62 
63  void slotResetSettings() override;
64  void slotResized();
65 
66 public Q_SLOTS:
67 
73  void slotReplace(const QPoint& srcPoint, const QPoint& dstPoint);
74  void slotRadiusChanged(int r);
75 
76  void slotLasso(const QPoint& dst);
77  void slotResetLassoPoints();
78  void slotContinuePolygon();
79  void slotIncreaseBrushRadius();
80  void slotDecreaseBrushRadius();
81  void slotPushToUndoStack();
82  void slotUndoClone();
83  void slotRedoClone();
84 
85 private:
86 
87  void readSettings() override;
88  void writeSettings() override;
89  void finalRendering() override;
90 
98  void clone(DImg* const img, const QPoint& srcPoint, const QPoint& dstPoint);
99  std::vector<QPoint> interpolate(const QPoint& start,const QPoint& end);
100 
101  void updateLasso(const std::vector<QPoint>& points);
102  void initializeLassoFlags();
103  void removeLassoPixels();
104  void redrawLassoPixels();
105 
106  void refreshImage();
107 
108 private:
109 
110  class Private;
111  Private* const d;
112 };
113 
114 } // namespace DigikamEditorHealingCloneToolPlugin
115 
116 #endif // DIGIKAM_EDITOR_HEALING_CLONE_TOOL_H
Definition: dimg.h:62
Definition: editortool.h:50
Definition: healingclonetool.cpp:57
Definition: datefolderview.cpp:43