1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174 | /* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2005-11-18
* Description : a class to apply ICC color correction to image.
*
* SPDX-FileCopyrightText: 2005-2006 by F.J. Cruz <fj dot cruz at supercable dot es>
* SPDX-FileCopyrightText: 2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
* SPDX-FileCopyrightText: 2005-2026 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* ============================================================ */
#pragma once
// Qt includes
#include <QByteArray>
#include <QMetaType>
#include <QString>
// Local includes
#include "dimg.h"
#include "digikam_export.h"
class QImage;
namespace Digikam
{
class DImgLoaderObserver;
class TransformDescription;
class DIGIKAM_EXPORT IccTransform
{
public:
enum RenderingIntent
{
Perceptual = 0,
RelativeColorimetric = 1,
Saturation = 2,
AbsoluteColorimetric = 3
};
public:
explicit IccTransform();
~IccTransform();
IccTransform(const IccTransform& other);
IccTransform& operator=(const IccTransform& other);
/**
* Apply this transform with the set profiles and options to the image.
* Optionally pass an observer to get progress information.
*/
bool apply(DImg& image, DImgLoaderObserver* const observer = nullptr);
/**
* Apply this transform to the QImage. This has only basic functionality.
*/
bool apply(QImage& qimage);
/**
* Closes the transform, not the profiles. Called at destruction.
*/
void close();
/**
* Sets the input profiles of this transform.
* You can call both setEmbeddedProfile and setInputProfile.
* If the image contains an embedded profile this profile is used
* and takes precedence over the set input profile, which is used
* without an embedded profile. If none is set, sRGB is used.
*/
void setEmbeddedProfile(const DImg& image);
void setInputProfile(const IccProfile& profile);
/**
* Sets the output transform
*/
void setOutputProfile(const IccProfile& profile);
/**
* Makes this transform a proofing transform, if profile is not null
*/
void setProofProfile(const IccProfile& profile);
/**
* Call this with 'true' if you do not want the output profile
* to be set as embedded profile after apply() did a transformation.
* Default is to set the output profile as embedded profile (false).
*/
void setDoNotEmbedOutputProfile(bool doNotEmbed);
/**
* Set options
*/
void setIntent(RenderingIntent intent);
void setIntent(int intent)<--- Shadow argument
{
setIntent((RenderingIntent)intent);
}
void setProofIntent(RenderingIntent intent);
void setProofIntent(int intent)<--- Shadow argument
{
setProofIntent((RenderingIntent)intent);
}
void setUseBlackPointCompensation(bool useBPC);
void setCheckGamut(bool checkGamut);
void setCheckGamutMaskColor(const QColor& color);
/**
* Returns the contained profiles
*/
IccProfile embeddedProfile() const;
IccProfile inputProfile() const;
IccProfile outputProfile() const;
IccProfile proofProfile() const;
RenderingIntent intent() const;<--- Shadowed function<--- Shadowed function
RenderingIntent proofIntent() const;
bool isUsingBlackPointCompensation() const;
bool isCheckingGamut() const;
QColor checkGamutMaskColor() const;
/**
* Returns if this transformation will have an effect, i.e. if
* effective input profile and output profile are different.
*/
bool willHaveEffect();
/**
* Returns the embedded profile; if none is set, the input profile;
* if none is set, sRGB.
*/
IccProfile effectiveInputProfile() const;
/**
* Initialize LittleCMS library
*/
static void init();
private:
bool checkProfiles();
TransformDescription getDescription(const DImg& image);
TransformDescription getProofingDescription(const DImg& image);
TransformDescription getDescription(const QImage& image);
bool open(TransformDescription& description);
bool openProofing(TransformDescription& description);
void transform(const DImg& img, const TransformDescription&,
DImgLoaderObserver* const observer = nullptr);
void transform(QImage& img, const TransformDescription&);
public:
class Private;
private:
QSharedDataPointer<Private> d;
};
} // namespace Digikam
Q_DECLARE_METATYPE(Digikam::IccTransform)
|