| 1 | /* This file is part of the KDE project |
| 2 | SPDX-FileCopyrightText: 2007 Matthew Woehlke <[email protected]> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * If you use KColorSpaces in your own KDE code, please drop me a line at |
| 9 | * [email protected], as I would like to track if people find it |
| 10 | * useful. Thanks! |
| 11 | */ |
| 12 | |
| 13 | #ifndef KCOLORSPACES_H |
| 14 | #define KCOLORSPACES_H |
| 15 | |
| 16 | #include <QColor> |
| 17 | |
| 18 | namespace KColorSpaces |
| 19 | { |
| 20 | class KHCY |
| 21 | { |
| 22 | public: |
| 23 | explicit KHCY(const QColor &); |
| 24 | explicit KHCY(qreal h_, qreal c_, qreal y_, qreal a_ = 1.0); |
| 25 | QColor qColor() const; |
| 26 | qreal h, c, y, a; |
| 27 | static qreal hue(const QColor &); |
| 28 | static qreal chroma(const QColor &); |
| 29 | static qreal luma(const QColor &); |
| 30 | |
| 31 | private: |
| 32 | static qreal gamma(qreal); |
| 33 | static qreal igamma(qreal); |
| 34 | static qreal lumag(qreal, qreal, qreal); |
| 35 | }; |
| 36 | |
| 37 | } |
| 38 | |
| 39 | #endif |
| 40 | |