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
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
31
33{
34 Q_DECLARE_PUBLIC(QQuickMultiEffect)
35
36public:
39
40 QQuickItem *source() const;
42
43 bool autoPaddingEnabled() const;
45
46 QRectF paddingRect() const;
47 void setPaddingRect(const QRectF &rect);
48
49 qreal brightness() const;
51
52 qreal contrast() const;
54
55 qreal saturation() const;
57
58 qreal colorization() const;
60
63
64 bool blurEnabled() const;
65 void setBlurEnabled(bool enabled);
66
67 qreal blur() const;
68 void setBlur(qreal blur);
69
70 int blurMax() const;
71 void setBlurMax(int blurMax);
72
73 qreal blurMultiplier() const;
75
76 bool shadowEnabled() const;
77 void setShadowEnabled(bool enabled);
78
79 qreal shadowOpacity() const;
81
82 qreal shadowBlur() const;
84
87
90
91 QColor shadowColor() const;
92 void setShadowColor(const QColor &color);
93
94 qreal shadowScale() const;
96
97 bool maskEnabled() const;
98 void setMaskEnabled(bool enabled);
99
100 QQuickItem *maskSource() const;
102
103 qreal maskThresholdMin() const;
104 void setMaskThresholdMin(qreal threshold);
105
106 qreal maskSpreadAtMin() const;
107 void setMaskSpreadAtMin(qreal spread);
108
109 qreal maskThresholdMax() const;
110 void setMaskThresholdMax(qreal threshold);
111
112 qreal maskSpreadAtMax() const;
113 void setMaskSpreadAtMax(qreal spread);
114
115 bool maskInverted() const;
116 void setMaskInverted(bool inverted);
117
118 QRectF itemRect() const;
119 QString fragmentShader() const;
120 QString vertexShader() const;
121 bool hasProxySource() const;
122
123 void handleGeometryChange(const QRectF &newGeometry, const QRectF &oldGeometry);
125 void initialize();
127 void updateCenterOffset();
128 void updateShadowOffset();
130 void updateShadowColor();
131 float calculateLod(float blurAmount);
132 float blurWeight(float v);
133 void getBlurWeights(float blurLod, QVector4D &blurWeight1, QVector2D &blurWeight2);
134 void updateBlurWeights();
136 void updateBlurItemSizes(bool forceUpdate = false);
137 void updateEffectShaders();
138 void updateBlurLevel(bool forceUpdate = false);
139 void updateBlurItemsAmount(int blurLevel);
140 void updateSourcePadding();
142 void proxyOutputChanged();
143
144private:
145 bool m_initialized = false;
146 QQuickItem *m_sourceItem = nullptr;
147 QGfxSourceProxy *m_shaderSource = nullptr;
148 QQuickShaderEffect *m_shaderEffect = nullptr;
149 QQuickShaderEffectSource *m_dummyShaderSource = nullptr;
150 QVector<QQuickShaderEffect *> m_blurEffects;
151 bool m_autoPaddingEnabled = true;
152 QRectF m_paddingRect;
153 qreal m_brightness = 0.0;
154 qreal m_contrast = 0.0;
155 qreal m_saturation = 0.0;
156 qreal m_colorization = 0.0;
157 QColor m_colorizationColor = { 255, 0, 0, 255 };
158 bool m_blurEnabled = false;
159 qreal m_blur = 0.0;
160 int m_blurMax = 32;
161 qreal m_blurMultiplier = 0.0;
162 bool m_shadowEnabled = false;
163 qreal m_shadowOpacity = 1.0;
164 qreal m_shadowBlur = 1.0;
165 qreal m_shadowHorizontalOffset = 0.0;
166 qreal m_shadowVerticalOffset = 0.0;
167 QColor m_shadowColor = { 0, 0, 0, 255 };
168 qreal m_shadowScale = 1.0;
169 bool m_maskEnabled = false;
170 QQuickItem *m_maskSourceItem = nullptr;
171 qreal m_maskThresholdMin = 0.0;
172 qreal m_maskSpreadAtMin = 0.0;
173 qreal m_maskThresholdMax = 1.0;
174 qreal m_maskSpreadAtMax = 0.0;
175 bool m_maskInverted = false;
176
177 int m_blurLevel = 0;
178 QString m_vertShader;
179 QString m_fragShader;
180 QSizeF m_firstBlurItemSize;
181
182 QVector4D m_blurWeight1;
183 QVector2D m_blurWeight2;
184 QVector4D m_shadowBlurWeight1;
185 QVector2D m_shadowBlurWeight2;
186};
187
188
189
191
192#endif // QQUICKMULTIEFFECT_P_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
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
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:484
\inmodule QtCore
Definition qsize.h:208
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
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
GLuint color
[2]
GLenum GLuint GLintptr offset
void forceUpdate(QQuickItem *item)
#define QT_REQUIRE_CONFIG(feature)
double qreal
Definition qtypes.h:187
QGraphicsItem * item
\inmodule QtQuick
Definition qquickitem.h:159