mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
41 lines
904 B
C++
41 lines
904 B
C++
#ifndef PALETTE_H
|
|
#define PALETTE_H
|
|
|
|
#include <QColor>
|
|
#include <QDebug>
|
|
|
|
class Palette
|
|
{
|
|
public:
|
|
Palette(const QColor &color = Qt::blue, qreal shift = 0.62);
|
|
|
|
QColor color() const {return QColor::fromHsvF(_h, _s, _v, _a).toRgb();}
|
|
qreal shift() const {return _shift;}
|
|
void setColor(const QColor &color);
|
|
void setShift(qreal shift);
|
|
|
|
QColor nextColor();
|
|
void reset();
|
|
|
|
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);}
|
|
|
|
private:
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
qreal _h, _s, _v, _a, _shift;
|
|
qreal _state;
|
|
#else // QT6
|
|
float _h, _s, _v, _a, _shift;
|
|
float _state;
|
|
#endif // QT6
|
|
};
|
|
|
|
#ifndef QT_NO_DEBUG
|
|
QDebug operator<<(QDebug dbg, const Palette &palette);
|
|
#endif // QT_NO_DEBUG
|
|
|
|
#endif // PALLETE_H
|