digiKam
iccmanager.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 : 2009-08-12
7  * Description : methods that implement color management tasks
8  *
9  * Copyright (C) 2005-2006 by F.J. Cruz <fj dot cruz at supercable dot es>
10  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
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_MANAGER_H
27 #define DIGIKAM_ICC_MANAGER_H
28 
29 // Local includes
30 
31 #include "digikam_export.h"
32 #include "iccprofile.h"
33 #include "iccsettings.h"
34 #include "iccsettingscontainer.h"
35 
36 namespace Digikam
37 {
38 
39 class DImg;
40 class DImgLoaderObserver;
41 class IccTransform;
42 
43 class DIGIKAM_EXPORT IccManager
44 {
45 public:
46 
51  explicit IccManager(const DImg& image, const ICCSettingsContainer& settings = IccSettings::instance()->settings());
52  ~IccManager();
53 
54  void setObserver(DImgLoaderObserver* const observer);
55 
56  DImg image() const;
57  ICCSettingsContainer settings() const;
58  DImgLoaderObserver* observer() const;
59 
60  bool hasValidWorkspace() const;
61  bool isUncalibratedColor() const;
62  bool isMissingProfile() const;
63  bool isProfileMismatch() const;
64 
70  void transformDefault();
71 
75  void transform(ICCSettingsContainer::Behavior behavior,
76  const IccProfile& specifiedProfile = IccProfile());
80  void transformToSRGB();
81 
85  static bool isSRGB(const DImg& img);
86 
90  void transformForOutput(const IccProfile& outputProfile);
91 
100  void transformForDisplay();
101  void transformForDisplay(QWidget* const widget);
102  void transformForDisplay(const IccProfile& displayProfile);
103 
104  static IccProfile displayProfile(QWidget* const displayingWidget = nullptr);
105  IccTransform displayTransform(QWidget* const displayingWidget = nullptr);
106  IccTransform displayTransform(const IccProfile& displayProfile);
107 
111  IccTransform displaySoftProofingTransform(const IccProfile& deviceProfile, QWidget* const displayingWidget = nullptr);
112  IccTransform displaySoftProofingTransform(const IccProfile& deviceProfile, const IccProfile& displayProfile);
113 
119  static bool needsPostLoadingManagement(const DImg& img);
120 
125  IccProfile imageProfile(ICCSettingsContainer::Behavior behavior,
126  const IccProfile& specifiedProfile = IccProfile());
127 
131  static void transformToSRGB(QImage& qimage, const IccProfile& inputProfile);
132 
136  static void transformForDisplay(QImage& qimage, const IccProfile& displayProfile1 = displayProfile());
137 
138 protected:
139 
140  void getTransform(IccTransform& trans, ICCSettingsContainer::Behavior behavior, const IccProfile& specifiedProfile);
141  void setIccProfile(const IccProfile& profile);
142  ICCSettingsContainer::Behavior safestBestBehavior() const;
143 
144 private:
145 
146  // Disable
147  IccManager(const IccManager&) = delete;
148  IccManager& operator=(const IccManager&) = delete;
149 
150 private:
151 
152  class Private;
153  Private* const d;
154 };
155 
156 } // namespace Digikam
157 
158 #endif // DIGIKAM_ICC_MANAGER_H
Definition: dimgloaderobserver.h:41
Definition: dimg.h:62
Definition: iccsettingscontainer.h:44
Definition: iccmanager.h:44
Definition: iccprofile.h:43
static IccSettings * instance()
Definition: iccsettings.cpp:40
Definition: icctransform.h:49
Definition: datefolderview.cpp:43