digiKam
bcgfilter.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 : 2005-03-06
7  * Description : a Brightness/Contrast/Gamma image filter.
8  *
9  * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek 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_BCG_FILTER_H
27 #define DIGIKAM_BCG_FILTER_H
28 
29 // Local includes
30 
31 #include "bcgcontainer.h"
32 #include "digikam_export.h"
33 #include "dimgthreadedfilter.h"
34 #include "digikam_globals.h"
35 
36 namespace Digikam
37 {
38 
39 class DImg;
40 
41 class DIGIKAM_EXPORT BCGFilter : public DImgThreadedFilter
42 {
43  Q_OBJECT
44 
45 public:
46 
47  explicit BCGFilter(QObject* const parent = nullptr);
48  explicit BCGFilter(DImg* const orgImage,
49  QObject* const parent = nullptr,
50  const BCGContainer& settings = BCGContainer());
51  explicit BCGFilter(const BCGContainer& settings,
52  DImgThreadedFilter* const master,
53  const DImg& orgImage,
54  const DImg& destImage,
55  int progressBegin = 0,
56  int progressEnd = 100);
57  ~BCGFilter() override;
58 
59  static QString FilterIdentifier()
60  {
61  return QLatin1String("digikam:BCGFilter");
62  }
63 
64  static QString DisplayableName();
65 
67  {
68  return QList<int>() << 1;
69  }
70 
71  static int CurrentVersion()
72  {
73  return 1;
74  }
75 
76  QString filterIdentifier() const override
77  {
78  return FilterIdentifier();
79  }
80 
81  FilterAction filterAction() override;
82 
83  void readParameters(const FilterAction& action) override;
84 
85 private:
86 
87  void filterImage() override;
88 
89  void reset();
90  void setGamma(double val);
91  void setBrightness(double val);
92  void setContrast(double val);
93  void applyBCG(const DImg& image);
94  void applyBCG(uchar* const bits, uint width, uint height, bool sixteenBits);
95 
96 private:
97 
98  class Private;
99  Private* const d;
100 };
101 
102 } // namespace Digikam
103 
104 #endif // DIGIKAM_BCG_FILTER_H
Definition: bcgcontainer.h:43
Definition: bcgfilter.h:42
static int CurrentVersion()
Definition: bcgfilter.h:71
static QString FilterIdentifier()
Definition: bcgfilter.h:59
static QList< int > SupportedVersions()
Definition: bcgfilter.h:66
QString filterIdentifier() const override
Definition: bcgfilter.h:76
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: datefolderview.cpp:43