Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtriangulator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QTRIANGULATOR_P_H
5#define QTRIANGULATOR_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 <QtGui/private/qtguiglobal_p.h>
19#include <QtGui/private/qvectorpath_p.h>
20#include <QtCore/qlist.h>
21
23
25{
26public:
31
32 inline Type type() const { return t; }
33
34 inline void setDataUint(const QList<quint32> &data)
35 {
36 t = UnsignedInt;
37 indices32 = data;
38 }
39
40 inline void setDataUshort(const QList<quint16> &data)
41 {
43 indices16 = data;
44 }
45
46 inline const void* data() const
47 {
48 if (t == UnsignedInt)
49 return indices32.data();
50 return indices16.data();
51 }
52
53 inline int size() const
54 {
55 if (t == UnsignedInt)
56 return indices32.size();
57 return indices16.size();
58 }
59
60private:
61
62 Type t;
63 QList<quint32> indices32;
64 QList<quint16> indices16;
65};
66
68{
69 // The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ...
70 QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
71 QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...]
72};
73
75{
76 QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
77 QVertexIndexVector indices; // End of polyline is marked with -1.
78};
79
80// The vertex coordinates of the returned triangle set will be rounded to a grid with a mesh size
81// of 1/32. The polygon is first transformed, then scaled by 32, the coordinates are rounded to
82// integers, the polygon is triangulated, and then scaled back by 1/32.
83// 'hint' should be a combination of QVectorPath::Hints.
84// 'lod' is the level of detail. Default is 1. Curves are split into more lines when 'lod' is higher.
85QTriangleSet Q_GUI_EXPORT qTriangulate(const qreal *polygon, int count,
87 const QTransform &matrix = QTransform(),
88 bool allowUintIndices = true);
90 qreal lod = 1, bool allowUintIndices = true);
92 qreal lod = 1, bool allowUintIndices = true);
94 qreal lod = 1, bool allowUintIndices = true);
95QPolylineSet Q_GUI_EXPORT qPolyline(const QPainterPath &path, const QTransform &matrix = QTransform(),
96 qreal lod = 1, bool allowUintIndices = true);
97
99
100#endif
qsizetype size() const noexcept
Definition qlist.h:397
pointer data()
Definition qlist.h:431
\inmodule QtGui
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
void setDataUshort(const QList< quint16 > &data)
void setDataUint(const QList< quint32 > &data)
const void * data() const
Combined button and popup list for selecting options.
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint lod
GLuint GLenum matrix
GLdouble GLdouble t
Definition qopenglext.h:243
GLsizei const GLchar *const * path
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix=QTransform(), qreal lod=1, bool allowUintIndices=true)
QTriangleSet Q_GUI_EXPORT qTriangulate(const qreal *polygon, int count, uint hint=QVectorPath::PolygonHint|QVectorPath::OddEvenFill, const QTransform &matrix=QTransform(), bool allowUintIndices=true)
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
QList< qreal > vertices
QVertexIndexVector indices
QList< qreal > vertices
QVertexIndexVector indices
Definition moc.h:23