digiKam
bwsepiafilter.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 : black and white image filter.
8  *
9  * Copyright (C) 2005-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_BW_SEPIA_FILTER_H
26 #define DIGIKAM_BW_SEPIA_FILTER_H
27 
28 // Qt includes
29 
30 #include <QPolygon>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 #include "dimgthreadedfilter.h"
36 #include "digikam_globals.h"
37 #include "bcgfilter.h"
38 #include "curvesfilter.h"
39 #include "tonalityfilter.h"
40 
41 namespace Digikam
42 {
43 
44 class DImg;
45 
46 class DIGIKAM_EXPORT BWSepiaContainer
47 {
48 
49 public:
50 
52  {
53  BWNoFilter = 0,
60 
76 
80 
88 
89  // Filter version 2
90  BWKodakHIE
91  };
92 
93 public:
94 
96  : preview (false),
97  previewType(BWGeneric),
98  filmType (BWGeneric),
99  filterType (BWNoFilter),
100  toneType (BWNoTone),
101  strength (1.0)
102  {
103  };
104 
105  explicit BWSepiaContainer(int ptype)
106  : preview (true),
107  previewType(ptype),
108  filmType (BWGeneric),
109  filterType (BWNoFilter),
110  toneType (BWNoTone),
111  strength (1.0)
112  {
113  };
114 
115  BWSepiaContainer(int ptype, const CurvesContainer& container)
116  : preview (true),
117  previewType(ptype),
118  filmType (BWGeneric),
119  filterType (BWNoFilter),
120  toneType (BWNoTone),
121  strength (1.0),
122  curvesPrm (container)
123  {
124  };
125 
127  {
128  };
129 
130 public:
131 
132  bool preview;
133 
135  int filmType;
137  int toneType;
138 
139  double strength;
140 
142 
144 };
145 
146 // -----------------------------------------------------------------------------------------------
147 
148 class DIGIKAM_EXPORT BWSepiaFilter : public DImgThreadedFilter
149 {
150  Q_OBJECT
151 
152 public:
153 
154  explicit BWSepiaFilter(QObject* const parent = nullptr);
155  explicit BWSepiaFilter(DImg* orgImage,
156  QObject* const parent = nullptr,
157  const BWSepiaContainer& settings = BWSepiaContainer());
158  ~BWSepiaFilter() override;
159 
160  static QString FilterIdentifier()
161  {
162  return QLatin1String("digikam:BWSepiaFilter");
163  }
164 
165  static QString DisplayableName();
166 
168  {
169  return QList<int>() << 1 << 2;
170  }
171 
172  static int CurrentVersion()
173  {
174  return 2;
175  }
176 
177  QString filterIdentifier() const override
178  {
179  return FilterIdentifier();
180  }
181 
182  FilterAction filterAction() override;
183  void readParameters(const FilterAction& action) override;
184 
185 private:
186 
187  void filterImage() override;
188 
189  DImg getThumbnailForEffect(const DImg& img);
190 
191  void blackAndWhiteConversion(DImg& img, int type);
192  void applyChannelMixer(DImg& img);
193  void applyInfraredFilter(DImg& img, int sensibility);
194  void applyToneFilter(DImg& img, TonalityContainer& settings);
195 
196 private:
197 
198  class Private;
199  Private* const d;
200 };
201 
202 } // namespace Digikam
203 
204 #endif // DIGIKAM_BW_SEPIA_FILTER_H
Definition: bcgcontainer.h:43
Definition: bwsepiafilter.h:47
BlackWhiteConversionType
Definition: bwsepiafilter.h:52
@ BWBrownTone
Definition: bwsepiafilter.h:83
@ BWIlfordSFX400
Definition: bwsepiafilter.h:78
@ BWNoTone
Chemical color tone filter.
Definition: bwsepiafilter.h:81
@ BWPlatinumTone
Definition: bwsepiafilter.h:86
@ BWBlueFilter
Definition: bwsepiafilter.h:59
@ BWAgfa200X
Definition: bwsepiafilter.h:62
@ BWColdTone
Definition: bwsepiafilter.h:84
@ BWIlfordFP4
Definition: bwsepiafilter.h:69
@ BWIlfordXP2Super
Definition: bwsepiafilter.h:72
@ BWIlfordPanF
Definition: bwsepiafilter.h:71
@ BWIlfordDelta400
Definition: bwsepiafilter.h:67
@ BWAgfapan400
Definition: bwsepiafilter.h:65
@ BWSeleniumTone
Definition: bwsepiafilter.h:85
@ BWKodakTriX
Definition: bwsepiafilter.h:75
@ BWYellowGreenFilter
Definition: bwsepiafilter.h:58
@ BWGeneric
B&W film simulation.
Definition: bwsepiafilter.h:61
@ BWYellowFilter
Definition: bwsepiafilter.h:57
@ BWGreenTone
Definition: bwsepiafilter.h:87
@ BWOrangeFilter
Definition: bwsepiafilter.h:55
@ BWGreenFilter
Definition: bwsepiafilter.h:54
@ BWIlfordDelta100
Definition: bwsepiafilter.h:66
@ BWIlfordSFX200
Infrared film simulation.
Definition: bwsepiafilter.h:77
@ BWKodakTmax400
Definition: bwsepiafilter.h:74
@ BWRedFilter
Definition: bwsepiafilter.h:56
@ BWIlfordSFX800
Definition: bwsepiafilter.h:79
@ BWIlfordHP5
Definition: bwsepiafilter.h:70
@ BWIlfordDelta400Pro3200
Definition: bwsepiafilter.h:68
@ BWAgfapan25
Definition: bwsepiafilter.h:63
@ BWSepiaTone
Definition: bwsepiafilter.h:82
@ BWAgfapan100
Definition: bwsepiafilter.h:64
@ BWKodakTmax100
Definition: bwsepiafilter.h:73
int previewType
Definition: bwsepiafilter.h:134
int filterType
Definition: bwsepiafilter.h:136
BWSepiaContainer(int ptype, const CurvesContainer &container)
Definition: bwsepiafilter.h:115
CurvesContainer curvesPrm
Definition: bwsepiafilter.h:141
double strength
Definition: bwsepiafilter.h:139
~BWSepiaContainer()
Definition: bwsepiafilter.h:126
BCGContainer bcgPrm
Definition: bwsepiafilter.h:143
bool preview
Definition: bwsepiafilter.h:128
BWSepiaContainer()
Definition: bwsepiafilter.h:95
BWSepiaContainer(int ptype)
Definition: bwsepiafilter.h:105
int toneType
Definition: bwsepiafilter.h:137
int filmType
Definition: bwsepiafilter.h:135
Definition: bwsepiafilter.h:149
static QList< int > SupportedVersions()
Definition: bwsepiafilter.h:167
static int CurrentVersion()
Definition: bwsepiafilter.h:172
QString filterIdentifier() const override
Definition: bwsepiafilter.h:177
static QString FilterIdentifier()
Definition: bwsepiafilter.h:160
Definition: curvescontainer.h:44
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: tonalityfilter.h:40
Definition: datefolderview.cpp:43