digiKam
healingclonetoolwidget.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 brush for use with tool to replace part of the image using another
8  *
9  * Copyright (C) 2017 by Shaza Ismail Kaoud <shaza dot ismail dot k at gmail dot com>
10  * Copyright (C) 2019 by Ahmed Fathi <ahmed dot fathi dot abdelmageed at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_HEALING_CLONE_TOOL_WIDGET_H
26 #define DIGIKAM_HEALING_CLONE_TOOL_WIDGET_H
27 
28 // Local includes
29 
30 #include "previewtoolbar.h"
31 #include "imageregionwidget.h"
32 #include "imageregionitem.h"
33 
34 using namespace Digikam;
35 
37 {
38 
40 {
41  Q_OBJECT
42 
43 public:
44 
46  {
52  DO_NOTHING
53  };
54  Q_ENUM(HealingCloneState)
55 
56 public:
57 
61  explicit HealingCloneToolWidget(QWidget* const parent = nullptr);
62  ~HealingCloneToolWidget() override;
63 
64  void setBrushValue(int value);
65  void setIsLassoPointsVectorEmpty(bool);
66  void setCloneVectorChanged(bool);
67  void setDrawCursorPosition(const QPointF& topLeftPos);
68  void setSourceCursorPosition(const QPointF& topLeftPos);
69 
70  void changeCursorShape(const QColor& color);
71 
72  bool checkPointOutsideScene(const QPoint& point) const;
73  void updateSourceCursor(const QPointF& pos = QPoint(),
74  int diamter = 10);
75 
76  QPoint mapToImageCoordinates(const QPoint& point) const;
77  QPoint mapFromImageCoordinates(const QPoint& point) const;
78 
79 public Q_SLOTS:
80 
84  void slotSetSourcePoint();
85  void slotMoveImage();
86  void slotLassoSelect();
87 
88 Q_SIGNALS:
89 
94  void signalClone(const QPoint& currentSrc, const QPoint& currentDst);
95  void signalLasso(const QPoint& dst);
103 
104 private Q_SLOTS:
105 
106  void slotImageRegionChanged();
107 
108 protected:
109 
110  void mouseReleaseEvent(QMouseEvent*) override;
111  void mousePressEvent(QMouseEvent*) override;
112  void mouseMoveEvent(QMouseEvent*) override;
113  void mouseDoubleClickEvent(QMouseEvent*) override;
114  void keyPressEvent(QKeyEvent*) override;
115  void keyReleaseEvent(QKeyEvent*) override;
116  void focusOutEvent(QFocusEvent*) override;
117  void focusInEvent(QFocusEvent*) override;
118  bool event(QEvent*) override;
119 
120  void undoSlotSetSourcePoint();
121  void activateState(HealingCloneState state);
122 
123 private:
124 
125  // Disable
127  HealingCloneToolWidget& operator=(const HealingCloneToolWidget&) = delete;
128 
129 private:
130 
131  class Private;
132  Private* const d;
133 };
134 
135 } // namespace DigikamEditorHealingCloneToolPlugin
136 
137 #endif // DIGIKAM_HEALING_CLONE_TOOL_WIDGET_H
HealingCloneState
Definition: healingclonetoolwidget.h:46
@ LASSO_CLONE
Definition: healingclonetoolwidget.h:50
@ SELECT_SOURCE
Definition: healingclonetoolwidget.h:47
@ PAINT
Definition: healingclonetoolwidget.h:48
@ LASSO_DRAW_BOUNDARY
Definition: healingclonetoolwidget.h:49
@ MOVE_IMAGE
Definition: healingclonetoolwidget.h:51
void signalClone(const QPoint &currentSrc, const QPoint &currentDst)
signalClone emitted when the src is set and the user initiated a brush click and keeps emitting with ...
Definition: imageregionwidget.h:50
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: healingclonetool.cpp:57
Definition: datefolderview.cpp:43