Scribus
Open source desktop publishing at your fingertips
colorblind.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef COLORBLIND_H
8 #define COLORBLIND_H
9 
10 #include <QVariant>
11 #include <QColor>
12 #include <QObject>
13 
42 #include "scribusapi.h"
43 
44 class SCRIBUS_API VisionDefectColor : public QObject, public QColor
45 {
46  Q_OBJECT
47 public:
49  enum defectMode {
50  normalVision = 0,
51  protanopeVision = 1,
52  deuteranopeVision = 2,
53  tritanopeVision = 3,
54  colorBlindnessVision = 4
55  };
56 
62  VisionDefectColor(int r, int g, int b);
66  VisionDefectColor(QColor c);
67 
71 
74 
78  void convertDefect();
79 
86  QColor convertDefect(QColor c, int d);
87 
91  uint getRed();
95  uint getGreen();
99  uint getBlue();
103  QColor getColor();
104 
105 private:
107  double rgb2lms[9];
109  double lms2rgb[9];
111  double gammaRGB[3];
112 
114  double a1, b1, c1;
116  double a2, b2, c2;
118  double inflection;
119 
121  double red, green, blue;
122 
124  QColor originalColor;
125 
146  void init();
147 
150  void setupDefect();
151 
159  double clamp(double x, double low, double high);
160 
161 };
162 
163 #endif
defectMode
Enumerate Vision Defects for readable ComboBox access.
Definition: colorblind.h:49
This code is an implementation of an algorithm described by Hans Brettel, Francoise Vienot and John M...
Definition: colorblind.h:44
int deficiency
Actual defect type. One of the 'defectMode'.
Definition: colorblind.h:73