digiKam
contentawareresizetool.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 : 2009-02-01
7  * Description : Content aware resizing tool.
8  *
9  * Copyright (C) 2009 by Julien Pontabry <julien dot pontabry at ulp dot u-strasbg dot fr>
10  * Copyright (C) 2009-2022 by Gilles Caulier <caulier dot gilles 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_EDITOR_CONTENT_AWARE_RESIZE_TOOL_H
26 #define DIGIKAM_EDITOR_CONTENT_AWARE_RESIZE_TOOL_H
27 
28 // Local includes
29 
30 #include "editortool.h"
31 #include "dimg.h"
32 
33 using namespace Digikam;
34 
36 {
37 
39 {
40  Q_OBJECT
41 
42 public:
43 
44  explicit ContentAwareResizeTool(QObject* const parent);
45  ~ContentAwareResizeTool() override;
46 
47 private:
48 
49  void writeSettings() override;
50  void readSettings() override;
51  void preparePreview() override;
52  void prepareFinal() override;
53  void setPreviewImage() override;
54  void setFinalImage() override;
55  void renderingFinished() override;
56  void blockWidgetSignals(bool b);
57  void disableSettings();
58  void contentAwareResizeCore(DImg* const image,
59  int target_width,
60  int target_height,
61  const QImage& mask);
62  void enableMaskSettings(bool b);
63  void enableContentAwareSettings(bool b);
64  bool eventFilter(QObject*, QEvent*) override;
65 
66 private Q_SLOTS:
67 
68  void slotResetSettings() override;
69  void slotValuesChanged();
70  void slotMixedRescaleValueChanged();
71  void slotMaskColorChanged(int);
72  void slotWeightMaskBoxStateChanged(int);
73  void slotMaskPenSizeChanged(int);
74 
75 private:
76 
77  class Private;
78  Private* const d;
79 };
80 
81 } // namespace DigikamEditorContentAwareResizeToolPlugin
82 
83 #endif // DIGIKAM_EDITOR_CONTENT_AWARE_RESIZE_TOOL_H
Definition: dimg.h:62
Definition: editortool.h:136
Definition: contentawareresizetool.cpp:59
Definition: datefolderview.cpp:43