digiKam
imageregionwidget.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 : 2013-07-15
7  * Description : a widget to draw an image clip region.
8  *
9  * Copyright (C) 2013-2014 by Yiou Wang <geow812 at gmail dot com>
10  * Copyright (C) 2010-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles 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_IMAGE_REGION_WIDGET_H
27 #define DIGIKAM_IMAGE_REGION_WIDGET_H
28 
29 // Qt includes
30 
31 #include <QPoint>
32 #include <QRect>
33 #include <QEvent>
34 #include <QPolygon>
35 #include <QPixmap>
36 #include <QResizeEvent>
37 #include <QWheelEvent>
38 
39 // Local includes
40 
41 #include "dimg.h"
42 #include "graphicsdimgview.h"
43 #include "imagezoomsettings.h"
44 #include "digikam_export.h"
45 
46 namespace Digikam
47 {
48 
49 class DIGIKAM_EXPORT ImageRegionWidget : public GraphicsDImgView
50 {
51  Q_OBJECT
52 
53 public:
54 
55  explicit ImageRegionWidget(QWidget* const parent = nullptr, bool paintExtras = true);
56  ~ImageRegionWidget() override;
57 
61  QRect getOriginalImageRegionToRender() const;
62 
70  DImg getOriginalRegionImage(bool useDownscaledImage = false) const;
71 
72  DImg getOriginalImage() const;
73 
74  void setPreviewImage(const DImg& img);
75  void updateImage(const DImg& img);
76 
77  void setCapturePointMode(bool b);
78  bool capturePointMode() const;
79 
80  void setHighLightPoints(const QPolygon& pointsList);
81 
82  void ICCSettingsChanged();
83  void exposureSettingsChanged();
84 
85 Q_SIGNALS:
86 
88  void signalCapturedPointFromOriginal(const Digikam::DColor&, const QPoint&);
89 
90 public Q_SLOTS:
91 
92  void slotPreviewModeChanged(int mode);
93  void slotOriginalImageRegionChanged(bool targetDone=true);
94 
95 protected:
96 
97  void mousePressEvent(QMouseEvent*) override;
98  void mouseReleaseEvent(QMouseEvent*) override;
99 
100 private:
101 
102  void emitCapturedPointFromOriginal(const QPointF&);
103 
104 private Q_SLOTS:
105 
106  void slotOriginalImageRegionChangedDelayed();
107 
108 private:
109 
110  class Private;
111  Private* const d_ptr;
112 };
113 
114 } // namespace Digikam
115 
116 #endif // DIGIKAM_IMAGE_REGION_WIDGET_H
Definition: dcolor.h:43
Definition: dimg.h:62
Definition: graphicsdimgview.h:44
Definition: imageregionwidget.h:50
void signalCapturedPointFromOriginal(const Digikam::DColor &, const QPoint &)
Definition: datefolderview.cpp:43