18#include <QtCore/qrect.h>
19#include <QtCore/qlist.h>
20#include <QtCore/qdebug.h>
21#include <QtGui/qvector2d.h>
22#include <QtGui/qpainterpath.h>
23#include <QtQuick/qtquickexports.h>
35 PathFillOnRight = 0x8,
37 PathNonIntersecting = 0x20,
38 PathNonOverlappingControlPointTriangles = 0x40
57 return m_isSubpathStart;
62 return m_isSubpathEnd;
72 return m_curvatureFlags & Convex;
92 return isLine() ? 0.5f * (
sp + ep) : (0.25f *
sp) + (0.5f * cp) + (0.25 * ep);
103 return m_curvatureFlags & Element::FillOnRight ?
sp + normal :
sp - normal;
117 Q_ASSERT(childNumber >= 0 && childNumber < childCount());
118 return -(m_firstChildIndex + 1 + childNumber);
125 return isLine() ? (ep -
sp) : ((1 -
t) * 2 * (cp -
sp)) + (
t * 2 * (ep - cp));
134 float extent()
const;
139 m_curvatureFlags = Element::CurvatureFlags(m_curvatureFlags | Element::Convex);
141 m_curvatureFlags = Element::CurvatureFlags(m_curvatureFlags & ~Element::Convex);
147 m_curvatureFlags = Element::CurvatureFlags(m_curvatureFlags | Element::FillOnRight);
149 m_curvatureFlags = Element::CurvatureFlags(m_curvatureFlags & ~Element::FillOnRight);
156 return isPointOnLeft(cp,
sp, ep);
160 CurvatureUndetermined = 0,
166 FillSideUndetermined = 0,
173 int intersectionsAtY(
float y,
float *fractions,
bool swapXY =
false)
const;
178 int m_firstChildIndex = 0;
180 CurvatureFlags m_curvatureFlags = CurvatureUndetermined;
181 quint8 m_isSubpathStart : 1;
182 quint8 m_isSubpathEnd : 1;
190 m_subPathToStart =
true;
196 addElement({}, to,
true);
201 addElement(control, to);
206 return i < 0 ? m_childElements[-(
i + 1)] : m_elements[
i];
211 return i < 0 ? m_childElements[-(
i + 1)] : m_elements[
i];
216 return elementAt(
i).indexOfChild(childNumber);
219 QRectF controlPointRect()
const;
226 bool isEmpty()
const {
return m_elements.size() == 0; }
227 int elementCountRecursive()
const;
233 QQuadPath subPathsClosed(
bool *didClose =
nullptr)
const;
234 void addCurvatureData();
236 QQuadPath dashed(
qreal lineWidth,
const QList<qreal> &dashPattern,
qreal dashOffset = 0)
const;
237 void splitElementAt(
int index);
240 Element::FillSide fillSideOf(
int elementIdx,
float elementT)
const;
242 template<
typename Func>
245 const int lastChildIndex = e.m_firstChildIndex + e.
childCount() - 1;
246 for (
int i = e.m_firstChildIndex;
i <= lastChildIndex;
i++) {
248 if (
c.childCount() > 0)
249 iterateChildrenOf(
c, lambda);
255 template<
typename Func>
258 const int lastChildIndex = e.m_firstChildIndex + e.
childCount() - 1;
259 for (
int i = e.m_firstChildIndex;
i <= lastChildIndex;
i++) {
261 if (
c.childCount() > 0)
262 iterateChildrenOf(
c, lambda);
268 template<
typename Func>
271 for (
int i = 0;
i < m_elements.size();
i++) {
274 iterateChildrenOf(e, lambda);
280 template<
typename Func>
283 for (
int i = 0;
i < m_elements.size();
i++) {
286 iterateChildrenOf(e, lambda);
299 return m_hints.testFlag(
hint);
304 m_hints.setFlag(
hint, on);
319 void addElement(
const Element &e);
320 Element::CurvatureFlags coordinateOrderOfElement(
const Element &element)
const;
324 QList<Element> m_elements;
325 QList<Element> m_childElements;
327 bool m_subPathToStart =
true;
328 bool m_windingFill =
false;
bool isSubpathStart() const
bool isControlPointOnLeft() const
bool isFillOnRight() const
QVector2D normalAtFraction(float t) const
void setFillOnRight(bool isFillOnRight)
int indexOfChild(int childNumber) const
QVector2D tangentAtFraction(float t) const
bool isSubpathEnd() const
QVector2D startPoint() const
void setAsConvex(bool isConvex)
QVector2D midPoint() const
QVector2D endPoint() const
Element(QVector2D s, QVector2D c, QVector2D e)
QVector2D referencePoint() const
QVector2D controlPoint() const
void lineTo(const QVector2D &to)
void setHint(PathHint hint, bool on=true)
Element & elementAt(int i)
void quadTo(const QVector2D &control, const QVector2D &to)
void iterateElements(Func &&lambda)
void iterateElements(Func &&lambda) const
void iterateChildrenOf(const Element &e, Func &&lambda) const
void iterateChildrenOf(Element &e, Func &&lambda)
PathHints pathHints() const
int indexOfChildAt(int i, int childNumber) const
const Element & elementAt(int i) const
void setPathHints(PathHints newHints)
Qt::FillRule fillRule() const
void moveTo(const QVector2D &to)
bool testHint(PathHint hint) const
void setFillRule(Qt::FillRule rule)
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QVector2D class represents a vector or vertex in 2D space.
Combined button and popup list for selecting options.
DBusConnection const char * rule
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
[4]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
GLsizei const GLchar *const * path
static bool isLine(const QBezier &bezier)
Q_QUICK_EXPORT QDebug operator<<(QDebug, const QQuadPath::Element &)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
static uint toIndex(ExecutionEngine *e, const Value &v)