| 1 | // Copyright (C) 2023 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QSGCURVEPROCESSOR_P_H |
| 5 | #define QSGCURVEPROCESSOR_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtQuick/qtquickexports.h> |
| 19 | #include "util/qquadpath_p.h" |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class Q_QUICK_EXPORT QSGCurveProcessor |
| 24 | { |
| 25 | public: |
| 26 | typedef std::function<QVector3D(QVector2D)> uvForPointCallback; |
| 27 | typedef std::function<void(const std::array<QVector2D, 3> &, |
| 28 | const std::array<QVector2D, 3> &, |
| 29 | uvForPointCallback)> addTriangleCallback; |
| 30 | typedef std::function<void(const std::array<QVector2D, 3> &, |
| 31 | const std::array<QVector2D, 3> &, |
| 32 | const std::array<QVector2D, 3> &, |
| 33 | bool)> addStrokeTriangleCallback; |
| 34 | |
| 35 | static void processFill(const QQuadPath &path, |
| 36 | Qt::FillRule fillRule, |
| 37 | addTriangleCallback addTriangle); |
| 38 | static void processStroke(const QQuadPath &strokePath, |
| 39 | float miterLimit, |
| 40 | float penWidth, |
| 41 | Qt::PenJoinStyle joinStyle, |
| 42 | Qt::PenCapStyle capStyle, |
| 43 | addStrokeTriangleCallback addTriangle, |
| 44 | int subdivisions = 3); |
| 45 | static bool solveOverlaps(QQuadPath &path); |
| 46 | static QList<QPair<int, int>> findOverlappingCandidates(const QQuadPath &path); |
| 47 | static bool removeNestedSubpaths(QQuadPath &path); |
| 48 | static bool solveIntersections(QQuadPath &path, bool removeNestedPaths = true); |
| 49 | }; |
| 50 | |
| 51 | QT_END_NAMESPACE |
| 52 | |
| 53 | #endif // QSGCURVEPROCESSOR_P_H |
| 54 | |