1 /***************************************************************************
2 * Copyright (C) 2011 by Till Theato (root@ttill.de) *
3 * This file is part of Kdenlive (www.kdenlive.org). *
5 * Kdenlive is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Kdenlive is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Kdenlive. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
25 * @brief Represents a point in a cubic Bézier spline.
31 /** @brief Sets the point to -1, -1 to mark it as unusable (until point + handles have proper values) */
33 /** @brief Sets up according to the params. Linking detecting is done using autoSetLinked(). */
34 BPoint(QPointF handle1, QPointF point, QPointF handle2);
36 /** @brief Returns h1 if i = 0, p if i = 1, h2 if i = 2. */
37 QPointF &operator[](int i);
38 /** @brief Returns h1 if i = 0, p if i = 1, h2 if i = 2. */
39 const QPointF &operator[](int i) const;
40 bool operator==(const BPoint &point) const;
42 /** @brief Sets p to @param point.
43 * @param updateHandles (default = true) Whether to make sure the handles keep their position relative to p. */
44 void setP(QPointF point, bool updateHandles = true);
46 /** @brief Sets h1 to @param handle1.
48 * If handlesLinked is true h2 is updated. */
49 void setH1(QPointF handle1);
51 /** @brief Sets h2 to @param handle2.
53 * If handlesLinked is true h1 is updated. */
54 void setH2(QPointF handle2);
55 void keepInRange(qreal xMin, qreal xMax);
57 /** @brief Sets handlesLinked to true if the handles are in a linked state (line through h1, p, h2) otherwise to false. */
67 /** handles are linked to achieve a natural locking spline => PH1 = -r*PH2 ; a line can be drawn through h1, p, h2 */