digiKam
levelsfilter.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 : 2010-25-02
7  * Description : Levels image filter
8  *
9  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek 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_LEVELS_FILTER_H
26 #define DIGIKAM_LEVELS_FILTER_H
27 
28 // Local includes
29 
30 #include "digikam_export.h"
31 #include "dimgthreadedfilter.h"
32 #include "digikam_globals.h"
33 
34 namespace Digikam
35 {
36 
37 class DImg;
38 
39 class DIGIKAM_EXPORT LevelsContainer
40 {
41 
42 public:
43 
44  explicit LevelsContainer()
45  {
46  for (int i = 0 ; i < 5 ; ++i)
47  {
48  lInput[i] = 0;
49  hInput[i] = 65535;
50  lOutput[i] = 0;
51  hOutput[i] = 65535;
52  gamma[i] = 1.0;
53  }
54  };
55 
57  {
58  };
59 
60 public:
61 
62  int lInput[5];
63  int hInput[5];
64  int lOutput[5];
65  int hOutput[5];
66 
67  double gamma[5];
68 };
69 
70 // --------------------------------------------------------------------------------
71 
72 class DIGIKAM_EXPORT LevelsFilter : public DImgThreadedFilter
73 {
74  Q_OBJECT
75 
76 public:
77 
78  explicit LevelsFilter(QObject* const parent = nullptr);
79  explicit LevelsFilter(DImg* const orgImage,
80  QObject* const parent = nullptr,
81  const LevelsContainer& settings=LevelsContainer());
82  explicit LevelsFilter(const LevelsContainer& settings,
83  DImgThreadedFilter* const master,
84  const DImg& orgImage,
85  DImg& destImage,
86  int progressBegin=0,
87  int progressEnd=100);
88  ~LevelsFilter() override;
89 
90  static QString FilterIdentifier()
91  {
92  return QLatin1String("digikam:LevelsFilter");
93  }
94 
95  static QString DisplayableName();
96 
98  {
99  return QList<int>() << 1;
100  }
101 
102  static int CurrentVersion()
103  {
104  return 1;
105  }
106 
107  QString filterIdentifier() const override
108  {
109  return FilterIdentifier();
110  }
111 
112  FilterAction filterAction() override;
113  void readParameters(const FilterAction& action) override;
114 
115 private:
116 
117  void filterImage() override;
118 
119 private:
120 
121  LevelsContainer m_settings;
122 };
123 
124 } // namespace Digikam
125 
126 #endif // DIGIKAM_LEVELS_FILTER_H
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: levelsfilter.h:40
~LevelsContainer()
Definition: levelsfilter.h:56
LevelsContainer()
Definition: levelsfilter.h:44
Definition: levelsfilter.h:73
static QList< int > SupportedVersions()
Definition: levelsfilter.h:97
static int CurrentVersion()
Definition: levelsfilter.h:102
static QString FilterIdentifier()
Definition: levelsfilter.h:90
QString filterIdentifier() const override
Definition: levelsfilter.h:107
Definition: datefolderview.cpp:43