123456789101112131415161718192021222324252627282930313233 |
- #ifndef COLORTOOLS_H
- #define COLORTOOLS_H
- #include <QColor>
- #include <QDeclarativeItem>
- class ColorTools : public QDeclarativeItem {
- Q_OBJECT
- public:
- Q_INVOKABLE qreal hue(QColor color) {
- return color.hueF();
- }
- Q_INVOKABLE qreal saturation(QColor color) {
- return color.saturationF();
- }
- Q_INVOKABLE qreal lightness(QColor color) {
- return color.lightnessF();
- }
- Q_INVOKABLE qreal hue(qreal r, qreal g, qreal b) {
- qDebug() << "r: " << r << " g " << g << " b " << b;
- return QColor(r * 255, g * 255, b * 255).hueF();
- }
- };
- #endif // COLORTOOLS_H
|