aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcurveprocessor_p.h
blob: cdd93bc58ee716afbbdcd5fd04184f4d8c4a5b60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QSGCURVEPROCESSOR_P_H
#define QSGCURVEPROCESSOR_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtQuick/qtquickexports.h>
#include "util/qquadpath_p.h"

QT_BEGIN_NAMESPACE

class Q_QUICK_EXPORT QSGCurveProcessor
{
public:
    typedef std::function<QVector3D(QVector2D)> uvForPointCallback;
    typedef std::function<void(const std::array<QVector2D, 3> &,
                               const std::array<QVector2D, 3> &,
                               uvForPointCallback)> addTriangleCallback;
    typedef std::function<void(const std::array<QVector2D, 3> &,
                               const std::array<QVector2D, 3> &,
                               const std::array<QVector2D, 3> &,
                               bool)> addStrokeTriangleCallback;

    static void processFill(const QQuadPath &path,
                            Qt::FillRule fillRule,
                            addTriangleCallback addTriangle);
    static void processStroke(const QQuadPath &strokePath,
                              float miterLimit,
                              float penWidth,
                              Qt::PenJoinStyle joinStyle,
                              Qt::PenCapStyle capStyle,
                              addStrokeTriangleCallback addTriangle,
                              int subdivisions = 3);
    static bool solveOverlaps(QQuadPath &path);
    static QList<QPair<int, int>> findOverlappingCandidates(const QQuadPath &path);
    static bool removeNestedSubpaths(QQuadPath &path);
    static bool solveIntersections(QQuadPath &path, bool removeNestedPaths = true);
};

QT_END_NAMESPACE

#endif // QSGCURVEPROCESSOR_P_H