Scribus
Open source desktop publishing at your fingertips
colorwheelwidget.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 
8 #ifndef COLORWHEELWIDGET_H
9 #define COLORWHEELWIDGET_H
10 
11 #include <QLabel>
12 
13 #include "scribusstructs.h"
14 #include "sccolor.h"
15 
16 class ScribusDoc;
17 
19 typedef QMap<int,ScColor> ColorMap;
20 
28 class ColorWheel : public QLabel
29 {
30  Q_OBJECT
31 
32  public:
33  ColorWheel(QWidget * parent, const char * name = 0);
34  ~ColorWheel(){};
35 
37  enum MethodType {
38  Monochromatic,
39  Analogous,
40  Complementary,
41  Split,
42  Triadic,
43  Tetradic
44  };
45 
46  ScribusDoc* currentDoc;
47 
49  QString trBaseColor;
50 
52  colorModel currentColorSpace;
53 
56 
62  int angle;
63 
65  int baseAngle;
66 
69 
73 
77  QString getTypeDescription(MethodType aType);
78 
84  ScColor colorByAngle(int angle);
85 
87  void makeColors();
88 
93  bool recomputeColor(ScColor col);
94 
95  signals:
99  void clicked(int button, const QPoint & point);
100 
101  protected:
105  ColorMap colorMap;
106 
111 
114  int widthH;
115  int heightH;
116 
120  void mouseReleaseEvent(QMouseEvent *e);
124  void mousePressEvent(QMouseEvent *e);
128  void mouseMoveEvent(QMouseEvent *e);
131  void paintEvent(QPaintEvent *);
132 
137  void makeMonochromatic();
138 
142  void makeAnalogous();
143 
147  void makeComplementary();
148 
152  void makeSplit();
153 
156  void makeTriadic();
157 
160  void makeTetradic();
161 
163  void paintCenterSample();
165  void paintWheel();
166 
172  ScColor sampleByAngle(int angle);
173 
175  void baseColor();
176 
182 
190  void drawBorderPoint(int angle, bool base=false, bool clear=false);
191 
194 // void clearBorder();
195 
200  int valueFromPoint(const QPoint & p) const;
201 
202  typedef struct
203  {
204  int angle;
205  bool base;
206  } PaintPoint;
207  QList<PaintPoint> pointList;
208 };
209 
210 #endif
211 
void paintWheel()
Draw a color wheel.
Definition: colorwheelwidget.cpp:105
Definition: sccolor.h:51
void baseColor()
Appends the base color into color list.
Definition: colorwheelwidget.cpp:185
void makeTriadic()
Counts the triadic colors. It takes three colors balanced on the wheel (by 120 grades).
Definition: colorwheelwidget.cpp:238
void mouseReleaseEvent(QMouseEvent *e)
An event for mouse actions handling. See.
Definition: colorwheelwidget.cpp:57
ColorMap colorMap
Internal color mapping. It provides angle-color dictionary.
Definition: colorwheelwidget.h:105
void makeSplit()
Counts the split-complementary colors. It's enthanced complementary method. It takes base and opposit...
Definition: colorwheelwidget.cpp:228
ScColor colorByAngle(int angle)
Get sample color from specifid angle.
Definition: colorwheelwidget.cpp:149
Definition: colorwheelwidget.h:202
void clicked(int button, const QPoint &point)
Signal raised by mouse click on widget by user.
int widthH
Half of the widget sizes. To prevent all width()/2 divisions.
Definition: colorwheelwidget.h:114
void makeComplementary()
Counts the complementary colors. It takes two opposite colors (180 deg). It looks great when you choo...
Definition: colorwheelwidget.cpp:221
int valueFromPoint(const QPoint &p) const
Clear border marks before redrawing. It redraws only small piece of the bitmap.
Definition: colorwheelwidget.cpp:288
QString getTypeDescription(MethodType aType)
Returns localized name of the type.
Definition: colorwheelwidget.cpp:135
Definition: sccolor.h:155
int baseAngle
Angle of the base color.
Definition: colorwheelwidget.h:65
void drawBorderPoint(int angle, bool base=false, bool clear=false)
Display user selection - selected colors. Chosen colors are marked via bullets on the border of the w...
Definition: colorwheelwidget.cpp:261
int angleShift
Angle diff between colorMap and painted wheel itself. QTransform wheel and colorMap have different st...
Definition: colorwheelwidget.h:110
QString trBaseColor
name of the "base color" to handle in extern color lists
Definition: colorwheelwidget.h:49
the Document Class
Definition: scribusdoc.h:90
void paintCenterSample()
Draw center circle filled with base color.
Definition: colorwheelwidget.cpp:95
void mousePressEvent(QMouseEvent *e)
Mouse handling. It calls mouseReleaseEvent.
Definition: colorwheelwidget.cpp:47
void makeColors()
Call one of makeFoo() methods depending on the currentType value.
Definition: colorwheelwidget.cpp:79
ScColor actualColor
RGB interpretation of the leading point in the wheel.
Definition: colorwheelwidget.h:68
ScColor colorSpaceColor(ScColor col)
Creates a Scribus ScColor from rgb value. Its result depends on the currentColorSpace value...
Definition: colorwheelwidget.cpp:172
ColorList colorList
List of the colors created in this widget. Colors can be added into Scribus color list later...
Definition: colorwheelwidget.h:72
bool recomputeColor(ScColor col)
Setup the values by given QColor. It sets all options by given color (from input color dialogs)...
Definition: colorwheelwidget.cpp:306
int angle
Difference between selected value and counted ones. Let's set angle = 15 and base point e...
Definition: colorwheelwidget.h:62
void makeAnalogous()
Counts the analogous colors. The analogous color scheme uses colors that are changed by an angle in t...
Definition: colorwheelwidget.cpp:213
void makeTetradic()
Counts the tetradic colors. It's two times complementary.
Definition: colorwheelwidget.cpp:246
MethodType currentType
Actual type of color computing. See MethodType.
Definition: colorwheelwidget.h:55
void mouseMoveEvent(QMouseEvent *e)
Mouse handling. It calls mouseReleaseEvent.
Definition: colorwheelwidget.cpp:52
MethodType
It can handle these color theory methods.
Definition: colorwheelwidget.h:37
colorModel currentColorSpace
Which color model is in use.
Definition: colorwheelwidget.h:52
void makeMonochromatic()
Counts the monochromatic colors. The monochromatic color scheme uses variations in lightness and satu...
Definition: colorwheelwidget.cpp:199
ScColor sampleByAngle(int angle)
Appends a color into.
Definition: colorwheelwidget.cpp:158
Widget ColorWheel graphically shows a color wheel for color theory. Class ColorWheel is new widget in...
Definition: colorwheelwidget.h:28
void paintEvent(QPaintEvent *)
Repaint the widget. It prevents the bugs with another window moving over it.
Definition: colorwheelwidget.cpp:66