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 <QWidget>
19#include <QColor>
20#include <QPaintEvent>
21
22// KDE includes
23
24#include <KoColor.h>
25#include <KoColorSpace.h>
26
27#include <kritaui_export.h>
28
29class KRITAUI_EXPORT KisCIETongueWidget : public QWidget
30{
31 Q_OBJECT
32
33public:
34
35 KisCIETongueWidget(QWidget *parent = nullptr);
36 ~KisCIETongueWidget() override;
37
38 //this expects a qvector <double> (9), qvector <double> (3) and whether or not there's profile data?;
39 void setProfileData(QVector <double> p, QVector <double> w, bool profileData = false);
40 void setGamut(QPolygonF gamut);
41 void setRGBData(QVector <double> whitepoint, QVector <double> colorants);
42 void setCMYKData(QVector <double> whitepoint);
43 void setXYZData(QVector <double> whitepoint);
44 void setGrayData(QVector <double> whitepoint);
45 void setLABData(QVector <double> whitepoint);
46 void setYCbCrData(QVector <double> whitepoint);
47 void setProfileDataAvailable(bool dataAvailable);
48
52
53 enum model {RGBA, CMYKA, XYZA, LABA, GRAYA, YCbCrA};
54
55protected:
56
57 int grids(double val) const;
58
59 void outlineTongue();
60 void fillTongue();
61 void drawTongueAxis();
62 void drawTongueGrid();
63 void drawLabels();
64
65 QRgb colorByCoord(double x, double y);
66 void drawSmallEllipse(QPointF xy, int r, int g, int b, int sz);
67
68 void resizeEvent(QResizeEvent* event) override;
69 void paintEvent(QPaintEvent*) override;
70
71private:
72
73 void drawColorantTriangle();
74 void drawGamut();
75 void drawWhitePoint();
77 void updatePixmap();
78
79 void mapPoint(int& icx, int& icy, QPointF xy);
80 void biasedLine(int x1, int y1, int x2, int y2);
81 void biasedText(int x, int y, const QString& txt);
82
83private :
84
85 class Private;
86 Private* const d {nullptr};
87};
88
89#endif /* KISCIETONGUEWIDGET_H */
const Params2D p
unsigned int QRgb