Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickshadereffectsource_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#ifndef QQUICKSHADEREFFECTSOURCE_P_H
5#define QQUICKSHADEREFFECTSOURCE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qtquickglobal_p.h>
19
20QT_REQUIRE_CONFIG(quick_shadereffect);
21
22#include "qquickitem.h"
23#include <QtQuick/qsgtextureprovider.h>
24#include <private/qsgadaptationlayer_p.h>
25#include <QtQuick/private/qsgcontext_p.h>
26#include <private/qsgdefaultinternalimagenode_p.h>
27#include <private/qquickitemchangelistener_p.h>
28
29#include "qpointer.h"
30#include "qsize.h"
31#include "qrect.h"
32
34
35class QSGNode;
36class UpdatePaintNodeData;
39
41
43{
45 Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
46 Q_PROPERTY(QQuickItem *sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged)
47 Q_PROPERTY(QRectF sourceRect READ sourceRect WRITE setSourceRect NOTIFY sourceRectChanged)
48 Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged)
49 Q_PROPERTY(Format format READ format WRITE setFormat NOTIFY formatChanged)
50 Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged)
51 Q_PROPERTY(bool hideSource READ hideSource WRITE setHideSource NOTIFY hideSourceChanged)
52 Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged)
53 Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged)
54 Q_PROPERTY(TextureMirroring textureMirroring READ textureMirroring WRITE setTextureMirroring NOTIFY textureMirroringChanged REVISION(2, 6))
55 Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged REVISION(2, 9))
56 QML_NAMED_ELEMENT(ShaderEffectSource)
58
59public:
66 Q_ENUM(WrapMode)
67
68 enum Format {
69 RGBA8 = 1,
72
73 // Qt 5 legacy values that were ignored starting from Qt 6.0
74 Alpha = RGBA8,
75 RGB = RGBA8,
76 RGBA = RGBA8
77 };
79
81 NoMirroring = 0x00,
82 MirrorHorizontally = 0x01,
83 MirrorVertically = 0x02
84 };
85 Q_ENUM(TextureMirroring)
86
87 QQuickShaderEffectSource(QQuickItem *parent = nullptr);
89
90 WrapMode wrapMode() const;
91 void setWrapMode(WrapMode mode);
92
93 QQuickItem *sourceItem() const;
94 void setSourceItem(QQuickItem *item);
95
96 QRectF sourceRect() const;
97 void setSourceRect(const QRectF &rect);
98
99 QSize textureSize() const;
100 void setTextureSize(const QSize &size);
101
102 Format format() const;
103 void setFormat(Format format);
104
105 bool live() const;
106 void setLive(bool live);
107
108 bool hideSource() const;
109 void setHideSource(bool hide);
110
111 bool mipmap() const;
112 void setMipmap(bool enabled);
113
114 bool recursive() const;
115 void setRecursive(bool enabled);
116
117 TextureMirroring textureMirroring() const;
118 void setTextureMirroring(TextureMirroring mirroring);
119
120 bool isTextureProvider() const override { return true; }
121 QSGTextureProvider *textureProvider() const override;
122
123 Q_INVOKABLE void scheduleUpdate();
124
125 int samples() const;
126 void setSamples(int count);
127
140
142
143private Q_SLOTS:
144 void sourceItemDestroyed(QObject *item);
145 void invalidateSceneGraph();
146
147protected:
148 void releaseResources() override;
149 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
150
151 void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override;
152 void itemChange(ItemChange change, const ItemChangeData &value) override;
153
154private:
155 void ensureTexture();
156
158 QSGLayer *m_texture;
159 WrapMode m_wrapMode;
160 QQuickItem *m_sourceItem;
161 QRectF m_sourceRect;
162 QSize m_textureSize;
163 Format m_format;
164 int m_samples;
165 uint m_live : 1;
166 uint m_hideSource : 1;
167 uint m_mipmap : 1;
168 uint m_recursive : 1;
169 uint m_grab : 1;
170 uint m_textureMirroring : 2; // Stores TextureMirroring enum
171};
172
174
175#endif // QQUICKSHADEREFFECTSOURCE_P_H
\inmodule QtCore
Definition qobject.h:103
The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
bool isTextureProvider() const override
Returns true if this item is a texture provider.
\inmodule QtCore\reentrant
Definition qrect.h:484
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
The QSGSimpleRectNode class is a convenience class for drawing solid filled rectangles using scenegra...
The QSGTextureProvider class encapsulates texture based entities in QML.
\inmodule QtCore
Definition qsize.h:25
Format
Definition ddsheader.h:14
widget setFormat(format)
rect
[4]
Combined button and popup list for selecting options.
@ Alpha
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
@ Repeat
GLsizei samples
GLenum mode
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum format
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
unsigned int uint
Definition qtypes.h:34
QGraphicsItem * item
edit hide()
\inmodule QtQuick
Definition qquickitem.h:159