digiKam
Loading...
Searching...
No Matches
imagecurves.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 : 2004-12-01
7 * Description : image curves manipulation methods.
8 *
9 * SPDX-FileCopyrightText: 2004-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// Qt includes
18
19#include <QSharedDataPointer>
20#include <QPoint>
21#include <QPolygon>
22#include <QUrl>
23
24// Local includes
25
26#include "digikam_globals.h"
27#include "digikam_export.h"
28
29namespace Digikam
30{
31
32class CurvesContainer;
33
34class DIGIKAM_EXPORT ImageCurves
35{
36
37public:
38
42 static const int NUMBER_OF_POINTS = 17;
43
47 static const int NUM_CHANNELS = 5;
48
52 static const int MULTIPLIER_16BIT = 255;
53
55 {
56 CURVE_SMOOTH = 0,
57 CURVE_FREE
58 };
59
60 typedef double CRMatrix[4][4];
61
62public:
63
64 explicit ImageCurves(bool sixteenBit);
65 explicit ImageCurves(const CurvesContainer& container);
66 ImageCurves(const ImageCurves& other);
68
69 ImageCurves& operator=(const ImageCurves& other);
70
77 void fillFromOtherCurves(const ImageCurves* const otherCurves);
78
79
81
82 void curvesReset();
83 void curvesChannelReset(int channel);
84 void curvesCalculateCurve(int channel);
85 void curvesCalculateAllCurves();
86 float curvesLutFunc(int n_channels, int channel, float value);
87 void curvesLutSetup(int nchannels);
88 void curvesLutProcess(uchar* const srcPR, uchar* const destPR, int w, int h);
89
91
92 void setCurveValue(int channel, int bin, int val);
93 void setCurvePointX(int channel, int point, int x);
94 void setCurvePointY(int channel, int point, int y);
95 void setCurveType(int channel, CurveType type);
96 void setCurveType(CurveType type);
97
98 void setCurvePoint(int channel, int point, const QPoint& val);
99 void setCurvePoints(int channel, const QPolygon& vals);
100 void setCurveValues(int channel, const QPolygon& vals);
101
102 void unsetCurvePoint(int channel, int point);
103
105
106 bool isDirty() const;
107 bool isSixteenBits() const;
108
109 int getCurveValue(int channel, int bin) const;
110 int getCurvePointX(int channel, int point) const;
111 int getCurvePointY(int channel, int point) const;
112 CurveType getCurveType(int channel) const;
113
114 bool isCurvePointEnabled(int channel, int point) const;
115 QPoint getCurvePoint(int channel, int point) const;
116 QPolygon getCurvePoints(int channel) const;
117 QPolygon getCurveValues(int channel) const;
118
120 void setContainer(const CurvesContainer& container);
121
125 CurvesContainer getContainer() const;
126
132 CurvesContainer getContainer(int channel) const;
133
137 bool isLinear(int channel) const;
138 bool isLinear() const;
139
145 QByteArray channelToBinary(int channel) const;
146
153 bool setChannelFromBinary(int channel, const QByteArray& array);
154
156
157 bool saveCurvesToGimpCurvesFile(const QUrl& fileUrl) const;
158 bool loadCurvesFromGimpCurvesFile(const QUrl& fileUrl);
159
160 static QPoint getDisabledValue();
161
162private:
163
164 void curvesPlotCurve(int channel, int p1, int p2, int p3, int p4);
165 void curvesCRCompose(CRMatrix a, CRMatrix b, CRMatrix ab);
166 void freeLutData();
167
168private:
169
170 class Private;
171 QSharedDataPointer<Private> d;
172};
173
174} // namespace Digikam
Definition curvescontainer.h:35
Definition imagecurves.h:35
CurveType
Definition imagecurves.h:55
qulonglong value
Definition itemviewutilities.cpp:585
Definition datefolderview.cpp:34