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_H
5#define QQUICKMULTIEFFECT_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 "qtquickeffectsglobal_p.h"
23#include <QtQuick/qquickitem.h>
24#include <QtCore/qrect.h>
25#include <QtGui/qvector4d.h>
26#include <QtGui/qcolor.h>
27
28QT_BEGIN_NAMESPACE
29
30class QQuickMultiEffectPrivate;
31
32class Q_QUICKEFFECTS_PRIVATE_EXPORT QQuickMultiEffect : public QQuickItem
33{
34 Q_OBJECT
35 Q_PROPERTY(QQuickItem *source READ source WRITE setSource NOTIFY sourceChanged FINAL)
36 Q_PROPERTY(bool autoPaddingEnabled READ autoPaddingEnabled WRITE setAutoPaddingEnabled NOTIFY autoPaddingEnabledChanged FINAL)
37 Q_PROPERTY(QRectF paddingRect READ paddingRect WRITE setPaddingRect NOTIFY paddingRectChanged FINAL)
38 Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged FINAL)
39 Q_PROPERTY(qreal contrast READ contrast WRITE setContrast NOTIFY contrastChanged FINAL)
40 Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged FINAL)
41 Q_PROPERTY(qreal colorization READ colorization WRITE setColorization NOTIFY colorizationChanged FINAL)
42 Q_PROPERTY(QColor colorizationColor READ colorizationColor WRITE setColorizationColor NOTIFY colorizationColorChanged FINAL)
43 Q_PROPERTY(bool blurEnabled READ blurEnabled WRITE setBlurEnabled NOTIFY blurEnabledChanged FINAL)
44 Q_PROPERTY(qreal blur READ blur WRITE setBlur NOTIFY blurChanged FINAL)
45 Q_PROPERTY(int blurMax READ blurMax WRITE setBlurMax NOTIFY blurMaxChanged FINAL)
46 Q_PROPERTY(qreal blurMultiplier READ blurMultiplier WRITE setBlurMultiplier NOTIFY blurMultiplierChanged FINAL)
47 Q_PROPERTY(bool shadowEnabled READ shadowEnabled WRITE setShadowEnabled NOTIFY shadowEnabledChanged FINAL)
48 Q_PROPERTY(qreal shadowOpacity READ shadowOpacity WRITE setShadowOpacity NOTIFY shadowOpacityChanged FINAL)
49 Q_PROPERTY(qreal shadowBlur READ shadowBlur WRITE setShadowBlur NOTIFY shadowBlurChanged FINAL)
50 Q_PROPERTY(qreal shadowHorizontalOffset READ shadowHorizontalOffset WRITE setShadowHorizontalOffset NOTIFY shadowHorizontalOffsetChanged FINAL)
51 Q_PROPERTY(qreal shadowVerticalOffset READ shadowVerticalOffset WRITE setShadowVerticalOffset NOTIFY shadowVerticalOffsetChanged FINAL)
52 Q_PROPERTY(QColor shadowColor READ shadowColor WRITE setShadowColor NOTIFY shadowColorChanged FINAL)
53 Q_PROPERTY(qreal shadowScale READ shadowScale WRITE setShadowScale NOTIFY shadowScaleChanged FINAL)
54 Q_PROPERTY(bool maskEnabled READ maskEnabled WRITE setMaskEnabled NOTIFY maskEnabledChanged FINAL)
55 Q_PROPERTY(QQuickItem *maskSource READ maskSource WRITE setMaskSource NOTIFY maskSourceChanged FINAL)
56 Q_PROPERTY(qreal maskThresholdMin READ maskThresholdMin WRITE setMaskThresholdMin NOTIFY maskThresholdMinChanged FINAL)
57 Q_PROPERTY(qreal maskSpreadAtMin READ maskSpreadAtMin WRITE setMaskSpreadAtMin NOTIFY maskSpreadAtMinChanged FINAL)
58 Q_PROPERTY(qreal maskThresholdMax READ maskThresholdMax WRITE setMaskThresholdMax NOTIFY maskThresholdMaxChanged FINAL)
59 Q_PROPERTY(qreal maskSpreadAtMax READ maskSpreadAtMax WRITE setMaskSpreadAtMax NOTIFY maskSpreadAtMaxChanged FINAL)
60 Q_PROPERTY(bool maskInverted READ maskInverted WRITE setMaskInverted NOTIFY maskInvertedChanged FINAL)
61 Q_PROPERTY(QRectF itemRect READ itemRect NOTIFY itemRectChanged FINAL)
62 Q_PROPERTY(QString fragmentShader READ fragmentShader NOTIFY fragmentShaderChanged FINAL)
63 Q_PROPERTY(QString vertexShader READ vertexShader NOTIFY vertexShaderChanged FINAL)
64 Q_PROPERTY(bool hasProxySource READ hasProxySource NOTIFY hasProxySourceChanged FINAL)
65 QML_NAMED_ELEMENT(MultiEffect)
66 QML_ADDED_IN_VERSION(6, 5)
67
68public:
69 QQuickMultiEffect(QQuickItem *parent = nullptr);
70 ~QQuickMultiEffect() override;
71
72 QQuickItem *source() const;
73 void setSource(QQuickItem *item);
74
75 bool autoPaddingEnabled() const;
76 void setAutoPaddingEnabled(bool enabled);
77
78 QRectF paddingRect() const;
79 void setPaddingRect(const QRectF &rect);
80
81 qreal brightness() const;
82 void setBrightness(qreal brightness);
83
84 qreal contrast() const;
85 void setContrast(qreal contrast);
86
87 qreal saturation() const;
88 void setSaturation(qreal saturation);
89
90 qreal colorization() const;
91 void setColorization(qreal colorization);
92
93 QColor colorizationColor() const;
94 void setColorizationColor(const QColor &color);
95
96 bool blurEnabled() const;
97 void setBlurEnabled(bool enabled);
98
99 qreal blur() const;
100 void setBlur(qreal blur);
101
102 int blurMax() const;
103 void setBlurMax(int blurMax);
104
105 qreal blurMultiplier() const;
106 void setBlurMultiplier(qreal blurMultiplier);
107
108 bool shadowEnabled() const;
109 void setShadowEnabled(bool enabled);
110
111 qreal shadowOpacity() const;
112 void setShadowOpacity(qreal shadowOpacity);
113
114 qreal shadowBlur() const;
115 void setShadowBlur(qreal shadowBlur);
116
117 qreal shadowHorizontalOffset() const;
118 void setShadowHorizontalOffset(qreal offset);
119
120 qreal shadowVerticalOffset() const;
121 void setShadowVerticalOffset(qreal offset);
122
123 QColor shadowColor() const;
124 void setShadowColor(const QColor &color);
125
126 qreal shadowScale() const;
127 void setShadowScale(qreal shadowScale);
128
129 bool maskEnabled() const;
130 void setMaskEnabled(bool enabled);
131
132 QQuickItem *maskSource() const;
133 void setMaskSource(QQuickItem *item);
134
135 qreal maskThresholdMin() const;
136 void setMaskThresholdMin(qreal threshold);
137
138 qreal maskSpreadAtMin() const;
139 void setMaskSpreadAtMin(qreal spread);
140
141 qreal maskThresholdMax() const;
142 void setMaskThresholdMax(qreal threshold);
143
144 qreal maskSpreadAtMax() const;
145 void setMaskSpreadAtMax(qreal spread);
146
147 bool maskInverted() const;
148 void setMaskInverted(bool inverted);
149
150 QRectF itemRect() const;
151 QString fragmentShader() const;
152 QString vertexShader() const;
153 bool hasProxySource() const;
154
155Q_SIGNALS:
156 void shaderChanged();
157 void itemSizeChanged();
158 void sourceChanged();
159 void autoPaddingEnabledChanged();
160 void paddingRectChanged();
161 void brightnessChanged();
162 void contrastChanged();
163 void saturationChanged();
164 void colorizationChanged();
165 void colorizationColorChanged();
166 void blurEnabledChanged();
167 void blurChanged();
168 void blurMaxChanged();
169 void blurMultiplierChanged();
170 void shadowEnabledChanged();
171 void shadowOpacityChanged();
172 void shadowBlurChanged();
173 void shadowHorizontalOffsetChanged();
174 void shadowVerticalOffsetChanged();
175 void shadowColorChanged();
176 void shadowScaleChanged();
177 void maskEnabledChanged();
178 void maskSourceChanged();
179 void maskThresholdMinChanged();
180 void maskSpreadAtMinChanged();
181 void maskThresholdMaxChanged();
182 void maskSpreadAtMaxChanged();
183 void maskInvertedChanged();
184 void itemRectChanged();
185 void fragmentShaderChanged();
186 void vertexShaderChanged();
187 void hasProxySourceChanged();
188
189protected:
190 void componentComplete() override;
191 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
192 void itemChange(ItemChange change, const ItemChangeData &value) override;
193
194private:
195 Q_DECLARE_PRIVATE(QQuickMultiEffect)
196};
197
198QT_END_NAMESPACE
199
200#endif // QQUICKMULTIEFFECT_H
201

source code of qtdeclarative/src/effects/qquickmultieffect_p.h