File indexing completed on 2024-05-12 16:02:02

0001 /*
0002  *  SPDX-FileCopyrightText: 2022 Sam Linnfer <littlelightlittlefire@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 #ifndef _KIS_HSV_COLOR_SLIDER_H_
0007 #define _KIS_HSV_COLOR_SLIDER_H_
0008 
0009 #include <kselector.h>
0010 #include "kritawidgets_export.h"
0011 #include "KoColorDisplayRendererInterface.h"
0012 
0013 class KoColor;
0014 
0015 // Same as the KoColorSlider, except mixing is done with HSV values.
0016 class KRITAWIDGETS_EXPORT KisHsvColorSlider : public KSelector
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     enum class MIX_MODE {
0022         COLOR_SPACE, HSV, HSL, HSI, HSY,
0023     };
0024 
0025     explicit KisHsvColorSlider(QWidget *parent = 0, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
0026     explicit KisHsvColorSlider(Qt::Orientation orientation, QWidget *parent = 0, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
0027     ~KisHsvColorSlider() override;
0028 
0029     void setColors(const KoColor minColor, const KoColor maxColor);
0030     void setColors(const QColor minColor, const QColor maxColor);
0031     void setColors(qreal minH, qreal minS, qreal minV, qreal maxH, qreal maxS, qreal maxV);
0032 
0033     void setMixMode(MIX_MODE mode);
0034 
0035     void setCircularHue(bool);
0036 
0037 protected:
0038     void drawContents(QPainter*) override;
0039     void drawArrow(QPainter *painter, const QPoint &pos) override;
0040 
0041     QPoint calcArrowPos(int value);
0042 
0043     struct Private;
0044     Private* const d;
0045 };
0046 
0047 #endif