Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • app
  • src
colorwheel.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2012-2020 Matthew Chiawen Chang
5
6This program is free software; you can redistribute it and/or
7modify it under the terms of the GNU General Public License
8as published by the Free Software Foundation; version 2 of the License.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15*/
16
17#ifndef COLORWHEEL_H
18#define COLORWHEEL_H
19
20#include <QWidget>
21
22
23class ColorWheel : public QWidget
24{
25 Q_OBJECT
26public:
27 explicit ColorWheel(QWidget* parent);
28
29 QColor color();
30
31signals:
32 void colorSelected(const QColor& color);
33 void colorChanged(const QColor& color);
34
35public slots:
36 void setColor(QColor color);
37
38protected:
39 void mousePressEvent(QMouseEvent*) override;
40 void mouseMoveEvent(QMouseEvent*) override;
41 void mouseReleaseEvent(QMouseEvent*) override;
42 void resizeEvent(QResizeEvent*) override;
43 void paintEvent(QPaintEvent*) override;
44
45private:
46 void hueChanged(const int& hue);
47 void saturationChanged(const int& sat);
48 void valueChanged(const int& value);
49
50 QColor pickColor(const QPoint& point);
51
52 void drawHueIndicator(const int& hue);
53 void drawPicker(const QColor& color);
54
55 void drawWheelImage(const QSize& newSize);
56 void drawSquareImage(const int& hue);
57 void composeWheel(QPixmap& pixmap);
58
59private:
60 QSize mInitSize{ 20, 20 };
61 QImage mWheelImage;
62 QImage mSquareImage;
63 QPixmap mWheelPixmap;
64
65 int mWheelThickness = 20;
66 QRect mWheelRect;
67 QRect mSquareRect;
68 QColor mCurrentColor = Qt::red;
69 bool mIsInWheel = false;
70 bool mIsInSquare = false;
71
72};
73
74#endif // COLORWHEEL_H
ColorWheel
Definition: colorwheel.h:24
QColor
QImage
QMouseEvent
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::parent
QObject * parent() const const
QPaintEvent
QPixmap
QPoint
QRect
QResizeEvent
QSize
Qt::red
red
QWidget
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39