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
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
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
27QT_BEGIN_NAMESPACE
28
29class QQuickShaderEffect;
30class QQuickShaderEffectSource;
31
34
35{
36 Q_DECLARE_PUBLIC(QQuickMultiEffect)
37
38public:
41
42 QQuickItem *source() const;
43 void setSource(QQuickItem *item);
44
45 bool autoPaddingEnabled() const;
46 void setAutoPaddingEnabled(bool enabled);
47
48 QRectF paddingRect() const;
49 void setPaddingRect(const QRectF &rect);
50
51 qreal brightness() const;
52 void setBrightness(qreal brightness);
53
54 qreal contrast() const;
55 void setContrast(qreal contrast);
56
57 qreal saturation() const;
58 void setSaturation(qreal saturation);
59
60 qreal colorization() const;
61 void setColorization(qreal colorization);
62
64 void setColorizationColor(const QColor &color);
65
66 bool blurEnabled() const;
67 void setBlurEnabled(bool enabled);
68
69 qreal blur() const;
70 void setBlur(qreal blur);
71
72 int blurMax() const;
73 void setBlurMax(int blurMax);
74
75 qreal blurMultiplier() const;
76 void setBlurMultiplier(qreal blurMultiplier);
77
78 bool shadowEnabled() const;
79 void setShadowEnabled(bool enabled);
80
81 qreal shadowOpacity() const;
82 void setShadowOpacity(qreal shadowOpacity);
83
84 qreal shadowBlur() const;
85 void setShadowBlur(qreal shadowBlur);
86
88 void setShadowHorizontalOffset(qreal offset);
89
91 void setShadowVerticalOffset(qreal offset);
92
93 QColor shadowColor() const;
94 void setShadowColor(const QColor &color);
95
96 qreal shadowScale() const;
97 void setShadowScale(qreal shadowScale);
98
99 bool maskEnabled() const;
100 void setMaskEnabled(bool enabled);
101
102 QQuickItem *maskSource() const;
103 void setMaskSource(QQuickItem *item);
104
105 qreal maskThresholdMin() const;
106 void setMaskThresholdMin(qreal threshold);
107
108 qreal maskSpreadAtMin() const;
109 void setMaskSpreadAtMin(qreal spread);
110
111 qreal maskThresholdMax() const;
112 void setMaskThresholdMax(qreal threshold);
113
114 qreal maskSpreadAtMax() const;
115 void setMaskSpreadAtMax(qreal spread);
116
117 bool maskInverted() const;
118 void setMaskInverted(bool inverted);
119
120 QRectF itemRect() const;
121 QString fragmentShader() const;
122 QString vertexShader() const;
123 bool hasProxySource() const;
124
125 void handleGeometryChange(const QRectF &newGeometry, const QRectF &oldGeometry);
126 void handleItemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value);
127 void initialize();
129 void updateCenterOffset();
130 void updateShadowOffset();
132 void updateShadowColor();
133 float calculateLod(float blurAmount);
134 float blurWeight(float v);
135 void getBlurWeights(float blurLod, QVector4D &blurWeight1, QVector2D &blurWeight2);
136 void updateBlurWeights();
138 void updateBlurItemSizes(bool forceUpdate = false);
139 void updateEffectShaders();
140 void updateBlurLevel(bool forceUpdate = false);
141 void updateBlurItemsAmount(int blurLevel);
142 void updateSourcePadding();
144 void proxyOutputChanged();
145
146 void itemDestroyed(QQuickItem *item) final;
147
148private:
149 bool m_initialized = false;
150 QQuickItem *m_sourceItem = nullptr;
151 QGfxSourceProxyME *m_shaderSource = nullptr;
152 QQuickShaderEffect *m_shaderEffect = nullptr;
153 QQuickShaderEffectSource *m_dummyShaderSource = nullptr;
154 QList<QQuickShaderEffect *> m_blurEffects;
155 bool m_autoPaddingEnabled = true;
156 QRectF m_paddingRect;
157 qreal m_brightness = 0.0;
158 qreal m_contrast = 0.0;
159 qreal m_saturation = 0.0;
160 qreal m_colorization = 0.0;
161 QColor m_colorizationColor = { 255, 0, 0, 255 };
162 bool m_blurEnabled = false;
163 qreal m_blur = 0.0;
164 int m_blurMax = 32;
165 qreal m_blurMultiplier = 0.0;
166 bool m_shadowEnabled = false;
167 qreal m_shadowOpacity = 1.0;
168 qreal m_shadowBlur = 1.0;
169 qreal m_shadowHorizontalOffset = 0.0;
170 qreal m_shadowVerticalOffset = 0.0;
171 QColor m_shadowColor = { 0, 0, 0, 255 };
172 qreal m_shadowScale = 1.0;
173 bool m_maskEnabled = false;
174 QQuickItem *m_maskSourceItem = nullptr;
175 qreal m_maskThresholdMin = 0.0;
176 qreal m_maskSpreadAtMin = 0.0;
177 qreal m_maskThresholdMax = 1.0;
178 qreal m_maskSpreadAtMax = 0.0;
179 bool m_maskInverted = false;
180
181 int m_blurLevel = 0;
182 QString m_vertShader;
183 QString m_fragShader;
184 QSizeF m_firstBlurItemSize;
185
186 QVector4D m_blurWeight1;
187 QVector2D m_blurWeight2;
188 QVector4D m_shadowBlurWeight1;
189 QVector2D m_shadowBlurWeight2;
190};
191
192
193
194QT_END_NAMESPACE
195
196#endif // QQUICKMULTIEFFECT_P_P_H
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 itemDestroyed(QQuickItem *item) final
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)
QT_REQUIRE_CONFIG(quick_shadereffect)