digiKam
Loading...
Searching...
No Matches
cbfilter.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 : 2006-01-18
7 * Description : color balance filter
8 *
9 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Local includes
19
20#include "digikam_export.h"
21#include "dimgthreadedfilter.h"
22#include "digikam_globals.h"
23
24namespace Digikam
25{
26
27class DImg;
28
29class DIGIKAM_EXPORT CBContainer
30{
31
32public:
33
34 CBContainer() = default;
35 ~CBContainer() = default;
36
37public:
38
39 double red = 1.0;
40 double green = 1.0;
41 double blue = 1.0;
42 double alpha = 1.0;
43 double gamma = 1.0;
44};
45
46// -----------------------------------------------------------------------------------------------
47
48class DIGIKAM_EXPORT CBFilter : public DImgThreadedFilter
49{
50 Q_OBJECT
51
52public:
53
54 explicit CBFilter(QObject* const parent = nullptr);
55 explicit CBFilter(DImg* const orgImage,
56 QObject* const parent = nullptr,
57 const CBContainer& settings = CBContainer());
58 explicit CBFilter(const CBContainer& settings,
59 DImgThreadedFilter* const master,
60 const DImg& orgImage,
61 DImg& destImage,
62 int progressBegin = 0,
63 int progressEnd = 100);
64 ~CBFilter() override;
65
66 static QString FilterIdentifier()
67 {
68 return QLatin1String("digikam:ColorBalanceFilter");
69 }
70
71 static QString DisplayableName();
72
73 static QList<int> SupportedVersions()
74 {
75 return QList<int>() << 1;
76 }
77
78 static int CurrentVersion()
79 {
80 return 1;
81 }
82
83 void readParameters(const FilterAction& action) override;
84
85 QString filterIdentifier() const override
86 {
87 return FilterIdentifier();
88 }
89
90 FilterAction filterAction() override;
91
92private:
93
94 void filterImage() override;
95
96 void reset();
97 void setGamma(double val);
98 void setTables(int* const redMap, int* const greenMap, int* const blueMap, int* const alphaMap, bool sixteenBit);
99 void getTables(int* const redMap, int* const greenMap, int* const blueMap, int* const alphaMap, bool sixteenBit);
100 void adjustRGB(double r, double g, double b, double a, bool sixteenBit);
101 void applyCBFilter(const DImg& image, double r, double g, double b, double a);
102
103private:
104
105 class Private;
106 Private* const d = nullptr;
107};
108
109} // namespace Digikam
Definition cbfilter.h:30
Definition cbfilter.h:49
static QList< int > SupportedVersions()
Definition cbfilter.h:73
static int CurrentVersion()
Definition cbfilter.h:78
QString filterIdentifier() const override
Definition cbfilter.h:85
static QString FilterIdentifier()
Definition cbfilter.h:66
Definition dimgthreadedfilter.h:31
Definition dimg.h:52
Definition filteraction.h:33
Definition datefolderview.cpp:34