Qt 6.x
The Qt SDK
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
4#include <private/qtquickglobal_p.h>
5
6QT_REQUIRE_CONFIG(quick_shadereffect);
7
8#include "qqmlparserstatus.h"
9
10#include <QtQuick/qtquickglobal.h>
11#include <QtGui/qcolor.h>
12#include <QtCore/qobject.h>
13#include <QtCore/qsize.h>
14#include <QtCore/qvector.h>
15#include <QtCore/qbytearray.h>
16#include <QtQml/qqml.h>
17
18#ifndef QQUICKSHADEREFFECTMESH_P_H
19#define QQUICKSHADEREFFECTMESH_P_H
20
21//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the Qt API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29// We mean it.
30//
31
33
34Q_QUICK_PRIVATE_EXPORT const char *qtPositionAttributeName();
35Q_QUICK_PRIVATE_EXPORT const char *qtTexCoordAttributeName();
36
37class QSGGeometry;
38class QRectF;
39
40class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectMesh : public QObject
41{
43
44 QML_NAMED_ELEMENT(ShaderEffectMesh)
46 QML_UNCREATABLE("Cannot create instance of abstract class ShaderEffectMesh.")
47
48public:
50 virtual bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) = 0;
51 // If 'geometry' != 0, 'attrCount' is the same as last time the function was called.
52 virtual QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
53 const QRectF &srcRect, const QRectF &rect) = 0;
54 // If updateGeometry() fails, the reason should appear in the log.
55 virtual QString log() const { return QString(); }
56
58 // Emitted when the geometry needs to be updated.
60
61protected:
63};
64
65class Q_QUICK_PRIVATE_EXPORT QQuickGridMesh : public QQuickShaderEffectMesh
66{
68 Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged FINAL)
69 QML_NAMED_ELEMENT(GridMesh)
71public:
72 QQuickGridMesh(QObject *parent = nullptr);
73 bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override;
74 QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
75 const QRectF &srcRect, const QRectF &rect) override;
76 QString log() const override { return m_log; }
77
78 void setResolution(const QSize &res);
79 QSize resolution() const;
80
83
84private:
85 QSize m_resolution;
86 QString m_log;
87};
88
89class QQuickScaleGrid;
91{
93
94 Q_PROPERTY(QQuickScaleGrid *border READ border CONSTANT FINAL)
95 Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged FINAL)
98
99 QML_NAMED_ELEMENT(BorderImageMesh)
101
102public:
104
105 bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override;
106 QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
107 const QRectF &srcRect, const QRectF &rect) override;
108
109 QQuickScaleGrid *border() const;
110
113
114 QSize size() const;
115 void setSize(const QSize &size);
116
119
122
127
128private:
129 QQuickScaleGrid *m_border;
130 QSize m_size;
131 TileMode m_horizontalTileMode;
132 TileMode m_verticalTileMode;
133};
134
136{
137 float r, g, b, a;
138 c.getRgbF(&r, &g, &b, &a);
139 return QColor::fromRgbF(r * a, g * a, b * a, a);
140}
141
142
144
145#endif // QQUICKSHADEREFFECTMESH_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
static QColor fromRgbF(float r, float g, float b, float a=1.0)
Static convenience function that returns a QColor constructed from the RGB color values,...
Definition qcolor.cpp:2427
Definition qlist.h:74
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
void setSize(const QSize &size)
bool validateAttributes(const QVector< QByteArray > &attributes, int *posIndex) override
void horizontalTileModeChanged()
QSGGeometry * updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, const QRectF &srcRect, const QRectF &rect) override
void resolutionChanged()
QString log() const override
The QQuickScaleGrid class allows you to specify a 3x3 grid to use in scaling an image.
virtual bool validateAttributes(const QVector< QByteArray > &attributes, int *posIndex)=0
virtual QSGGeometry * updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, const QRectF &srcRect, const QRectF &rect)=0
virtual QString log() const
\inmodule QtCore\reentrant
Definition qrect.h:483
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
rect
[4]
Combined button and popup list for selecting options.
@ RepeatTile
Definition qnamespace.h:134
@ RoundTile
Definition qnamespace.h:135
@ StretchTile
Definition qnamespace.h:133
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLboolean GLboolean g
GLuint res
const GLubyte * c
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
Q_QUICK_PRIVATE_EXPORT const char * qtTexCoordAttributeName()
QT_BEGIN_NAMESPACE Q_QUICK_PRIVATE_EXPORT const char * qtPositionAttributeName()
QColor qt_premultiply_color(const QColor &c)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SIGNALS
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent