digiKam
cietonguewidget.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-10
7  * Description : a widget to display CIE tongue from an ICC profile.
8  *
9  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_CIE_TONGUE_WIDGET_H
25 #define DIGIKAM_CIE_TONGUE_WIDGET_H
26 
27 // Qt includes
28 
29 #include <QWidget>
30 #include <QColor>
31 #include <QPaintEvent>
32 #include <QUrl>
33 
34 // Local includes
35 
36 #include "digikam-lcms.h"
37 #include "digikam_export.h"
38 
39 namespace Digikam
40 {
41 
42 class DIGIKAM_EXPORT CIETongueWidget : public QWidget
43 {
44  Q_OBJECT
45 
46 public:
47 
48  explicit CIETongueWidget(int w, int h,
49  QWidget* const parent = nullptr,
50  cmsHPROFILE hMonitor = nullptr);
51  ~CIETongueWidget() override;
52 
53  bool setProfileData(const QByteArray& profileData = QByteArray());
54  bool setProfileFromFile(const QUrl& file = QUrl());
55 
56  void loadingStarted();
57  void loadingFailed();
58  void uncalibratedColor();
59 
60 protected:
61 
62  int grids(double val) const;
63 
64  void outlineTongue();
65  void fillTongue();
66  void drawTongueAxis();
67  void drawTongueGrid();
68  void drawLabels();
69 
70  QRgb colorByCoord(double x, double y);
71  void drawSmallElipse(LPcmsCIExyY xyY, BYTE r, BYTE g, BYTE b, int sz);
72 
73  void resizeEvent(QResizeEvent* event) override;
74  void paintEvent(QPaintEvent*) override;
75 
76 private:
77 
78  void drawColorantTriangle();
79  void drawWhitePoint();
80  void drawPatches();
81  void updatePixmap();
82 
83  void mapPoint(int& icx, int& icy, LPcmsCIExyY xyY);
84  void biasedLine(int x1, int y1, int x2, int y2);
85  void biasedText(int x, int y, const QString& txt);
86 
87  void setProfile(cmsHPROFILE hProfile);
88 
89 private Q_SLOTS:
90 
91  void slotProgressTimerDone();
92 
93 private:
94 
95  class Private;
96  Private* const d;
97 };
98 
99 } // namespace Digikam
100 
101 #endif // DIGIKAM_CIE_TONGUE_WIDGET_H
Definition: cietonguewidget.h:43
unsigned char BYTE
Definition: digikam-lcms.h:71
void * cmsHPROFILE
Opaque typedefs to hide internals.
Definition: digikam-lcms.h:81
cmsCIExyY FAR * LPcmsCIExyY
Definition: digikam-lcms.h:78
Definition: datefolderview.cpp:43