Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickshapestrokenode_p.h
Go to the documentation of this file.
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 QQUICKSHAPESTROKENODE_P_H
5#define QQUICKSHAPESTROKENODE_P_H
6
7#include <QtQuick/qsgnode.h>
8
11
12//
13// W A R N I N G
14// -------------
15//
16// This file is not part of the Qt API. It exists for the convenience
17// of a number of Qt sources files. This header file may change from
18// version to version without notice, or even be removed.
19//
20// We mean it.
21//
22
24
26{
27public:
29
30 void setColor(QColor col)
31 {
32 m_color = col;
33 }
34
35 QColor color() const
36 {
37 return m_color;
38 }
39
41 {
42 m_strokeWidth = width;
43 }
44
45 float strokeWidth() const
46 {
47 return m_strokeWidth;
48 }
49
50 void appendTriangle(const QVector2D &v0, const QVector2D &v1, const QVector2D &v2, // triangle vertices
51 const QVector2D &p0, const QVector2D &p1, const QVector2D &p2); // curve points
52
53 void appendTriangle(const QVector2D &v0, const QVector2D &v1, const QVector2D &v2, // triangle vertices
54 const QVector2D &p0, const QVector2D &p1); // line points
55
56 void cookGeometry();
57
59
61 {
62 return m_uncookedIndexes;
63 }
64
65private:
66
67 struct StrokeVertex
68 {
69 float x, y;
70 float ax, ay;
71 float bx, by;
72 float cx, cy;
73 float H, G; //depressed cubic parameters
74 float offset; //mapping between depressed and happy cubic
75 };
76
77 void updateMaterial();
78
79 static QVector3D HGforPoint(QVector2D A, QVector2D B, QVector2D C, QVector2D p);
80 static std::array<QVector2D, 3> curveABC(QVector2D p0, QVector2D p1, QVector2D p2);
81
82 QColor m_color;
83 float m_strokeWidth = 0.0f;
84
85protected:
87
90};
91
93
94#endif // QQUICKSHAPESTROKENODE_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
Definition qlist.h:74
void appendTriangle(const QVector2D &v0, const QVector2D &v1, const QVector2D &v2, const QVector2D &p0, const QVector2D &p1, const QVector2D &p2)
QVector< quint32 > uncookedIndexes() const
QVector< StrokeVertex > m_uncookedVertexes
QScopedPointer< QQuickShapeStrokeMaterial > m_material
static const QSGGeometry::AttributeSet & attributes()
QVector< quint32 > m_uncookedIndexes
The QSGGeometryNode class is used for all rendered content in the scene graph.
Definition qsgnode.h:191
\inmodule QtCore
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
QPixmap p2
QPixmap p1
[0]
Combined button and popup list for selecting options.
n varying highp vec2 A
GLint GLfloat GLfloat GLfloat v2
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei width
GLint GLfloat v0
GLint GLfloat GLfloat v1
GLenum GLuint GLintptr offset
GLint y
GLfloat GLfloat p
[1]
GLbyte by
The QSGGeometry::AttributeSet describes how the vertices in a QSGGeometry are built up.
Definition qsggeometry.h:73