digiKam
stretchfilter.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-24-01
7  * Description : stretch contrast image filter.
8  *
9  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_STRETCH_FILTER_H
25 #define DIGIKAM_STRETCH_FILTER_H
26 
27 // Local includes
28 
29 #include "digikam_export.h"
30 #include "dimgthreadedfilter.h"
31 #include "digikam_globals.h"
32 
33 namespace Digikam
34 {
35 
36 class DImg;
37 
38 class DIGIKAM_EXPORT StretchFilter : public DImgThreadedFilter
39 {
40  Q_OBJECT
41 
42 public:
43 
44  explicit StretchFilter(QObject* const parent = nullptr);
45  StretchFilter(DImg* const orgImage, const DImg* const refImage, QObject* const parent = nullptr);
46  ~StretchFilter() override;
47 
48  static QString FilterIdentifier()
49  {
50  return QLatin1String("digikam:StretchFilter");
51  }
52 
54  {
55  return QList<int>() << 1;
56  }
57 
58  static int CurrentVersion()
59  {
60  return 1;
61  }
62 
63  static QString DisplayableName();
64 
65  QString filterIdentifier() const override
66  {
67  return FilterIdentifier();
68  }
69 
70  FilterAction filterAction() override;
71 
72  void readParameters(const FilterAction& action) override;
73 
74 private:
75 
76  void filterImage() override;
77  void stretchContrastImage();
78 
79 private:
80 
81  struct Q_DECL_HIDDEN double_packet
82  {
83  double_packet()
84  : red (0.0),
85  green(0.0),
86  blue (0.0),
87  alpha(0.0)
88  {
89  }
90 
91  double red;
92  double green;
93  double blue;
94  double alpha;
95  };
96 
97  struct Q_DECL_HIDDEN int_packet
98  {
99  int_packet()
100  : red (0),
101  green(0),
102  blue (0),
103  alpha(0)
104  {
105  }
106 
107  unsigned int red;
108  unsigned int green;
109  unsigned int blue;
110  unsigned int alpha;
111  };
112 
113  DImg m_refImage;
114 };
115 
116 } // namespace Digikam
117 
118 #endif // DIGIKAM_STRETCH_FILTER_H
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: stretchfilter.h:39
static QString FilterIdentifier()
Definition: stretchfilter.h:48
static int CurrentVersion()
Definition: stretchfilter.h:58
QString filterIdentifier() const override
Definition: stretchfilter.h:65
static QList< int > SupportedVersions()
Definition: stretchfilter.h:53
Definition: datefolderview.cpp:43