Back to index

scribus-ng  1.3.4.dfsg+svn20071115
colorblind.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef COLORBLIND_H
00008 #define COLORBLIND_H
00009 
00010 #include <qvariant.h>
00011 #include <qcolor.h>
00012 #include <qobject.h>
00013 
00042 #include "scribusapi.h"
00043 
00044 class SCRIBUS_API VisionDefectColor : public QObject, public QColor
00045 {
00046        Q_OBJECT
00047 public:
00049        enum defectMode {
00050               normalVision = 0,
00051               protanopeVision = 1,
00052               deuteranopeVision = 2,
00053               tritanopeVision = 3,
00054               colorBlindnessVision = 4
00055        };
00056 
00062        VisionDefectColor(int r, int g, int b);
00066        VisionDefectColor(QColor c);
00067 
00070        VisionDefectColor();
00071 
00073        int deficiency;
00074 
00078        void convertDefect();
00079 
00086        QColor convertDefect(QColor c, int d);
00087 
00091        uint getRed();
00095        uint getGreen();
00099        uint getBlue();
00103        QColor getColor();
00104 
00105 private:
00107        double rgb2lms[9];
00109        double lms2rgb[9];
00111        double gammaRGB[3];
00112 
00114        double a1, b1, c1;
00116        double a2, b2, c2;
00118        double inflection;
00119 
00121        double red, green, blue;
00122 
00124        QColor originalColor;
00125 
00146        void init();
00147 
00150        void setupDefect();
00151 
00159        double clamp(double x, double low, double high);
00160 
00161 };
00162 
00163 #endif