digiKam
icctransform.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-11-18
7  * Description : a class to apply ICC color correction to image.
8  *
9  * Copyright (C) 2005-2006 by F.J. Cruz <fj dot cruz at supercable dot es>
10  * Copyright (C) 2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_ICC_TRANSFORM_H
27 #define DIGIKAM_ICC_TRANSFORM_H
28 
29 // Qt includes
30 
31 #include <QByteArray>
32 #include <QMetaType>
33 #include <QString>
34 
35 // Local includes
36 
37 #include "dimg.h"
38 #include "digikam_export.h"
39 
40 class QImage;
41 
42 namespace Digikam
43 {
44 
45 class DImgLoaderObserver;
46 class TransformDescription;
47 
48 class DIGIKAM_EXPORT IccTransform
49 {
50 public:
51 
53  {
54  Perceptual = 0,
55  RelativeColorimetric = 1,
56  Saturation = 2,
57  AbsoluteColorimetric = 3
58  };
59 
60 public:
61 
62  explicit IccTransform();
63  ~IccTransform();
64 
65  IccTransform(const IccTransform& other);
66  IccTransform& operator=(const IccTransform& other);
67 
72  bool apply(DImg& image, DImgLoaderObserver* const observer = nullptr);
73 
77  bool apply(QImage& qimage);
78 
82  void close();
83 
91  void setEmbeddedProfile(const DImg& image);
92  void setInputProfile(const IccProfile& profile);
93 
97  void setOutputProfile(const IccProfile& profile);
98 
102  void setProofProfile(const IccProfile& profile);
103 
109  void setDoNotEmbedOutputProfile(bool doNotEmbed);
110 
114  void setIntent(RenderingIntent intent);
115  void setIntent(int intent)
116  {
117  setIntent((RenderingIntent)intent);
118  }
119 
120  void setProofIntent(RenderingIntent intent);
121  void setProofIntent(int intent)
122  {
123  setProofIntent((RenderingIntent)intent);
124  }
125 
126  void setUseBlackPointCompensation(bool useBPC);
127  void setCheckGamut(bool checkGamut);
128  void setCheckGamutMaskColor(const QColor& color);
129 
133  IccProfile embeddedProfile() const;
134  IccProfile inputProfile() const;
135  IccProfile outputProfile() const;
136  IccProfile proofProfile() const;
137 
138  RenderingIntent intent() const;
139  RenderingIntent proofIntent() const;
140  bool isUsingBlackPointCompensation() const;
141  bool isCheckingGamut() const;
142  QColor checkGamutMaskColor() const;
143 
148  bool willHaveEffect();
149 
154  IccProfile effectiveInputProfile() const;
155 
159  static void init();
160 
161 private:
162 
163  bool checkProfiles();
164  TransformDescription getDescription(const DImg& image);
165  TransformDescription getProofingDescription(const DImg& image);
166  TransformDescription getDescription(const QImage& image);
167  bool open(TransformDescription& description);
168  bool openProofing(TransformDescription& description);
169  void transform(DImg& img, const TransformDescription&,
170  DImgLoaderObserver* const observer = nullptr);
171  void transform(QImage& img, const TransformDescription&);
172 
173 public:
174 
175  class Private;
176 
177 private:
178 
179  QSharedDataPointer<Private> d;
180 };
181 
182 } // namespace Digikam
183 
184 Q_DECLARE_METATYPE(Digikam::IccTransform)
185 
186 #endif // DIGIKAM_ICC_TRANSFORM_H
Definition: dimgloaderobserver.h:41
Definition: dimg.h:62
Definition: iccprofile.h:43
Definition: icctransform.h:49
void setIntent(int intent)
Definition: icctransform.h:115
void setProofIntent(int intent)
Definition: icctransform.h:121
RenderingIntent
Definition: icctransform.h:53
Definition: datefolderview.cpp:43