Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_cie_tongue_widget.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * Based on the Digikam CIE Tongue widget
5 * SPDX-FileCopyrightText: 2006-2013 Gilles Caulier <caulier dot gilles at gmail dot com>
6 *
7 * Any source code are inspired from lprof project and
8 * SPDX-FileCopyrightText: 1998-2001 Marti Maria
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 **/
12
13#ifndef KIS_CIETONGUEWIDGET_H
14#define KIS_CIETONGUEWIDGET_H
15
16// Qt includes
17
18#include "KoColorimetryUtils.h"
19#include <QWidget>
20#include <QColor>
21#include <QPaintEvent>
22
23// KDE includes
24
25#include <KoColor.h>
26#include <KoColorSpace.h>
27
28#include <kritaui_export.h>
29
30class KRITAUI_EXPORT KisCIETongueWidget : public QWidget
31{
32 Q_OBJECT
33
34public:
35
36 KisCIETongueWidget(QWidget *parent = nullptr);
37 ~KisCIETongueWidget() override;
38
39 //this expects a qvector <double> (9), qvector <double> (3) and whether or not there's profile data?;
40 void setProfileData(QVector<KoColorimetryUtils::xyY> p, KoColorimetryUtils::xyY w, bool profileData = false);
41 void setGamut(QPolygonF gamut);
42 void setRGBData(KoColorimetryUtils::xyY whitepoint, QVector<KoColorimetryUtils::xyY> colorants);
43 void setCMYKData(KoColorimetryUtils::xyY whitepoint);
44 void setXYZData(KoColorimetryUtils::xyY whitepoint);
45 void setGrayData(KoColorimetryUtils::xyY whitepoint);
46 void setLABData(KoColorimetryUtils::xyY whitepoint);
47 void setYCbCrData(KoColorimetryUtils::xyY whitepoint);
48 void setProfileDataAvailable(bool dataAvailable);
49
53
54 enum model {RGBA, CMYKA, XYZA, LABA, GRAYA, YCbCrA};
55
56protected:
57
58 int grids(double val) const;
59
60 void outlineTongue();
61 void fillTongue();
62 void drawTongueAxis();
63 void drawTongueGrid();
64 void drawLabels();
65
66 QRgb colorByCoord(double x, double y);
67 void drawSmallEllipse(QPointF xy, int r, int g, int b, int sz);
68
69 void resizeEvent(QResizeEvent* event) override;
70 void paintEvent(QPaintEvent*) override;
71
72private:
73
74 void drawColorantTriangle();
75 void drawGamut();
76 void drawWhitePoint();
78 void updatePixmap();
79
80 void mapPoint(int& icx, int& icy, QPointF xy);
81 void biasedLine(int x1, int y1, int x2, int y2);
82 void biasedText(int x, int y, const QString& txt);
83
84private :
85
86 class Private;
87 Private* const d {nullptr};
88};
89
90#endif /* KISCIETONGUEWIDGET_H */
const Params2D p
unsigned int QRgb