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 <QtQuick/private/qquadpath_p.h>
20#include "qsgcurvestrokenode_p.h"
21
22#include <QtCore/qloggingcategory.h>
23
24QT_BEGIN_NAMESPACE
25
26Q_DECLARE_LOGGING_CATEGORY(lcSGCurveProcessor);
27
28class Q_QUICK_EXPORT QSGCurveProcessor
29{
30public:
31 typedef std::function<QVector3D(QVector2D)> uvForPointCallback;
32 typedef std::function<void(const std::array<QVector2D, 3> &,
33 const std::array<QVector2D, 3> &,
34 uvForPointCallback)> addTriangleCallback;
35 typedef std::function<void(const std::array<QVector2D, 3> &,
36 const std::array<QVector2D, 3> &,
37 const std::array<QVector2D, 3> &,
38 QSGCurveStrokeNode::TriangleFlags)> addStrokeTriangleCallback;
39
40 static void processFill(const QQuadPath &path,
41 Qt::FillRule fillRule,
42 addTriangleCallback addTriangle);
43 static void processStroke(const QQuadPath &strokePath,
44 float miterLimit,
45 float penWidth,
46 Qt::PenJoinStyle joinStyle,
47 Qt::PenCapStyle capStyle,
48 addStrokeTriangleCallback addTriangle,
49 int subdivisions = 3);
50 static bool solveOverlaps(QQuadPath &path);
51 static QList<std::pair<int, int>> findOverlappingCandidates(const QQuadPath &path);
52 static bool removeNestedSubpaths(QQuadPath &path);
53 static bool solveIntersections(QQuadPath &path, bool removeNestedPaths = true);
54};
55
56QT_END_NAMESPACE
57
58#endif // QSGCURVEPROCESSOR_P_H
59

source code of qtdeclarative/src/quick/scenegraph/qsgcurveprocessor_p.h