2016-02-28 09:32:54 +01:00
|
|
|
#ifndef PALETTE_H
|
|
|
|
#define PALETTE_H
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
#include <QColor>
|
2016-12-06 21:02:44 +01:00
|
|
|
#include <QDebug>
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2016-02-28 09:32:54 +01:00
|
|
|
class Palette
|
2015-10-05 01:43:48 +02:00
|
|
|
{
|
|
|
|
public:
|
2016-12-06 01:48:26 +01:00
|
|
|
Palette(const QColor &color = Qt::blue, qreal shift = 0.62);
|
|
|
|
|
2016-12-06 21:02:44 +01:00
|
|
|
QColor color() const {return QColor::fromHsvF(_h, _s, _v, _a).toRgb();}
|
2016-12-06 01:48:26 +01:00
|
|
|
qreal shift() const {return _shift;}
|
|
|
|
void setColor(const QColor &color);
|
|
|
|
void setShift(qreal shift);
|
|
|
|
|
|
|
|
QColor nextColor();
|
2015-10-05 01:43:48 +02:00
|
|
|
void reset();
|
|
|
|
|
2016-12-06 01:48:26 +01:00
|
|
|
bool operator==(const Palette &other) const
|
|
|
|
{return (_h == other._h && _s == other._s && _v == other._v
|
|
|
|
&& _a == other._a && _shift == other._shift);}
|
|
|
|
bool operator!=(const Palette &other) const
|
|
|
|
{return !(*this == other);}
|
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
private:
|
2016-12-06 01:48:26 +01:00
|
|
|
qreal _h, _s, _v, _a, _shift;
|
|
|
|
qreal _state;
|
2015-10-05 01:43:48 +02:00
|
|
|
};
|
|
|
|
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2016-12-06 21:02:44 +01:00
|
|
|
QDebug operator<<(QDebug dbg, const Palette &palette);
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2016-12-06 21:02:44 +01:00
|
|
|
|
2016-02-28 09:32:54 +01:00
|
|
|
#endif // PALLETE_H
|