Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickmultieffect_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QQUICKMULTIEFFECT_P_P_H
5#define QQUICKMULTIEFFECT_P_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 <private/qtquickglobal_p.h>
19
20QT_REQUIRE_CONFIG(quick_shadereffect);
21
22#include <private/qquickmultieffect_p.h>
23#include <private/qquickitem_p.h>
24#include <private/qgfxsourceproxy_p.h>
25#include <QtCore/qvector.h>
26
28
30
32{
33 Q_DECLARE_PUBLIC(QQuickMultiEffect)
34
35public:
38
39 QQuickItem *source() const;
41
42 bool autoPaddingEnabled() const;
44
45 QRectF paddingRect() const;
46 void setPaddingRect(const QRectF &rect);
47
48 qreal brightness() const;
50
51 qreal contrast() const;
53
54 qreal saturation() const;
56
57 qreal colorization() const;
59
62
63 bool blurEnabled() const;
64 void setBlurEnabled(bool enabled);
65
66 qreal blur() const;
67 void setBlur(qreal blur);
68
69 int blurMax() const;
70 void setBlurMax(int blurMax);
71
72 qreal blurMultiplier() const;
74
75 bool shadowEnabled() const;
76 void setShadowEnabled(bool enabled);
77
78 qreal shadowOpacity() const;
80
81 qreal shadowBlur() const;
83
86
89
90 QColor shadowColor() const;
91 void setShadowColor(const QColor &color);
92
93 qreal shadowScale() const;
95
96 bool maskEnabled() const;
97 void setMaskEnabled(bool enabled);
98
99 QQuickItem *maskSource() const;
101
102 qreal maskThresholdMin() const;
103 void setMaskThresholdMin(qreal threshold);
104
105 qreal maskSpreadAtMin() const;
106 void setMaskSpreadAtMin(qreal spread);
107
108 qreal maskThresholdMax() const;
109 void setMaskThresholdMax(qreal threshold);
110
111 qreal maskSpreadAtMax() const;
112 void setMaskSpreadAtMax(qreal spread);
113
114 bool maskInverted() const;
115 void setMaskInverted(bool inverted);
116
117 QRectF itemRect() const;
118 QString fragmentShader() const;
119 QString vertexShader() const;
120 bool hasProxySource() const;
121
122 void handleGeometryChange(const QRectF &newGeometry, const QRectF &oldGeometry);
124 void initialize();
126 void updateCenterOffset();
127 void updateShadowOffset();
129 void updateShadowColor();
130 float calculateLod(float blurAmount);
131 float blurWeight(float v);
132 void getBlurWeights(float blurLod, QVector4D &blurWeight1, QVector2D &blurWeight2);
133 void updateBlurWeights();
135 void updateBlurItemSizes(bool forceUpdate = false);
136 void updateEffectShaders();
137 void updateBlurLevel(bool forceUpdate = false);
138 void updateBlurItemsAmount(int blurLevel);
139 void updateSourcePadding();
141 void proxyOutputChanged();
142
143private:
144 bool m_initialized = false;
145 QQuickItem *m_sourceItem = nullptr;
146 QGfxSourceProxy *m_shaderSource = nullptr;
147 QQuickShaderEffect *m_shaderEffect = nullptr;
148 QVector<QQuickShaderEffect *> m_blurEffects;
149 bool m_autoPaddingEnabled = true;
150 QRectF m_paddingRect;
151 qreal m_brightness = 0.0;
152 qreal m_contrast = 0.0;
153 qreal m_saturation = 0.0;
154 qreal m_colorization = 0.0;
155 QColor m_colorizationColor = { 255, 0, 0, 255 };
156 bool m_blurEnabled = false;
157 qreal m_blur = 0.0;
158 int m_blurMax = 32;
159 qreal m_blurMultiplier = 0.0;
160 bool m_shadowEnabled = false;
161 qreal m_shadowOpacity = 1.0;
162 qreal m_shadowBlur = 1.0;
163 qreal m_shadowHorizontalOffset = 0.0;
164 qreal m_shadowVerticalOffset = 0.0;
165 QColor m_shadowColor = { 0, 0, 0, 255 };
166 qreal m_shadowScale = 1.0;
167 bool m_maskEnabled = false;
168 QQuickItem *m_maskSourceItem = nullptr;
169 qreal m_maskThresholdMin = 0.0;
170 qreal m_maskSpreadAtMin = 0.0;
171 qreal m_maskThresholdMax = 1.0;
172 qreal m_maskSpreadAtMax = 0.0;
173 bool m_maskInverted = false;
174
175 int m_blurLevel = 0;
176 QString m_vertShader;
177 QString m_fragShader;
178 QSizeF m_firstBlurItemSize;
179
180 QVector4D m_blurWeight1;
181 QVector2D m_blurWeight2;
182 QVector4D m_shadowBlurWeight1;
183 QVector2D m_shadowBlurWeight2;
184};
185
186
187
189
190#endif // QQUICKMULTIEFFECT_P_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
Definition qlist.h:74
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:143
void setShadowOpacity(qreal shadowOpacity)
void setShadowColor(const QColor &color)
void setMaskSpreadAtMax(qreal spread)
void setColorizationColor(const QColor &color)
void setMaskThresholdMin(qreal threshold)
void setColorization(qreal colorization)
void setShadowVerticalOffset(qreal offset)
void handleItemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
void setSource(QQuickItem *item)
void setShadowBlur(qreal shadowBlur)
void setMaskSource(QQuickItem *item)
QQuickItem * source() const
void setShadowScale(qreal shadowScale)
void setMaskThresholdMax(qreal threshold)
void setShadowEnabled(bool enabled)
void setMaskSpreadAtMin(qreal spread)
void setBlurEnabled(bool enabled)
QQuickItem * maskSource() const
void setSaturation(qreal saturation)
void updateBlurLevel(bool forceUpdate=false)
void setMaskInverted(bool inverted)
void setBlurMultiplier(qreal blurMultiplier)
void setShadowHorizontalOffset(qreal offset)
float calculateLod(float blurAmount)
void getBlurWeights(float blurLod, QVector4D &blurWeight1, QVector2D &blurWeight2)
void setPaddingRect(const QRectF &rect)
void setContrast(qreal contrast)
void updateBlurItemSizes(bool forceUpdate=false)
void setBrightness(qreal brightness)
void updateBlurItemsAmount(int blurLevel)
void handleGeometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
void setAutoPaddingEnabled(bool enabled)
void setMaskEnabled(bool enabled)
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtCore
Definition qsize.h:207
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
The QVector4D class represents a vector or vertex in 4D space.
Definition qvectornd.h:330
rect
[4]
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLuint GLintptr offset
void forceUpdate(QQuickItem *item)
#define QT_REQUIRE_CONFIG(feature)
double qreal
Definition qtypes.h:92
QGraphicsItem * item
\inmodule QtQuick
Definition qquickitem.h:158