]> git.sesse.net Git - kdenlive/blob - src/kis_cubic_curve.h
Fix label
[kdenlive] / src / kis_cubic_curve.h
1 /*
2  *  Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef _KIS_CUBIC_CURVE_H_
20 #define _KIS_CUBIC_CURVE_H_
21
22 #include<QList>
23 #include<QVector>
24 #include<QVariant>
25
26 class QPointF;
27
28 /**
29  * Hold the data for a cubic curve.
30  */
31 class KisCubicCurve
32 {
33 public:
34     KisCubicCurve();
35     KisCubicCurve(const QList<QPointF>& points);
36     KisCubicCurve(const QVector<QPointF>& points);
37     KisCubicCurve(const KisCubicCurve& curve);
38     ~KisCubicCurve();
39     KisCubicCurve& operator=(const KisCubicCurve& curve);
40     bool operator==(const KisCubicCurve& curve) const;
41 public:
42     qreal value(qreal x) const;
43     QList<QPointF> points() const;
44     void setPoints(const QList<QPointF>& points);
45     void setPoint(int idx, const QPointF& point);
46     /**
47      * Add a point to the curve, the list of point is always sorted.
48      * @return the index of the inserted point
49      */
50     int addPoint(const QPointF& point);
51     void removePoint(int idx);
52 public:
53     QVector<quint16> uint16Transfer(int size = 256) const;
54     QVector<qreal> floatTransfer(int size = 256) const;
55 public:
56     QString toString() const;
57     void fromString(const QString&);
58 private:
59     struct Data;
60     struct Private;
61     Private* const d;
62 };
63
64 Q_DECLARE_METATYPE(KisCubicCurve);
65
66 #endif