Subversion Repositories Scribus

Rev

Rev 1803 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1803 subik 1
/* $Id: colorwheelwidget.h 1804 2005-03-30 14:35:38Z subik $ */
1767 subik 2
#ifndef COLORWHEELWIDGET_H
3
#define COLORWHEELWIDGET_H
4
 
5
#include <qlabel.h>
6
#include <qvaluevector.h>
7
#include <cmykcolor.h>
1803 subik 8
#include <scribusstructs.h>
1767 subik 9
 
1804 subik 10
/**
11
\brief Widget ColorWheel graphicaly shows a color wheel for color theory.
12
 Class ColorWheel is new widget inherited from the QLabel.
13
 See e.g. http://en.wikipedia.org/wiki/Color_wheel for more info.
14
\author Petr Vanek; petr@yarpen.cz
15
\date April 2005
16
*/
1767 subik 17
class ColorWheel : public QLabel
18
{
19
        Q_OBJECT
20
 
21
        public:
22
                ColorWheel(QWidget * parent, const char * name = 0);
23
                ~ColorWheel();
24
 
1804 subik 25
                /** It can handle these color theory methods */
1767 subik 26
                enum MethodType {
27
                        Monochromatic,
28
                        Analogous,
29
                        Complementary,
30
                        Split,
31
                        Triadic,
32
                        Tetradic
33
                };
34
 
1804 subik 35
                /** \brief Difference between selected value and counted ones.
36
                Let's set angle = 15 and base point e.g. 60 (everything in grades).
37
                Now you will have Analogous angles 60 (base) and 75 (+15) and 45 (-15).
38
                Exact interpretation of the angle value depends on the MethodType value.
39
                */
1767 subik 40
                int angle;
41
 
1804 subik 42
                /** Coordinates of the leading point. */
1767 subik 43
                QPoint actualPoint;
1804 subik 44
 
45
                /** RGB interpretation of the leading point. */
1767 subik 46
                QRgb actualRgb;
1804 subik 47
 
48
                /** \brief List of the colors created in this widget.
49
                Colors can be added into Scribus color list later. */
1803 subik 50
                ColorList colorList;
1767 subik 51
 
1804 subik 52
                /** \brief Draw a color wheel.
53
                \param QValueVector<QPoint> points to be drawed.
54
                */
1767 subik 55
                void paintWheel(QValueVector<QPoint>);
1804 subik 56
 
57
                /** \brief Returns localized name of the type */
1767 subik 58
                QString getTypeDescription(MethodType aType);
1804 subik 59
 
60
                /** Draws a sample square filled with specified color. */
1767 subik 61
                QPixmap sample(QColor);
62
 
1804 subik 63
                /** \brief Counts the monochromatic colors.
64
                The monochromatic color scheme uses variations in lightness
65
                and saturation of a single color. It's clean and elegant color
66
                schema. I like it's minimalism ;) */
1767 subik 67
                void makeMonochromatic();
1804 subik 68
 
69
                /** \brief Counts the analogous colors.
70
                The analogous color scheme uses colors that are changed by an angle
71
                in the color wheel. It looks richer than mono scheme. */
1767 subik 72
                void makeAnalogous();
1804 subik 73
 
74
                /** \brief Counts the complementary colors.
75
                It takes two opposite colors (180 deg). It looks great when you choose a warm
76
                color against a cool one. E.g. dark green vs. wine red. Hmmm wine... */
1767 subik 77
                void makeComplementary();
1804 subik 78
 
79
                /** \brief Counts the split-complementary colors.
80
                It's enthanced complementary method. It takes base and opposite colors
81
                with applied angle differences. */
1767 subik 82
                void makeSplit();
1804 subik 83
 
84
                /** \brief Counts the triadic colors.
85
                It takes three colors balanced on the wheel (by 120 grades). */
1767 subik 86
                void makeTriadic();
1804 subik 87
 
88
                /** \brief Counts the tetradic colors.
89
                It's two times complementary. */
1767 subik 90
                void makeTetradic();
91
 
92
        signals:
1804 subik 93
                /** \brief Signal raised by mouse click on widget by user.
94
                \param int Mouse button number. See Qt docs.
95
                \param QPoint Coordinates of the mouse pointer. */
1767 subik 96
                void clicked(int, const QPoint &);
97
 
98
        protected:
1804 subik 99
                /** \brief An event for mouse actions handling.
100
                See \see clicked() for more info.
101
                \param QMouseEvent Mouse properties. */
1767 subik 102
                void mouseReleaseEvent(QMouseEvent *);
1804 subik 103
 
104
                /** Finds the color of the point in this widget
105
                \param QPoint Coordinates of the point.
106
                \return QRgb value with color of the point. */
1767 subik 107
                QRgb getPointColor(QPoint);
1804 subik 108
 
109
                /** \brief Appends a color into \see colorList.
110
                \param double an angle for transformation counting.
111
                              E.g. base angle is 30, param is 90 - transformation is 120.
112
                \param QString name of the color. */
1767 subik 113
                void sampleByAngle(double, QString);
1804 subik 114
 
115
                /** \brief Counts an angle of the point in color wheel
116
                \param QPoint coordinates of the point. */
1767 subik 117
                double pointAngle(QPoint);
1804 subik 118
 
119
                /** Appends the base color into color list. */
1767 subik 120
                void baseColor();
1804 subik 121
 
122
                /** Creates a Scribus CMYKColor from rgb value.
123
                \param QRgb a rgb value of the color. */
1803 subik 124
                CMYKColor cmykColor(QRgb rgb);
1767 subik 125
 
126
};
127
 
128
#endif