9#include <private/qsgplaintexture_p.h>
10#include <private/qquicksvgparser_p.h>
11#include <QtGui/private/qdrawhelper_p.h>
12#include <QOpenGLFunctions>
13#include <QLoggingCategory>
78 : strokeColor(
Qt::white),
190 return d->sfp.strokeColor;
196 if (
d->sfp.strokeColor !=
color) {
197 d->sfp.strokeColor =
color;
217 return d->sfp.strokeWidth;
223 if (
d->sfp.strokeWidth !=
w) {
224 d->sfp.strokeWidth =
w;
244 return d->sfp.fillColor;
250 if (
d->sfp.fillColor !=
color) {
275 return d->sfp.fillRule;
309 return d->sfp.joinStyle;
315 if (
d->sfp.joinStyle != style) {
316 d->sfp.joinStyle = style;
335 return d->sfp.miterLimit;
341 if (
d->sfp.miterLimit !=
limit) {
342 d->sfp.miterLimit =
limit;
369 return d->sfp.capStyle;
375 if (
d->sfp.capStyle != style) {
376 d->sfp.capStyle = style;
396 return d->sfp.strokeStyle;
402 if (
d->sfp.strokeStyle != style) {
403 d->sfp.strokeStyle = style;
424 return d->sfp.dashOffset;
430 if (
d->sfp.dashOffset !=
offset) {
455 return d->sfp.dashPattern;
461 if (
d->sfp.dashPattern !=
array) {
462 d->sfp.dashPattern =
array;
486 return d->sfp.fillGradient;
492 if (
d->sfp.fillGradient != gradient) {
493 if (
d->sfp.fillGradient)
496 d->sfp.fillGradient = gradient;
497 if (
d->sfp.fillGradient)
509 emit q->shapePathChanged();
643 emit q->boundingRectChanged();
649 if (
status != newStatus) {
651 emit q->statusChanged();
728 return d->rendererType;
755 return d->preferredType;
761 if (
d->preferredType == preferredType)
764 d->preferredType = preferredType;
767 for (
int i = 0;
i <
d->sp.size(); ++
i) {
773 d->_q_shapePathChanged();
777 emit preferredRendererTypeChanged();
806 if (
d->async != async) {
809 if (
d->componentComplete)
810 d->_q_shapePathChanged();
825 brect = brect.
united(
path->path().boundingRect());
844 return d->enableVendorExts;
850 if (
d->enableVendorExts !=
enable) {
906 return d->containsMode;
916 emit containsModeChanged();
922 switch (
d->containsMode) {
927 if (
path->path().contains(point))
944 if (
path &&
d->componentComplete) {
946 d->_q_shapePathChanged();
962 if (
d->componentComplete)
963 d->_q_shapePathChanged();
1000 d->_q_shapePathChanged();
1007 const int currentEffectRefCount =
d->extra.isAllocated() ?
d->extra->recursiveEffectRefCount : 0;
1008 if (!
d->spChanged && currentEffectRefCount <= d->effectRefCount)
1011 d->spChanged =
false;
1012 d->effectRefCount = currentEffectRefCount;
1015 if (
d->rendererType != expectedRenderer) {
1017 d->renderer =
nullptr;
1021 d->createRenderer();
1040 d->_q_shapePathChanged();
1042 for (
int i = 0;
i <
d->sp.size(); ++
i)
1044 d->_q_shapePathChanged();
1056 if (
d->renderer ||
d->rendererChanged) {
1057 if (!node ||
d->rendererChanged) {
1058 d->rendererChanged =
false;
1060 node =
d->createNode();
1063 d->renderer->updateNode();
1076 static const bool environmentPreferCurve =
1091 qWarning(
"No path backend for this graphics API yet");
1110 switch (selectedType) {
1154 qWarning(
"No path backend for this graphics API yet");
1166 if (self->syncTimingActive)
1167 qDebug(
"[Shape %p] [%d] [dirty=0x%x] async update took %lld ms",
1168 self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed());
1185 bool countChanged =
false;
1192 totalDirty |=
dirty;
1227 qDebug(
"[Shape %p] [%d] [dirty=0x%x] update took %lld ms",
1234 if (totalDirty || countChanged)
1284 if (m_spread !=
mode) {
1333 if (m_start.
x() !=
v) {
1347 if (m_start.
y() !=
v) {
1361 if (m_end.
x() !=
v) {
1375 if (m_end.
y() !=
v) {
1445 return m_centerPoint.
x();
1450 if (m_centerPoint.
x() !=
v) {
1451 m_centerPoint.
setX(
v);
1459 return m_centerPoint.
y();
1464 if (m_centerPoint.
y() !=
v) {
1465 m_centerPoint.
setY(
v);
1481 return m_centerRadius;
1486 if (m_centerRadius !=
v) {
1495 return m_focalPoint.
x();
1500 if (m_focalPoint.
x() !=
v) {
1501 m_focalPoint.
setX(
v);
1509 return m_focalPoint.
y();
1514 if (m_focalPoint.
y() !=
v) {
1515 m_focalPoint.
setY(
v);
1523 return m_focalRadius;
1528 if (m_focalRadius !=
v) {
1571 return m_centerPoint.
x();
1576 if (m_centerPoint.
x() !=
v) {
1577 m_centerPoint.
setX(
v);
1585 return m_centerPoint.
y();
1590 if (m_centerPoint.
y() !=
v) {
1591 m_centerPoint.
setY(
v);
1619 uint *colorTable,
int size,
float opacity)
1624 const bool colorInterpolation =
true;
1629 qreal fpos = 1.5 * incr;
1632 while (fpos <=
s.first().first) {
1633 colorTable[
pos] = colorTable[
pos - 1];
1638 if (colorInterpolation)
1641 const int sLast =
s.size() - 1;
1642 for (
int i = 0;
i < sLast; ++
i) {
1643 qreal delta = 1/(
s[
i+1].first -
s[
i].first);
1645 if (colorInterpolation)
1649 int dist = int(256 * ((fpos -
s[
i].
first) * delta));
1650 int idist = 256 -
dist;
1651 if (colorInterpolation)
1658 current_color = next_color;
1663 colorTable[
pos] = last_color;
1665 colorTable[
size-1] = last_color;
1693 static const int W = 1024;
1719 m_textures[grad] = tx;
1726#include "moc_qquickshape_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
void start() noexcept
Starts this timer.
uchar * bits()
Returns a pointer to the first pixel data.
@ Format_RGBA8888_Premultiplied
void fill(uint pixel)
Fills the entire image with the given pixelValue.
bool isEmpty() const noexcept
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
virtual void setPath(int index, const QQuickPath *path)=0
virtual void setTriangulationScale(qreal)
virtual void beginSync(int totalCount, bool *countChanged)=0
virtual void setStrokeColor(int index, const QColor &color)=0
virtual void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QVector< qreal > &dashPattern)=0
virtual void setAsyncCallback(void(*)(void *), void *)
virtual Flags flags() const
virtual void setCapStyle(int index, QQuickShapePath::CapStyle capStyle)=0
virtual void setFillGradient(int index, QQuickShapeGradient *gradient)=0
virtual void setFillColor(int index, const QColor &color)=0
virtual void setFillRule(int index, QQuickShapePath::FillRule fillRule)=0
virtual void setStrokeWidth(int index, qreal w)=0
virtual void endSync(bool async)=0
virtual void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)=0
static void data_clear(QQmlListProperty< QObject > *)
static qsizetype data_count(QQmlListProperty< QObject > *)
\qmlproperty list<QtObject> QtQuick::Item::data \qmldefault
static QObject * data_at(QQmlListProperty< QObject > *, qsizetype)
QQmlListProperty< QObject > data()
static void data_append(QQmlListProperty< QObject > *, QObject *)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
void update()
Schedules a call to updatePaintNode() for this item.
void polish()
Schedules a polish event for this item.
QQuickShapeConicalGradient(QObject *parent=nullptr)
Conical gradient.
QSGTexture * get(const QQuickShapeGradientCacheKey &grad)
static QQuickShapeGradientCache * cacheForRhi(QRhi *rhi)
~QQuickShapeGradientCache()
QQuickShapeGradient(QObject *parent=nullptr)
Base type of Shape fill gradients.
void setSpread(SpreadMode mode)
QQuickShapeLinearGradient(QObject *parent=nullptr)
Linear gradient.
void _q_fillGradientChanged()
static QQuickShapePathPrivate * get(QQuickShapePath *p)
QQuickShapePathPrivate()
Describes a Path and associated properties for stroking and filling.
void setDashPattern(const QVector< qreal > &array)
void setJoinStyle(JoinStyle style)
void setFillGradient(QQuickShapeGradient *gradient)
void strokeColorChanged()
void setStrokeColor(const QColor &color)
void setFillRule(FillRule fillRule)
void setMiterLimit(int limit)
void setStrokeWidth(qreal w)
void dashPatternChanged()
void setDashOffset(qreal offset)
void strokeWidthChanged()
QQuickShapePath(QObject *parent=nullptr)
void strokeStyleChanged()
void setCapStyle(CapStyle style)
QVector< qreal > dashPattern
void setStrokeStyle(StrokeStyle style)
QQuickShapeGradient * fillGradient
void setFillColor(const QColor &color)
QQuickShape::RendererType rendererType
QVector< QQuickShapePath * > sp
QQuickShapePrivate()
Renders a path.
static QQuickShapePrivate * get(QQuickShape *item)
void setStatus(QQuickShape::Status newStatus)
void _q_shapePathChanged()
QQuickShape::Status status
QQuickAbstractPathRenderer * renderer
QQuickShape::RendererType preferredType
static void asyncShapeReady(void *data)
QQuickShape::RendererType selectRendererType()
void focalRadiusChanged()
void setCenterRadius(qreal v)
QQuickShapeRadialGradient(QObject *parent=nullptr)
Radial gradient.
void setFocalRadius(qreal v)
void centerRadiusChanged()
RendererType preferredRendererType
\qmlproperty enumeration QtQuick.Shapes::Shape::preferredRendererType
void itemChange(ItemChange change, const ItemChangeData &data) override
Called when change occurs for this item.
QSGNode * updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void vendorExtensionsEnabledChanged()
void asynchronousChanged()
bool contains(const QPointF &point) const override
\qmlmethod bool QtQuick::Item::contains(point point)
bool vendorExtensionsEnabled
RendererType rendererType
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setContainsMode(ContainsMode containsMode)
void setAsynchronous(bool async)
QQuickShape(QQuickItem *parent=nullptr)
void setVendorExtensionsEnabled(bool enable)
void updatePolish() override
This function should perform any layout as required for this item.
FINALQRectF boundingRect
\qmlproperty rect QtQuick.Shapes::Shape::boundingRect
ContainsMode containsMode
FINALQQmlListProperty< QObject > data
\qmlproperty list<Object> QtQuick.Shapes::Shape::data
static void defineModule()
\inmodule QtCore\reentrant
QRectF united(const QRectF &other) const noexcept
void addCleanupCallback(const CleanupCallback &callback)
Registers a callback that is invoked either when the QRhi is destroyed, or when runCleanup() is calle...
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void setImage(const QImage &image)
An interface providing access to some of the graphics API specific internals of the scenegraph.
static bool isApiRhiBased(GraphicsApi api)
virtual GraphicsApi graphicsApi() const =0
Returns the graphics API that is in use by the Qt Quick scenegraph.
void setHorizontalWrapMode(WrapMode hwrap)
Sets the horizontal wrap mode to hwrap.
void setFiltering(Filtering filter)
Sets the sampling mode to filter.
void setVerticalWrapMode(WrapMode vwrap)
Sets the vertical wrap mode to vwrap.
QString toLower() const &
qDeleteAll(list.begin(), list.end())
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
Q_CONSTRUCTOR_FUNCTION(initializeStandardUserDefaults)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
#define ARGB_COMBINE_ALPHA(argb, alpha)
static uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b)
int qRound(qfloat16 d) noexcept
#define Q_LOGGING_CATEGORY(name,...)
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLfloat GLfloat GLfloat alpha
static quint32 ARGB2RGBA(quint32 x)
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Disconnect Signal of Sender from Method of Receiver.
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.
static void generateGradientColorTable(const QQuickShapeGradientCacheKey &gradient, uint *colorTable, int size, float opacity)
static void initResources()
static void vpe_clear(QQmlListProperty< QObject > *property)
static void vpe_append(QQmlListProperty< QObject > *property, QObject *obj)
QT_BEGIN_NAMESPACE void QQuickShapes_initializeModule()
\qmlmodule QtQuick.Shapes 1.
constexpr QRgb qPremultiply(QRgb x)
QLatin1StringView QLatin1String
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
#define Q_INIT_RESOURCE(name)
std::uniform_real_distribution dist(1, 2.5)
[2]
QQuickShapeGradient::SpreadMode spread
QQuickShapeStrokeFillParams()
QVector< qreal > dashPattern
QThreadStorage< QCache< QString, SomeClass > > caches
[7]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent