File indexing completed on 2025-03-09 05:12:53

0001 /* 
0002  * Copyright (C) 2015 by Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
0003  *
0004  * Based on the Digikam CIE Tongue widget
0005  * Copyright (C) 2006-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
0006  *
0007  * Any source code are inspired from lprof project and
0008  * Copyright (C) 1998-2001 Marti Maria
0009  *
0010  * This program is free software; you can redistribute it
0011  * and/or modify it under the terms of the GNU General
0012  * Public License as published by the Free Software Foundation;
0013  * either version 2, or (at your option)
0014  * any later version.
0015  *
0016  * This program is distributed in the hope that it will be useful,
0017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0019  * GNU General Public License for more details.
0020  *
0021  * You should have received a copy of the GNU General Public License
0022  * along with this program; if not, write to the Free Software
0023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0024  **/
0025 
0026 #ifndef KIS_TONECURVEWIDGET_H
0027 #define KIS_TONECURVEWIDGET_H
0028  
0029 #include <QWidget>
0030 #include <QColor>
0031 #include <QPaintEvent>
0032 
0033 #include <kritaui_export.h>
0034  
0035 class KRITAUI_EXPORT KisToneCurveWidget : public QWidget
0036 {
0037     Q_OBJECT
0038  
0039 public:
0040  
0041     KisToneCurveWidget(QWidget *parent=0);
0042     ~KisToneCurveWidget() override;
0043 
0044     void setGreyscaleCurve(QPolygonF poly);
0045     void setRGBCurve(QPolygonF red, QPolygonF green, QPolygonF blue);
0046     void setCMYKCurve(QPolygonF cyan, QPolygonF magenta, QPolygonF yellow, QPolygonF key);
0047     void setProfileDataAvailable(bool dataAvailable);
0048 protected:
0049  
0050     int  grids(double val) const;
0051     void drawGrid();
0052     void resizeEvent(QResizeEvent* event) override;
0053     void paintEvent(QPaintEvent*) override;
0054  
0055 private:
0056  
0057     void updatePixmap();
0058     void mapPoint(QPointF & xy);
0059     void biasedLine(int x1, int y1, int x2, int y2);
0060     void biasedText(int x, int y, const QString& txt);
0061 private :
0062  
0063     class Private;
0064     Private* const d;
0065 };
0066 
0067 #endif /* KISTONECURVEWIDGET_H */