Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickshadereffectmesh_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// Qt-Security score:significant reason:default
4
5#include <private/qtquickglobal_p.h>
6
8
10
11#include <QtQuick/qtquickglobal.h>
12#include <QtGui/qcolor.h>
13#include <QtCore/qobject.h>
14#include <QtCore/qsize.h>
15#include <QtCore/qvector.h>
16#include <QtCore/qbytearray.h>
17#include <QtQml/qqml.h>
18
19#ifndef QQUICKSHADEREFFECTMESH_P_H
20#define QQUICKSHADEREFFECTMESH_P_H
21
22//
23// W A R N I N G
24// -------------
25//
26// This file is not part of the Qt API. It exists purely as an
27// implementation detail. This header file may change from version to
28// version without notice, or even be removed.
29//
30// We mean it.
31//
32
33QT_BEGIN_NAMESPACE
34
35Q_QUICK_EXPORT const char *qtPositionAttributeName();
37
38class QSGGeometry;
39class QRectF;
40
41class Q_QUICK_EXPORT QQuickShaderEffectMesh : public QObject
42{
43 Q_OBJECT
44
45 QML_NAMED_ELEMENT(ShaderEffectMesh)
46 QML_ADDED_IN_VERSION(2, 0)
47 QML_UNCREATABLE("Cannot create instance of abstract class ShaderEffectMesh.")
48
49public:
50 QQuickShaderEffectMesh(QObject *parent = nullptr);
51 virtual bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) = 0;
52 // If 'geometry' != 0, 'attrCount' is the same as last time the function was called.
53 virtual QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
54 const QRectF &srcRect, const QRectF &rect) = 0;
55 // If updateGeometry() fails, the reason should appear in the log.
56 virtual QString log() const { return QString(); }
57
58Q_SIGNALS:
59 // Emitted when the geometry needs to be updated.
60 void geometryChanged();
61
62protected:
63 QQuickShaderEffectMesh(QObjectPrivate &dd, QObject *parent = nullptr);
64};
65
66class Q_QUICK_EXPORT QQuickGridMesh : public QQuickShaderEffectMesh
67{
68 Q_OBJECT
69 Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
70 QML_NAMED_ELEMENT(GridMesh)
71 QML_ADDED_IN_VERSION(2, 0)
72public:
73 QQuickGridMesh(QObject *parent = nullptr);
74 bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override;
75 QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
76 const QRectF &srcRect, const QRectF &rect) override;
77 QString log() const override { return m_log; }
78
79 void setResolution(const QSize &res);
80 QSize resolution() const;
81
82Q_SIGNALS:
83 void resolutionChanged();
84
85private:
86 QSize m_resolution;
87 QString m_log;
88};
89
90class QQuickScaleGrid;
92{
93 Q_OBJECT
94
95 Q_PROPERTY(QQuickScaleGrid *border READ border CONSTANT)
99
102
103public:
105
106 bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override;
107 QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
108 const QRectF &srcRect, const QRectF &rect) override;
109
110 QQuickScaleGrid *border() const;
111
114
115 QSize size() const;
116 void setSize(const QSize &size);
117
120
123
128
129private:
130 QQuickScaleGrid *m_border;
131 QSize m_size;
132 TileMode m_horizontalTileMode;
133 TileMode m_verticalTileMode;
134};
135
136inline QColor qt_premultiply_color(const QColor &c)
137{
138 float r, g, b, a;
139 c.getRgbF(&r, &g, &b, &a);
140 return QColor::fromRgbF(r * a, g * a, b * a, a);
141}
142
143
144QT_END_NAMESPACE
145
146#endif // QQUICKSHADEREFFECTMESH_P_H
void setSize(const QSize &size)
QQuickScaleGrid * border() const
bool validateAttributes(const QVector< QByteArray > &attributes, int *posIndex) override
void horizontalTileModeChanged()
TileMode horizontalTileMode() const
\qmlproperty enumeration QtQuick::BorderImageMesh::horizontalTileMode \qmlproperty enumeration QtQuic...
QSGGeometry * updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, const QRectF &srcRect, const QRectF &rect) override
static const char qt_texcoord_attribute_name[]
const char * qtTexCoordAttributeName()
static QT_BEGIN_NAMESPACE const char qt_position_attribute_name[]
const char * qtPositionAttributeName()
QT_REQUIRE_CONFIG(quick_shadereffect)
QColor qt_premultiply_color(const QColor &c)