4#ifndef QQUICKSHAPECURVERENDERER_P_H
5#define QQUICKSHAPECURVERENDERER_P_H
18#include <QtQuickShapes/private/qquickshapesglobal_p.h>
19#include <QtQuickShapes/private/qquickshape_p_p.h>
25#include <QtCore/qrunnable.h>
27#include <QtGui/private/qtriangulator_p.h>
36 subPathToStart =
true;
42 addElement({}, to,
true);
47 addElement(control, to);
57 bool isEmpty()
const {
return m_elements.size() == 0; }
76 return m_isSubpathStart;
81 return m_isSubpathEnd;
91 return m_curvatureFlags & Convex;
111 return isLine() ? 0.5f * (sp + ep) : (0.25f * sp) + (0.5f * cp) + (0.25 * ep);
116 std::array<QVector2D, 3>
ABC()
const;
125 return -(m_firstChildIndex + 1 + childNumber);
132 return isLine() ? (ep - sp) : ((1 -
t) * 2 * (cp - sp)) + (
t * 2 * (ep - cp));
146 m_curvatureFlags = Element::CurvatureFlags(m_curvatureFlags | Element::Convex);
148 m_curvatureFlags = Element::CurvatureFlags(m_curvatureFlags & ~Element::Convex);
153 int intersectionsAtY(
float y,
float *fractions)
const;
155 enum CurvatureFlags :
quint8 {
156 CurvatureUndetermined = 0,
164 int m_firstChildIndex = 0;
166 CurvatureFlags m_curvatureFlags = CurvatureUndetermined;
167 quint8 m_isSubpathStart : 1;
168 quint8 m_isSubpathEnd : 1;
174 template<
typename Func>
177 const qsizetype lastChildIndex =
e.m_firstChildIndex +
e.childCount() - 1;
178 for (
qsizetype i =
e.m_firstChildIndex;
i <= lastChildIndex;
i++) {
180 if (
c.childCount() > 0)
187 template<
typename Func>
190 const qsizetype lastChildIndex =
e.m_firstChildIndex +
e.childCount() - 1;
191 for (
qsizetype i =
e.m_firstChildIndex;
i <= lastChildIndex;
i++) {
193 if (
c.childCount() > 0)
200 template<
typename Func>
203 for (
auto &
e : m_elements) {
204 if (
e.childCount() > 0)
211 template<
typename Func>
214 for (
auto &
e : m_elements) {
215 if (
e.childCount() > 0)
226 return i < 0 ? m_childElements[-(
i + 1)] : m_elements[
i];
239 Element::CurvatureFlags coordinateOrderOfElement(
const Element &element)
const;
240 static bool isControlPointOnLeft(
const Element &element);
250 bool subPathToStart =
true;
268 void beginSync(
int totalCount,
bool *countChanged)
override;
279 void endSync(
bool async)
override;
309 bool isFillVisible()
const {
return fillColor.alpha() > 0 || gradientType !=
NoGradient; }
311 bool isStrokeVisible()
const
313 return validPenWidth && pen.color().alpha() > 0 && pen.style() !=
Qt::NoPen;
317 GradientDesc gradient;
326 bool validPenWidth =
true;
327 bool convexConcaveResolved =
false;
335 void deleteAndClear(
NodeList *nodeList);
345 static int debugVisualizationFlags;
The QColor class provides colors based on RGB, HSV or CMYK values.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void beginSync(int totalCount, bool *countChanged) override
static Q_QUICKSHAPES_PRIVATE_EXPORT int debugVisualization()
void setRootNode(QSGNode *node)
static Q_QUICKSHAPES_PRIVATE_EXPORT void setDebugVisualization(int options)
void setFillGradient(int index, QQuickShapeGradient *gradient) override
Flags flags() const override
QVector< QSGGeometryNode * > NodeList
void endSync(bool async) override
void setStrokeWidth(int index, qreal w) override
void updateNode() override
void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) override
~QQuickShapeCurveRenderer() override
void setStrokeColor(int index, const QColor &color) override
QQuickShapeCurveRenderer(QQuickItem *)
void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) override
void setFillColor(int index, const QColor &color) override
void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QVector< qreal > &dashPattern) override
void setPath(int index, const QQuickPath *path) override
void setAsyncCallback(void(*)(void *), void *) override
void setFillRule(int index, QQuickShapePath::FillRule fillRule) override
\inmodule QtCore\reentrant
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
The QVector2D class represents a vector or vertex in 2D space.
The QVector3D class represents a vector or vertex in 3D space.
QVector2D pointAtFraction(float t) const
bool isSubpathEnd() const
QVector2D startPoint() const
QVector2D midPoint() const
friend QDebug operator<<(QDebug, const QuadPath::Element &)
void setAsConvex(bool isConvex)
QVector2D controlPoint() const
QVector3D HGForPoint(QVector2D p) const
std::array< QVector2D, 3 > ABC() const
qsizetype indexOfChild(qsizetype childNumber) const
qsizetype childCount() const
bool isSubpathStart() const
QVector2D endPoint() const
QVector2D tangentAtFraction(float t) const
QVector3D uvForPoint(QVector2D p) const
QVector2D normalAtFraction(float t) const
qsizetype elementCount() const
static QuadPath fromPainterPath(const QPainterPath &path)
QuadPath flattened() const
void splitElementAt(qsizetype index)
void iterateChildrenOf(const Element &e, Func &&lambda) const
qsizetype elementCountRecursive() const
const Element & elementAt(qsizetype i) const
QPainterPath toPainterPath() const
qsizetype indexOfChildAt(qsizetype i, qsizetype childNumber) const
QuadPath subPathsClosed() const
void reserve(qsizetype size)
void lineTo(const QVector2D &to)
Qt::FillRule fillRule() const
void quadTo(const QVector2D &control, const QVector2D &to)
QuadPath dashed(qreal lineWidth, const QList< qreal > &dashPattern, qreal dashOffset=0) const
void iterateChildrenOf(Element &e, Func &&lambda)
friend QDebug operator<<(QDebug, const QuadPath &)
QRectF controlPointRect() const
void setFillRule(Qt::FillRule rule)
void iterateElements(Func &&lambda)
bool contains(const QVector2D &v) const
Element & elementAt(qsizetype i)
void moveTo(const QVector2D &to)
void iterateElements(Func &&lambda) const
Combined button and popup list for selecting options.
DBusConnection const char * rule
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLchar *const * path
static bool isLine(const QBezier &bezier)
QDebug operator<<(QDebug, const QuadPath::Element &)