summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-06 18:49:07 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-09 10:58:44 +0200
commit1a819c0ca5744d3537944126ff013686d5efbffe (patch)
tree89d55d7f662244b564c77047861b5ef015d10556
parentb7e24192352bee955d37a89fc061f1dafd32b73a (diff)
downloadqtgraphicaleffects-1a819c0ca5744d3537944126ff013686d5efbffe.tar.gz
Port 17 effects to RHI, remove 8 unportable ones
The following are based on static shader code, and after porting the shaders they will work fully identically to 5.15: FastBlur Colorize OpacityMask BrightnessContrast ColorOverlay Desaturate Displace GammaAdjust HueSaturation LevelAdjust RectangularGlow Thresholdmask LinearGradient RadialGradient ConicalGradient The following change behavior: Glow DropShadow These now only have the fast variants, because those rely on static shader code. So we are going back to the Qt 5.5 versions and make them behave as if 'fast' was always set to true. The 'fast' and 'samples' properties are removed. The following are removed: Blend GaussianBlur DirectionalBlur MaskedBlur RadialBlur RecursiveBlur ZoomBlur InnerShadow The autotest and the gallery application (run qmlscene testBed.qml in tests/manual/testbed) have been adjusted accordingly and now work across all QRhi backends. The docs may still refer to removed effects in some code snippets. Updating that is left as a separate exercise. [ChangeLog] Graphical Effects no longer relies on dynamically generated shader strings. The following effects have been removed: Blend, GaussianBlur, MaskedBlur, RadialBlur, RecursiveBlur, ZoomBlur, InnerShadow. Glow and DropShadow always use the 'fast' variant. The fast and samples properties for these are thus no longer applicable and have been removed. Change-Id: Ife83f3828f37977596fd34f8da8b61961f0ed28a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/effects/Blend.qml486
-rw-r--r--src/effects/BrightnessContrast.qml4
-rw-r--r--src/effects/CMakeLists.txt120
-rw-r--r--src/effects/ColorOverlay.qml4
-rw-r--r--src/effects/Colorize.qml4
-rw-r--r--src/effects/ConicalGradient.qml6
-rw-r--r--src/effects/Desaturate.qml4
-rw-r--r--src/effects/DirectionalBlur.qml293
-rw-r--r--src/effects/Displace.qml4
-rw-r--r--src/effects/DropShadow.qml155
-rw-r--r--src/effects/FastBlur.qml17
-rw-r--r--src/effects/GammaAdjust.qml4
-rw-r--r--src/effects/GaussianBlur.qml372
-rw-r--r--src/effects/Glow.qml144
-rw-r--r--src/effects/HueSaturation.qml4
-rw-r--r--src/effects/InnerShadow.qml386
-rw-r--r--src/effects/LevelAdjust.qml4
-rw-r--r--src/effects/LinearGradient.qml8
-rw-r--r--src/effects/MaskedBlur.qml218
-rw-r--r--src/effects/OpacityMask.qml4
-rw-r--r--src/effects/RadialBlur.qml316
-rw-r--r--src/effects/RadialGradient.qml8
-rw-r--r--src/effects/RectangularGlow.qml4
-rw-r--r--src/effects/RecursiveBlur.qml329
-rw-r--r--src/effects/ThresholdMask.qml4
-rw-r--r--src/effects/ZoomBlur.qml306
-rw-r--r--src/effects/effects_plugin.pro10
-rw-r--r--src/effects/private/CMakeLists.txt31
-rw-r--r--src/effects/private/DropShadowBase.qml99
-rw-r--r--src/effects/private/FastGlow.qml6
-rw-r--r--src/effects/private/FastInnerShadow.qml335
-rw-r--r--src/effects/private/FastMaskedBlur.qml247
-rw-r--r--src/effects/private/GaussianDirectionalBlur.qml289
-rw-r--r--src/effects/private/GaussianGlow.qml98
-rw-r--r--src/effects/private/GaussianInnerShadow.qml123
-rw-r--r--src/effects/private/GaussianMaskedBlur.qml104
-rw-r--r--src/effects/private/plugin.cpp7
-rw-r--r--src/effects/private/private.pro13
-rw-r--r--src/effects/private/qgfxshaderbuilder.cpp573
-rw-r--r--src/effects/private/qgfxshaderbuilder_p.h66
-rw-r--r--src/effects/private/qmldir7
-rw-r--r--src/effects/qmldir8
-rw-r--r--src/effects/qtgraphicaleffectsshaders.qrc86
-rw-r--r--src/effects/shaders/+glslcore/coloroverlay.frag10
-rw-r--r--src/effects/shaders/+glslcore/conicalgradient_mask.frag16
-rw-r--r--src/effects/shaders/+glslcore/conicalgradient_nomask.frag14
-rw-r--r--src/effects/shaders/+glslcore/desaturate.frag11
-rw-r--r--src/effects/shaders/+glslcore/displace.frag29
-rw-r--r--src/effects/shaders/+glslcore/fastblur.frag23
-rw-r--r--src/effects/shaders/+glslcore/fastblur_internal.frag16
-rw-r--r--src/effects/shaders/+glslcore/fastblur_internal.vert18
-rw-r--r--src/effects/shaders/+glslcore/fastglow.frag30
-rw-r--r--src/effects/shaders/+glslcore/fastinnershadow.frag32
-rw-r--r--src/effects/shaders/+glslcore/fastinnershadow_level0.frag15
-rw-r--r--src/effects/shaders/+glslcore/fastmaskedblur.frag53
-rw-r--r--src/effects/shaders/+glslcore/gammaadjust.frag13
-rw-r--r--src/effects/shaders/+glslcore/gaussianinnershadow.frag19
-rw-r--r--src/effects/shaders/+glslcore/gaussianinnershadow_shadow.frag15
-rw-r--r--src/effects/shaders/+glslcore/lineargradient.vert22
-rw-r--r--src/effects/shaders/+glslcore/lineargradient_mask.frag13
-rw-r--r--src/effects/shaders/+glslcore/lineargradient_nomask.frag9
-rw-r--r--src/effects/shaders/+glslcore/opacitymask.frag9
-rw-r--r--src/effects/shaders/+glslcore/opacitymask_invert.frag9
-rw-r--r--src/effects/shaders/+glslcore/radialgradient.vert31
-rw-r--r--src/effects/shaders/+glslcore/radialgradient_mask.frag14
-rw-r--r--src/effects/shaders/+glslcore/radialgradient_nomask.frag11
-rw-r--r--src/effects/shaders/+glslcore/rectangularglow.frag21
-rw-r--r--src/effects/shaders/+glslcore/recursiveblur.frag9
-rw-r--r--src/effects/shaders/+glslcore/recursiveblur.vert15
-rw-r--r--src/effects/shaders/+glslcore/thresholdmask.frag14
-rw-r--r--src/effects/shaders/brightnesscontrast.frag14
-rw-r--r--src/effects/shaders/colorize.frag58
-rw-r--r--src/effects/shaders/coloroverlay.frag8
-rw-r--r--src/effects/shaders/conicalgradient_mask.frag14
-rw-r--r--src/effects/shaders/conicalgradient_nomask.frag12
-rw-r--r--src/effects/shaders/desaturate.frag9
-rw-r--r--src/effects/shaders/displace.frag27
-rw-r--r--src/effects/shaders/fastblur.frag21
-rw-r--r--src/effects/shaders/fastblur_internal.frag14
-rw-r--r--src/effects/shaders/fastblur_internal.vert17
-rw-r--r--src/effects/shaders/fastglow.frag28
-rw-r--r--src/effects/shaders/fastinnershadow.frag30
-rw-r--r--src/effects/shaders/fastinnershadow_level0.frag13
-rw-r--r--src/effects/shaders/fastmaskedblur.frag51
-rw-r--r--src/effects/shaders/gammaadjust.frag10
-rw-r--r--src/effects/shaders/gaussianinnershadow.frag17
-rw-r--r--src/effects/shaders/gaussianinnershadow_shadow.frag13
-rw-r--r--src/effects/shaders/huesaturation.frag77
-rw-r--r--src/effects/shaders/leveladjust.frag35
-rw-r--r--src/effects/shaders/lineargradient.vert21
-rw-r--r--src/effects/shaders/lineargradient_mask.frag11
-rw-r--r--src/effects/shaders/lineargradient_nomask.frag7
-rw-r--r--src/effects/shaders/opacitymask.frag7
-rw-r--r--src/effects/shaders/opacitymask_invert.frag7
-rw-r--r--src/effects/shaders/radialgradient.vert30
-rw-r--r--src/effects/shaders/radialgradient_mask.frag12
-rw-r--r--src/effects/shaders/radialgradient_nomask.frag10
-rw-r--r--src/effects/shaders/rectangularglow.frag19
-rw-r--r--src/effects/shaders/recursiveblur.frag6
-rw-r--r--src/effects/shaders/recursiveblur.vert14
-rw-r--r--src/effects/shaders/thresholdmask.frag11
-rw-r--r--src/effects/shaders_ng/brightnesscontrast.frag (renamed from src/effects/shaders/+glslcore/brightnesscontrast.frag)25
-rw-r--r--src/effects/shaders_ng/brightnesscontrast.frag.qsbbin0 -> 2491 bytes
-rw-r--r--src/effects/shaders_ng/colorize.frag (renamed from src/effects/shaders/+glslcore/colorize.frag)48
-rw-r--r--src/effects/shaders_ng/colorize.frag.qsbbin0 -> 4482 bytes
-rw-r--r--src/effects/shaders_ng/coloroverlay.frag20
-rw-r--r--src/effects/shaders_ng/coloroverlay.frag.qsbbin0 -> 1908 bytes
-rw-r--r--src/effects/shaders_ng/compile.bat66
-rw-r--r--src/effects/shaders_ng/conicalgradient_mask.frag25
-rw-r--r--src/effects/shaders_ng/conicalgradient_mask.frag.qsbbin0 -> 2354 bytes
-rw-r--r--src/effects/shaders_ng/conicalgradient_nomask.frag23
-rw-r--r--src/effects/shaders_ng/conicalgradient_nomask.frag.qsbbin0 -> 2143 bytes
-rw-r--r--src/effects/shaders_ng/desaturate.frag21
-rw-r--r--src/effects/shaders_ng/desaturate.frag.qsbbin0 -> 1865 bytes
-rw-r--r--src/effects/shaders_ng/displace.frag39
-rw-r--r--src/effects/shaders_ng/displace.frag.qsbbin0 -> 3270 bytes
-rw-r--r--src/effects/shaders_ng/fastblur.frag32
-rw-r--r--src/effects/shaders_ng/fastblur.frag.qsbbin0 -> 2306 bytes
-rw-r--r--src/effects/shaders_ng/fastblur_internal.frag25
-rw-r--r--src/effects/shaders_ng/fastblur_internal.frag.qsbbin0 -> 1863 bytes
-rw-r--r--src/effects/shaders_ng/fastblur_internal.vert27
-rw-r--r--src/effects/shaders_ng/fastblur_internal.vert.qsbbin0 -> 2614 bytes
-rw-r--r--src/effects/shaders_ng/fastglow.frag40
-rw-r--r--src/effects/shaders_ng/fastglow.frag.qsbbin0 -> 2944 bytes
-rw-r--r--src/effects/shaders_ng/gammaadjust.frag22
-rw-r--r--src/effects/shaders_ng/gammaadjust.frag.qsbbin0 -> 1924 bytes
-rw-r--r--src/effects/shaders_ng/huesaturation.frag (renamed from src/effects/shaders/+glslcore/huesaturation.frag)46
-rw-r--r--src/effects/shaders_ng/huesaturation.frag.qsbbin0 -> 5549 bytes
-rw-r--r--src/effects/shaders_ng/leveladjust.frag (renamed from src/effects/shaders/+glslcore/leveladjust.frag)44
-rw-r--r--src/effects/shaders_ng/leveladjust.frag.qsbbin0 -> 3685 bytes
-rw-r--r--src/effects/shaders_ng/lineargradient.vert31
-rw-r--r--src/effects/shaders_ng/lineargradient.vert.qsbbin0 -> 2474 bytes
-rw-r--r--src/effects/shaders_ng/lineargradient_mask.frag23
-rw-r--r--src/effects/shaders_ng/lineargradient_mask.frag.qsbbin0 -> 1906 bytes
-rw-r--r--src/effects/shaders_ng/lineargradient_nomask.frag20
-rw-r--r--src/effects/shaders_ng/lineargradient_nomask.frag.qsbbin0 -> 1621 bytes
-rw-r--r--src/effects/shaders_ng/opacitymask.frag19
-rw-r--r--src/effects/shaders_ng/opacitymask.frag.qsbbin0 -> 1601 bytes
-rw-r--r--src/effects/shaders_ng/opacitymask_invert.frag19
-rw-r--r--src/effects/shaders_ng/opacitymask_invert.frag.qsbbin0 -> 1643 bytes
-rw-r--r--src/effects/shaders_ng/radialgradient.vert39
-rw-r--r--src/effects/shaders_ng/radialgradient.vert.qsbbin0 -> 2778 bytes
-rw-r--r--src/effects/shaders_ng/radialgradient_mask.frag25
-rw-r--r--src/effects/shaders_ng/radialgradient_mask.frag.qsbbin0 -> 2187 bytes
-rw-r--r--src/effects/shaders_ng/radialgradient_nomask.frag23
-rw-r--r--src/effects/shaders_ng/radialgradient_nomask.frag.qsbbin0 -> 1946 bytes
-rw-r--r--src/effects/shaders_ng/rectangularglow.frag30
-rw-r--r--src/effects/shaders_ng/rectangularglow.frag.qsbbin0 -> 2274 bytes
-rw-r--r--src/effects/shaders_ng/thresholdmask.frag23
-rw-r--r--src/effects/shaders_ng/thresholdmask.frag.qsbbin0 -> 2028 bytes
-rw-r--r--tests/auto/tst_qtgraphicaleffects.cpp241
-rw-r--r--tests/manual/testbed/ColorPicker.qml50
-rw-r--r--tests/manual/testbed/TestBedModel.qml8
-rw-r--r--tests/manual/testbed/TestBlend.qml204
-rw-r--r--tests/manual/testbed/TestDirectionalBlur.qml112
-rw-r--r--tests/manual/testbed/TestDropShadow.qml15
-rw-r--r--tests/manual/testbed/TestGaussianBlur.qml111
-rw-r--r--tests/manual/testbed/TestGlow.qml15
-rw-r--r--tests/manual/testbed/TestInnerShadow.qml143
-rw-r--r--tests/manual/testbed/TestMaskedBlur.qml141
-rw-r--r--tests/manual/testbed/TestRadialBlur.qml120
-rw-r--r--tests/manual/testbed/TestRecursiveBlur.qml107
-rw-r--r--tests/manual/testbed/TestZoomBlur.qml120
163 files changed, 877 insertions, 7689 deletions
diff --git a/src/effects/Blend.qml b/src/effects/Blend.qml
deleted file mode 100644
index e5f4816..0000000
--- a/src/effects/Blend.qml
+++ /dev/null
@@ -1,486 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype Blend
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-blend
- \brief Merges two source items by using a blend mode.
-
- Blend mode can be selected with the \l{Blend::mode}{mode} property.
-
- \table
- \header
- \li source
- \li foregroundSource
- \li Effect applied
- \row
- \li \image Original_bug.png
- \li \image Original_butterfly.png
- \li \image Blend_bug_and_butterfly.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example
-
- The following example shows how to apply the effect.
- \snippet Blend-example.qml example
-
-*/
-
-Item {
- id: rootItem
-
- /*!
- This property defines the source item that is going to be the base when
- \l{Blend::foregroundSource}{foregroundSource} is blended over it.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property variant source
-
- /*!
- This property defines the item that is going to be blended over the
- \l{Blend::source}{source}.
-
- \note It is not supported to let the effect include itself, for
- instance by setting foregroundSource to the effect's parent.
- */
- property variant foregroundSource
-
- /*!
- This property defines the mode which is used when foregroundSource is
- blended over source. Values are case insensitive.
-
- \table
- \header
- \li mode
- \li description
- \row
- \li normal
- \li The pixel component values from foregroundSource are written
- over source by using alpha blending.
- \row
- \li addition
- \li The pixel component values from source and foregroundSource are
- added together and written.
- \row
- \li average
- \li The pixel component values from source and foregroundSource are
- averaged and written.
- \row
- \li color
- \li The lightness value from source is combined with hue and
- saturation from foregroundSource and written.
- \row
- \li colorBurn
- \li The darker pixels from source are darkened more, if both source
- and foregroundSource pixels are light the result is light.
- \row
- \li colorDodge
- \li The lighter pixels from source are lightened more, if both
- source and foregroundSource pixels are dark the result is dark.
- \row
- \li darken
- \li The darker pixel component value from source and
- foregroundSource is written.
- \row
- \li darkerColor
- \li The lower luminance pixel rgb-value from source and
- foregroundSource is written.
- \row
- \li difference
- \li The absolute pixel component value difference between source and
- foregroundSource is written.
- \row
- \li divide
- \li The pixel component values from source is divided by the value
- from foregroundSource and written.
- \row
- \li exclusion
- \li The pixel component value difference with reduced contrast
- between source and foregroundSource is written.
- \row
- \li hardLight
- \li The pixel component values from source are lightened or darkened
- according to foregroundSource values and written.
- \row
- \li hue
- \li The hue value from foregroundSource is combined with saturation
- and lightness from source and written.
- \row
- \li lighten
- \li The lightest pixel component value from source and
- foregroundSource is written.
- \row
- \li lighterColor
- \li The higher luminance pixel rgb-value from source and
- foregroundSource is written.
- \row
- \li lightness
- \li The lightness value from foregroundSource is combined with hue
- and saturation from source and written.
- \row
- \li multiply
- \li The pixel component values from source and foregroundSource are
- multiplied together and written.
- \row
- \li negation
- \li The inverted absolute pixel component value difference between
- source and foregroundSource is written.
- \row
- \li saturation
- \li The saturation value from foregroundSource is combined with hue
- and lightness from source and written.
- \row
- \li screen
- \li The pixel values from source and foregroundSource are negated,
- then multiplied, negated again, and written.
- \row
- \li subtract
- \li Pixel value from foregroundSource is subracted from source and
- written.
- \row
- \li softLight
- \li The pixel component values from source are lightened or darkened
- slightly according to foregroundSource values and written.
-
- \endtable
-
- \table
- \header
- \li Example source
- \li Example foregroundSource
- \row
- \li \image Original_bug.png
- \li \image Original_butterfly.png
- \endtable
-
- \table
- \header
- \li Output examples with different mode values
- \li
- \li
- \row
- \li \image Blend_mode1.png
- \li \image Blend_mode2.png
- \li \image Blend_mode3.png
- \row
- \li \b { mode: normal }
- \li \b { mode: addition }
- \li \b { mode: average }
- \row
- \li \image Blend_mode4.png
- \li \image Blend_mode5.png
- \li \image Blend_mode6.png
- \row
- \li \b { mode: color }
- \li \b { mode: colorBurn }
- \li \b { mode: colorDodge }
- \row
- \li \image Blend_mode7.png
- \li \image Blend_mode8.png
- \li \image Blend_mode9.png
- \row
- \li \b { mode: darken }
- \li \b { mode: darkerColor }
- \li \b { mode: difference }
- \row
- \li \image Blend_mode10.png
- \li \image Blend_mode11.png
- \li \image Blend_mode12.png
- \row
- \li \b { mode: divide }
- \li \b { mode: exclusion }
- \li \b { mode: hardlight }
- \row
- \li \image Blend_mode13.png
- \li \image Blend_mode14.png
- \li \image Blend_mode15.png
- \row
- \li \b { mode: hue }
- \li \b { mode: lighten }
- \li \b { mode: lighterColor }
- \row
- \li \image Blend_mode16.png
- \li \image Blend_mode17.png
- \li \image Blend_mode18.png
- \row
- \li \b { mode: lightness }
- \li \b { mode: negation }
- \li \b { mode: multiply }
- \row
- \li \image Blend_mode19.png
- \li \image Blend_mode20.png
- \li \image Blend_mode21.png
- \row
- \li \b { mode: saturation }
- \li \b { mode: screen }
- \li \b { mode: subtract }
- \row
- \li \image Blend_mode22.png
- \row
- \li \b { mode: softLight }
- \endtable
- */
- property string mode: "normal"
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance.
-
- Every time the source or effect properties are changed, the pixels in the
- cache must be updated. Memory consumption is increased, because an extra
- buffer of memory is required for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to false.
-
- */
- property bool cached: false
-
- SourceProxy {
- id: backgroundSourceProxy
- input: rootItem.source
- }
-
- SourceProxy {
- id: foregroundSourceProxy
- input: rootItem.foregroundSource
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: parent
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- ShaderEffect {
- id: shaderItem
- property variant backgroundSource: backgroundSourceProxy.output
- property variant foregroundSource: foregroundSourceProxy.output
- property string mode: rootItem.mode
- anchors.fill: parent
-
- fragmentShader: fragmentShaderBegin + blendModeNormal + fragmentShaderEnd
-
- function buildFragmentShader() {
- var shader = fragmentShaderBegin
-
- switch (mode.toLowerCase()) {
- case "addition" : shader += blendModeAddition; break;
- case "average" : shader += blendModeAverage; break;
- case "color" : shader += blendModeColor; break;
- case "colorburn" : shader += blendModeColorBurn; break;
- case "colordodge" : shader += blendModeColorDodge; break;
- case "darken" : shader += blendModeDarken; break;
- case "darkercolor" : shader += blendModeDarkerColor; break;
- case "difference" : shader += blendModeDifference; break;
- case "divide" : shader += blendModeDivide; break;
- case "exclusion" : shader += blendModeExclusion; break;
- case "hardlight" : shader += blendModeHardLight; break;
- case "hue" : shader += blendModeHue; break;
- case "lighten" : shader += blendModeLighten; break;
- case "lightercolor" : shader += blendModeLighterColor; break;
- case "lightness" : shader += blendModeLightness; break;
- case "negation" : shader += blendModeNegation; break;
- case "normal" : shader += blendModeNormal; break;
- case "multiply" : shader += blendModeMultiply; break;
- case "saturation" : shader += blendModeSaturation; break;
- case "screen" : shader += blendModeScreen; break;
- case "subtract" : shader += blendModeSubtract; break;
- case "softlight" : shader += blendModeSoftLight; break;
- default: shader += "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);"; break;
- }
-
- shader += fragmentShaderEnd
- fragmentShader = shader
-
- // Workaraound for a bug just to make sure display gets updated when the mode changes.
- backgroundSourceChanged()
- }
-
- Component.onCompleted: {
- buildFragmentShader()
- }
-
- onModeChanged: {
- buildFragmentShader()
- }
-
- property string blendModeAddition: "result.rgb = min(rgb1 + rgb2, 1.0);"
- property string blendModeAverage: "result.rgb = 0.5 * (rgb1 + rgb2);"
- property string blendModeColor: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).xy, RGBtoL(rgb1)));"
- property string blendModeColorBurn: "result.rgb = clamp(1.0 - ((1.0 - rgb1) / max(vec3(1.0 / 256.0), rgb2)), vec3(0.0), vec3(1.0));"
- property string blendModeColorDodge: "result.rgb = clamp(rgb1 / max(vec3(1.0 / 256.0), (1.0 - rgb2)), vec3(0.0), vec3(1.0));"
- property string blendModeDarken: "result.rgb = min(rgb1, rgb2);"
- property string blendModeDarkerColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb2 : rgb1;"
- property string blendModeDifference: "result.rgb = abs(rgb1 - rgb2);"
- property string blendModeDivide: "result.rgb = clamp(rgb1 / rgb2, 0.0, 1.0);"
- property string blendModeExclusion: "result.rgb = rgb1 + rgb2 - 2.0 * rgb1 * rgb2;"
- property string blendModeHardLight: "result.rgb = vec3(channelBlendHardLight(rgb1.r, rgb2.r), channelBlendHardLight(rgb1.g, rgb2.g), channelBlendHardLight(rgb1.b, rgb2.b));"
- property string blendModeHue: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).x, RGBtoHSL(rgb1).yz));"
- property string blendModeLighten: "result.rgb = max(rgb1, rgb2);"
- property string blendModeLighterColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb1 : rgb2;"
- property string blendModeLightness: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb1).xy, RGBtoL(rgb2)));"
- property string blendModeMultiply: "result.rgb = rgb1 * rgb2;"
- property string blendModeNegation: "result.rgb = 1.0 - abs(1.0 - rgb1 - rgb2);"
- property string blendModeNormal: "result.rgb = rgb2; a = max(color1.a, color2.a);"
- property string blendModeSaturation: "lowp vec3 hsl1 = RGBtoHSL(rgb1); result.rgb = HSLtoRGB(vec3(hsl1.x, RGBtoHSL(rgb2).y, hsl1.z));"
- property string blendModeScreen: "result.rgb = 1.0 - (vec3(1.0) - rgb1) * (vec3(1.0) - rgb2);"
- property string blendModeSubtract: "result.rgb = max(rgb1 - rgb2, vec3(0.0));"
- property string blendModeSoftLight: "result.rgb = rgb1 * ((1.0 - rgb1) * rgb2 + (1.0 - (1.0 - rgb1) * (1.0 - rgb2)));"
-
- property string fragmentCoreShaderWorkaround: (GraphicsInfo.profile === GraphicsInfo.OpenGLCoreProfile ? "#version 150 core
- #define varying in
- #define texture2D texture
- out vec4 fragColor;
- #define gl_FragColor fragColor
- " : "")
-
- property string fragmentShaderBegin: fragmentCoreShaderWorkaround + "
- varying mediump vec2 qt_TexCoord0;
- uniform highp float qt_Opacity;
- uniform lowp sampler2D backgroundSource;
- uniform lowp sampler2D foregroundSource;
-
- highp float RGBtoL(highp vec3 color) {
- highp float cmin = min(color.r, min(color.g, color.b));
- highp float cmax = max(color.r, max(color.g, color.b));
- highp float l = (cmin + cmax) / 2.0;
- return l;
- }
-
- highp vec3 RGBtoHSL(highp vec3 color) {
- highp float cmin = min(color.r, min(color.g, color.b));
- highp float cmax = max(color.r, max(color.g, color.b));
- highp float h = 0.0;
- highp float s = 0.0;
- highp float l = (cmin + cmax) / 2.0;
- highp float diff = cmax - cmin;
-
- if (diff > 1.0 / 256.0) {
- if (l < 0.5)
- s = diff / (cmin + cmax);
- else
- s = diff / (2.0 - (cmin + cmax));
-
- if (color.r == cmax)
- h = (color.g - color.b) / diff;
- else if (color.g == cmax)
- h = 2.0 + (color.b - color.r) / diff;
- else
- h = 4.0 + (color.r - color.g) / diff;
-
- h /= 6.0;
- }
- return vec3(h, s, l);
- }
-
- highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
- h = fract(h);
- if (h < 1.0 / 6.0)
- return v1 + (v2 - v1) * 6.0 * h;
- else if (h < 1.0 / 2.0)
- return v2;
- else if (h < 2.0 / 3.0)
- return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
-
- return v1;
- }
-
- highp vec3 HSLtoRGB(highp vec3 color) {
- highp float h = color.x;
- highp float l = color.z;
- highp float s = color.y;
-
- if (s < 1.0 / 256.0)
- return vec3(l, l, l);
-
- highp float v1;
- highp float v2;
- if (l < 0.5)
- v2 = l * (1.0 + s);
- else
- v2 = (l + s) - (s * l);
-
- v1 = 2.0 * l - v2;
-
- highp float d = 1.0 / 3.0;
- highp float r = hueToIntensity(v1, v2, h + d);
- highp float g = hueToIntensity(v1, v2, h);
- highp float b = hueToIntensity(v1, v2, h - d);
- return vec3(r, g, b);
- }
-
- lowp float channelBlendHardLight(lowp float c1, lowp float c2) {
- return c2 > 0.5 ? (1.0 - (1.0 - 2.0 * (c2 - 0.5)) * (1.0 - c1)) : (2.0 * c1 * c2);
- }
-
- void main() {
- lowp vec4 result = vec4(0.0);
- lowp vec4 color1 = texture2D(backgroundSource, qt_TexCoord0);
- lowp vec4 color2 = texture2D(foregroundSource, qt_TexCoord0);
- lowp vec3 rgb1 = color1.rgb / max(1.0/256.0, color1.a);
- lowp vec3 rgb2 = color2.rgb / max(1.0/256.0, color2.a);
- highp float a = max(color1.a, color1.a * color2.a);
- "
-
- property string fragmentShaderEnd: "
- gl_FragColor.rgb = mix(rgb1, result.rgb, color2.a);
- gl_FragColor.rbg *= a;
- gl_FragColor.a = a;
- gl_FragColor *= qt_Opacity;
- }
- "
- }
-}
diff --git a/src/effects/BrightnessContrast.qml b/src/effects/BrightnessContrast.qml
index 85b38bb..1f24953 100644
--- a/src/effects/BrightnessContrast.qml
+++ b/src/effects/BrightnessContrast.qml
@@ -62,8 +62,6 @@ import QtGraphicalEffects.private 1.12
\li \image BrightnessContrast_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -189,6 +187,6 @@ Item {
anchors.fill: parent
blending: !rootItem.cached
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/brightnesscontrast.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/brightnesscontrast.frag.qsb"
}
}
diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt
index 14c9213..d81355a 100644
--- a/src/effects/CMakeLists.txt
+++ b/src/effects/CMakeLists.txt
@@ -21,68 +21,30 @@ add_qml_module(qtgraphicaleffectsplugin
# Resources:
set(qtgraphicaleffectsshaders_resource_files
- "shaders/+glslcore/brightnesscontrast.frag"
- "shaders/+glslcore/colorize.frag"
- "shaders/+glslcore/coloroverlay.frag"
- "shaders/+glslcore/conicalgradient_mask.frag"
- "shaders/+glslcore/conicalgradient_nomask.frag"
- "shaders/+glslcore/desaturate.frag"
- "shaders/+glslcore/displace.frag"
- "shaders/+glslcore/fastblur.frag"
- "shaders/+glslcore/fastblur_internal.frag"
- "shaders/+glslcore/fastblur_internal.vert"
- "shaders/+glslcore/fastglow.frag"
- "shaders/+glslcore/fastinnershadow.frag"
- "shaders/+glslcore/fastinnershadow_level0.frag"
- "shaders/+glslcore/fastmaskedblur.frag"
- "shaders/+glslcore/gammaadjust.frag"
- "shaders/+glslcore/gaussianinnershadow.frag"
- "shaders/+glslcore/gaussianinnershadow_shadow.frag"
- "shaders/+glslcore/huesaturation.frag"
- "shaders/+glslcore/leveladjust.frag"
- "shaders/+glslcore/lineargradient.vert"
- "shaders/+glslcore/lineargradient_mask.frag"
- "shaders/+glslcore/lineargradient_nomask.frag"
- "shaders/+glslcore/opacitymask.frag"
- "shaders/+glslcore/opacitymask_invert.frag"
- "shaders/+glslcore/radialgradient.vert"
- "shaders/+glslcore/radialgradient_mask.frag"
- "shaders/+glslcore/radialgradient_nomask.frag"
- "shaders/+glslcore/rectangularglow.frag"
- "shaders/+glslcore/recursiveblur.frag"
- "shaders/+glslcore/recursiveblur.vert"
- "shaders/+glslcore/thresholdmask.frag"
- "shaders/brightnesscontrast.frag"
- "shaders/colorize.frag"
- "shaders/coloroverlay.frag"
- "shaders/conicalgradient_mask.frag"
- "shaders/conicalgradient_nomask.frag"
- "shaders/desaturate.frag"
- "shaders/displace.frag"
- "shaders/fastblur.frag"
- "shaders/fastblur_internal.frag"
- "shaders/fastblur_internal.vert"
- "shaders/fastglow.frag"
- "shaders/fastinnershadow.frag"
- "shaders/fastinnershadow_level0.frag"
- "shaders/fastmaskedblur.frag"
- "shaders/gammaadjust.frag"
- "shaders/gaussianinnershadow.frag"
- "shaders/gaussianinnershadow_shadow.frag"
- "shaders/huesaturation.frag"
- "shaders/leveladjust.frag"
- "shaders/lineargradient.vert"
- "shaders/lineargradient_mask.frag"
- "shaders/lineargradient_nomask.frag"
- "shaders/opacitymask.frag"
- "shaders/opacitymask_invert.frag"
- "shaders/radialgradient.vert"
- "shaders/radialgradient_mask.frag"
- "shaders/radialgradient_nomask.frag"
- "shaders/rectangularglow.frag"
- "shaders/recursiveblur.frag"
- "shaders/recursiveblur.vert"
- "shaders/thresholdmask.frag"
+ "shaders_ng/brightnesscontrast.frag.qsb"
+ "shaders_ng/colorize.frag.qsb"
+ "shaders_ng/coloroverlay.frag.qsb"
+ "shaders_ng/conicalgradient_mask.frag.qsb"
+ "shaders_ng/conicalgradient_nomask.frag.qsb"
+ "shaders_ng/desaturate.frag.qsb"
+ "shaders_ng/displace.frag.qsb"
+ "shaders_ng/fastblur.frag.qsb"
+ "shaders_ng/fastblur_internal.frag.qsb"
+ "shaders_ng/fastblur_internal.vert.qsb"
+ "shaders_ng/fastglow.frag.qsb"
+ "shaders_ng/gammaadjust.frag.qsb"
+ "shaders_ng/huesaturation.frag.qsb"
+ "shaders_ng/leveladjust.frag.qsb"
+ "shaders_ng/lineargradient.vert.qsb"
+ "shaders_ng/lineargradient_mask.frag.qsb"
+ "shaders_ng/lineargradient_nomask.frag.qsb"
+ "shaders_ng/opacitymask.frag.qsb"
+ "shaders_ng/opacitymask_invert.frag.qsb"
+ "shaders_ng/radialgradient.vert.qsb"
+ "shaders_ng/radialgradient_mask.frag.qsb"
+ "shaders_ng/radialgradient_nomask.frag.qsb"
+ "shaders_ng/rectangularglow.frag.qsb"
+ "shaders_ng/thresholdmask.frag.qsb"
)
add_qt_resource(qtgraphicaleffectsplugin "qtgraphicaleffectsshaders"
@@ -96,38 +58,27 @@ add_qt_resource(qtgraphicaleffectsplugin "qtgraphicaleffectsshaders"
#### Keys ignored in scope 2:.:.:effects_plugin.pro:<TRUE>:
# CXX_MODULE = "qml"
# IMPORT_VERSION = "1.$$QT_MINOR_VERSION"
-# QML_FILES = "Blend.qml" "BrightnessContrast.qml" "ColorOverlay.qml" "Colorize.qml" "ConicalGradient.qml" "Desaturate.qml" "DirectionalBlur.qml" "Displace.qml" "DropShadow.qml" "FastBlur.qml" "GammaAdjust.qml" "GaussianBlur.qml" "Glow.qml" "HueSaturation.qml" "InnerShadow.qml" "LevelAdjust.qml" "LinearGradient.qml" "MaskedBlur.qml" "OpacityMask.qml" "RadialBlur.qml" "RadialGradient.qml" "RectangularGlow.qml" "RecursiveBlur.qml" "ThresholdMask.qml" "ZoomBlur.qml"
+# QML_FILES = "BrightnessContrast.qml" "ColorOverlay.qml" "Colorize.qml" "ConicalGradient.qml" "Desaturate.qml" "Displace.qml" "DropShadow.qml" "FastBlur.qml" "GammaAdjust.qml" "Glow.qml" "HueSaturation.qml" "LevelAdjust.qml" "LinearGradient.qml" "OpacityMask.qml" "RadialGradient.qml" "RectangularGlow.qml" "ThresholdMask.qml"
# TARGETPATH = "QtGraphicalEffects"
set(qml_files
- "Blend.qml"
"BrightnessContrast.qml"
"ColorOverlay.qml"
"Colorize.qml"
"ConicalGradient.qml"
"Desaturate.qml"
- "DirectionalBlur.qml"
"Displace.qml"
"DropShadow.qml"
"FastBlur.qml"
"GammaAdjust.qml"
- "GaussianBlur.qml"
"Glow.qml"
"HueSaturation.qml"
- "InnerShadow.qml"
"LevelAdjust.qml"
"LinearGradient.qml"
- "MaskedBlur.qml"
"OpacityMask.qml"
- "RadialBlur.qml"
"RadialGradient.qml"
"RectangularGlow.qml"
- "RecursiveBlur.qml"
"ThresholdMask.qml"
- "ZoomBlur.qml"
-)
-set_source_files_properties(Blend.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
)
set_source_files_properties(BrightnessContrast.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
@@ -144,9 +95,6 @@ set_source_files_properties(ConicalGradient.qml PROPERTIES
set_source_files_properties(Desaturate.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(DirectionalBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
set_source_files_properties(Displace.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
@@ -159,48 +107,30 @@ set_source_files_properties(FastBlur.qml PROPERTIES
set_source_files_properties(GammaAdjust.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(GaussianBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
set_source_files_properties(Glow.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
set_source_files_properties(HueSaturation.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(InnerShadow.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
set_source_files_properties(LevelAdjust.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
set_source_files_properties(LinearGradient.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(MaskedBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
set_source_files_properties(OpacityMask.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(RadialBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
set_source_files_properties(RadialGradient.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
set_source_files_properties(RectangularGlow.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(RecursiveBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
set_source_files_properties(ThresholdMask.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(ZoomBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
qt6_target_qml_files(qtgraphicaleffectsplugin
FILES
diff --git a/src/effects/ColorOverlay.qml b/src/effects/ColorOverlay.qml
index f348541..d30d7ca 100644
--- a/src/effects/ColorOverlay.qml
+++ b/src/effects/ColorOverlay.qml
@@ -60,8 +60,6 @@ import QtGraphicalEffects.private 1.12
\li \image ColorOverlay_butterfly.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -143,6 +141,6 @@ Item {
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/coloroverlay.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/coloroverlay.frag.qsb"
}
}
diff --git a/src/effects/Colorize.qml b/src/effects/Colorize.qml
index 42f1796..1348dbf 100644
--- a/src/effects/Colorize.qml
+++ b/src/effects/Colorize.qml
@@ -67,8 +67,6 @@ import QtGraphicalEffects.private 1.12
\li \image Colorize_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -232,7 +230,7 @@ Item {
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/colorize.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/colorize.frag.qsb"
}
}
diff --git a/src/effects/ConicalGradient.qml b/src/effects/ConicalGradient.qml
index c8d68b1..a5bed79 100644
--- a/src/effects/ConicalGradient.qml
+++ b/src/effects/ConicalGradient.qml
@@ -59,8 +59,6 @@ import QtGraphicalEffects.private 1.12
\li \image ConicalGradient.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -327,7 +325,7 @@ Gradient {
onFragmentShaderChanged: startAngleChanged()
- property string noMaskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/conicalgradient_nomask.frag"
- property string maskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/conicalgradient_mask.frag"
+ property string noMaskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/conicalgradient_nomask.frag.qsb"
+ property string maskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/conicalgradient_mask.frag.qsb"
}
}
diff --git a/src/effects/Desaturate.qml b/src/effects/Desaturate.qml
index e56de55..d11e76d 100644
--- a/src/effects/Desaturate.qml
+++ b/src/effects/Desaturate.qml
@@ -60,8 +60,6 @@ import QtGraphicalEffects.private 1.12
\li \image Desaturate_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -142,6 +140,6 @@ Item {
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/desaturate.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/desaturate.frag.qsb"
}
}
diff --git a/src/effects/DirectionalBlur.qml b/src/effects/DirectionalBlur.qml
deleted file mode 100644
index 42ea078..0000000
--- a/src/effects/DirectionalBlur.qml
+++ /dev/null
@@ -1,293 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype DirectionalBlur
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-motion-blur
- \brief Applies blur effect to the specified direction.
-
- Effect creates perceived impression that the source item appears to be
- moving in the direction of the blur. Blur is applied to both sides of
- each pixel, therefore setting the direction to 0 and 180 provides the
- same result.
-
- Other available motionblur effects are \l{QtGraphicalEffects::ZoomBlur}{ZoomBlur} and
- \l{QtGraphicalEffects::RadialBlur}{RadialBlur}.
-
- \table
- \header
- \li Source
- \li Effect applied
- \row
- \li \image Original_bug.png
- \li \image DirectionalBlur_bug.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example
-
- The following example shows how to apply the effect.
- \snippet DirectionalBlur-example.qml example
-
-*/
-Item {
- id: rootItem
-
- /*!
- This property defines the source item that is going to be blurred.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property variant source
-
- /*!
- This property defines the perceived amount of movement for each pixel.
- The movement is divided evenly to both sides of each pixel.
-
- The quality of the blur depends on \l{DirectionalBlur::samples}{samples}
- property. If length value is large, more samples are needed to keep the
- visual quality at high level.
-
- The value ranges from 0.0 to inf.
- By default the property is set to \c 0.0 (no blur).
-
- \table
- \header
- \li Output examples with different length values
- \li
- \li
- \row
- \li \image DirectionalBlur_length1.png
- \li \image DirectionalBlur_length2.png
- \li \image DirectionalBlur_length3.png
- \row
- \li \b { length: 0.0 }
- \li \b { length: 32.0 }
- \li \b { length: 48.0 }
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l angle: 0
- \li \l angle: 0
- \li \l angle: 0
- \endtable
-
- */
- property real length: 0.0
-
- /*!
- This property defines how many samples are taken per pixel when blur
- calculation is done. Larger value produces better quality, but is slower
- to render.
-
- This property is not intended to be animated. Changing this property may
- cause the underlying OpenGL shaders to be recompiled.
-
- Allowed values are between 0 and inf (practical maximum depends on GPU).
- By default the property is set to \c 0 (no samples).
-
- */
- property int samples: 0
-
- /*!
- This property defines the direction for the blur. Blur is applied to
- both sides of each pixel, therefore setting the direction to 0 and 180
- produces the same result.
-
- The value ranges from -180.0 to 180.0.
- By default the property is set to \c 0.0.
-
- \table
- \header
- \li Output examples with different angle values
- \li
- \li
- \row
- \li \image DirectionalBlur_angle1.png
- \li \image DirectionalBlur_angle2.png
- \li \image DirectionalBlur_angle3.png
- \row
- \li \b { angle: 0.0 }
- \li \b { angle: 45.0 }
- \li \b { angle: 90.0 }
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l length: 32
- \li \l length: 32
- \li \l length: 32
- \endtable
-
- */
- property real angle: 0.0
-
- /*!
- This property defines the blur behavior near the edges of the item,
- where the pixel blurring is affected by the pixels outside the source
- edges.
-
- If the property is set to \c true, the pixels outside the source are
- interpreted to be transparent, which is similar to OpenGL
- clamp-to-border extension. The blur is expanded slightly outside the
- effect item area.
-
- If the property is set to \c false, the pixels outside the source are
- interpreted to contain the same color as the pixels at the edge of the
- item, which is similar to OpenGL clamp-to-edge behavior. The blur does
- not expand outside the effect item area.
-
- By default, the property is set to \c false.
-
- */
- property bool transparentBorder: false
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance.
-
- Every time the source or effect properties are changed, the pixels in
- the cache must be updated. Memory consumption is increased, because an
- extra buffer of memory is required for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to \c false.
-
- */
- property bool cached: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: shaderItem
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- ShaderEffect {
- id: shaderItem
- property variant source: sourceProxy.output
- property real len: rootItem.length
- property bool transparentBorder: rootItem.transparentBorder
- property real samples: rootItem.samples
- property real weight: 1.0 / Math.max(1.0, rootItem.samples)
- property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
- property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
- property variant delta: Qt.size(1.0 / rootItem.width * Math.cos((rootItem.angle + 90) * Math.PI/180), 1.0 / rootItem.height * Math.sin((rootItem.angle + 90) * Math.PI/180))
-
- x: transparentBorder ? -expandPixels.width - 1: 0
- y: transparentBorder ? -expandPixels.height - 1 : 0
- width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
- height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
-
- property string fragmentShaderSkeleton: "
- varying highp vec2 qt_TexCoord0;
- uniform highp float qt_Opacity;
- uniform lowp sampler2D source;
- uniform highp float len;
- uniform highp float samples;
- uniform highp float weight;
- uniform highp vec2 expand;
- uniform highp vec2 delta;
-
- void main(void) {
- highp vec2 shift = delta * len / max(1.0, samples - 1.0);
- mediump vec2 texCoord = qt_TexCoord0;
- gl_FragColor = vec4(0.0);
-
- PLACEHOLDER_EXPAND_STEPS
-
- texCoord -= shift * max(0.0, samples - 1.0) * 0.5;
-
- PLACEHOLDER_UNROLLED_LOOP
-
- gl_FragColor *= weight * qt_Opacity;
- }
- "
-
- function buildFragmentShader() {
- var shader = ""
- if (GraphicsInfo.profile === GraphicsInfo.OpenGLCoreProfile)
- shader += "#version 150 core\n#define varying in\n#define texture2D texture\nout vec4 fragColor;\n#define gl_FragColor fragColor\n"
- shader += fragmentShaderSkeleton
- var expandSteps = ""
-
- if (transparentBorder) {
- expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
- }
-
- var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
-
- if (rootItem.samples > 1) {
- unrolledLoop = ""
- for (var i = 0; i < rootItem.samples; i++)
- unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n"
- }
-
- shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
- fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
- }
-
- onFragmentShaderChanged: sourceChanged()
- onSamplesChanged: buildFragmentShader()
- onTransparentBorderChanged: buildFragmentShader()
- Component.onCompleted: buildFragmentShader()
- }
-}
diff --git a/src/effects/Displace.qml b/src/effects/Displace.qml
index 3400222..0e44b31 100644
--- a/src/effects/Displace.qml
+++ b/src/effects/Displace.qml
@@ -60,8 +60,6 @@ import QtGraphicalEffects.private 1.12
\li \image Displace_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -185,6 +183,6 @@ Item {
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/displace.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/displace.frag.qsb"
}
}
diff --git a/src/effects/DropShadow.qml b/src/effects/DropShadow.qml
index 0f30e5a..1863f4f 100644
--- a/src/effects/DropShadow.qml
+++ b/src/effects/DropShadow.qml
@@ -47,14 +47,9 @@ import QtGraphicalEffects.private 1.12
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-drop-shadow
-
- \brief Generates a soft shadow behind the source item.
-
- The DropShadow effect blurs the alpha channel of the input, colorizes the
- result and places it behind the source object to create a soft shadow. The
- shadow's color can be changed using the \l {DropShadow::color}{color}
- property. The location of the shadow can be changed with the \l
- horizontalOffset and \l verticalOffset properties.
+ \brief Generates a colorized and blurred shadow image of the
+ source and places it behind the original, giving the impression that
+ source item is raised from the background.
\table
\header
@@ -65,16 +60,6 @@ import QtGraphicalEffects.private 1.12
\li \image DropShadow_butterfly.png
\endtable
- The soft shadow is created by blurring the image live using a gaussian
- blur. Performing blur live is a costly operation. Fullscreen gaussian blur
- with even a moderate number of samples will only run at 60 fps on highend
- graphics hardware.
-
- When the source is static, the \l cached property can be set to allocate
- another buffer to avoid performing the blur every time it is drawn.
-
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -82,12 +67,7 @@ import QtGraphicalEffects.private 1.12
*/
Item {
- id: root
-
- DropShadowBase {
- id: dbs
- anchors.fill: parent
- }
+ id: rootItem
/*!
This property defines the source item that is going to be used as the
@@ -96,26 +76,14 @@ Item {
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
- property alias source: dbs.source
+ property variant source
/*!
- \qmlproperty int DropShadow::radius
-
Radius defines the softness of the shadow. A larger radius causes the
edges of the shadow to appear more blurry.
- The ideal blur is achieved by selecting \c samples and \c radius such
- that \c {samples = 1 + radius * 2}, such as:
-
- \table
- \header \li Radius \li Samples
- \row \li 0 \e{(no blur)} \li 1
- \row \li 1 \li 3
- \row \li 2 \li 5
- \row \li 3 \li 7
- \endtable
-
- By default, the property is set to \c {floor(samples/2)}.
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
\table
\header
@@ -131,10 +99,6 @@ Item {
\li \b { radius: 6 }
\li \b { radius: 12 }
\row
- \li \l samples: 25
- \li \l samples: 25
- \li \l samples: 25
- \row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
@@ -151,31 +115,9 @@ Item {
\li \l spread: 0
\li \l spread: 0
\endtable
- */
- property alias radius: dbs.radius;
-
- /*!
- This property defines how many samples are taken per pixel when edge
- softening blur calculation is done. Larger value produces better
- quality, but is slower to render.
-
- Ideally, this value should be twice as large as the highest required
- radius value plus one, such as:
-
- \table
- \header \li Radius \li Samples
- \row \li 0 \e{(no blur)} \li 1
- \row \li 1 \li 3
- \row \li 2 \li 5
- \row \li 3 \li 7
- \endtable
-
- By default, the property is set to \c 9.
- This property is not intended to be animated. Changing this property will
- cause the underlying OpenGL shaders to be recompiled.
*/
- property alias samples: dbs.samples
+ property real radius: 0.0
/*!
This property defines the RGBA color value which is used for the shadow.
@@ -200,10 +142,6 @@ Item {
\li \l radius: 8
\li \l radius: 8
\row
- \li \l samples: 17
- \li \l samples: 17
- \li \l samples: 17
- \row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
@@ -216,12 +154,13 @@ Item {
\li \l spread: 0
\li \l spread: 0
\endtable
+
*/
- property alias color: dbs.color
+ property color color: "black"
/*!
- \qmlproperty real QtGraphicalEffects::DropShadow::horizontalOffset
- \qmlproperty real QtGraphicalEffects::DropShadow::verticalOffset
+ \qmlproperty real QtGraphicalEffects1::DropShadow::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::DropShadow::verticalOffset
HorizontalOffset and verticalOffset properties define the offset for the
rendered shadow compared to the DropShadow item position. Often, the
@@ -252,10 +191,6 @@ Item {
\li \l radius: 4
\li \l radius: 4
\row
- \li \l samples: 9
- \li \l samples: 9
- \li \l samples: 9
- \row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
@@ -268,16 +203,17 @@ Item {
\li \l spread: 0
\li \l spread: 0
\endtable
+
*/
- property alias horizontalOffset: dbs.horizontalOffset
- property alias verticalOffset: dbs.verticalOffset
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
/*!
- This property defines how large part of the shadow color is strengthened
+ This property defines how large part of the shadow color is strenghtened
near the source edges.
The value ranges from 0.0 to 1.0. By default, the property is set to \c
- 0.0.
+ 0.5.
\table
\header
@@ -297,10 +233,6 @@ Item {
\li \l radius: 8
\li \l radius: 8
\row
- \li \l samples: 17
- \li \l samples: 17
- \li \l samples: 17
- \row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
@@ -313,18 +245,9 @@ Item {
\li \l verticalOffset: 20
\li \l verticalOffset: 20
\endtable
- */
- property alias spread: dbs.spread
-
- /*!
- \internal
- Starting Qt 5.6, this property has no effect. It is left here
- for source compatibility only.
-
- ### Qt 6: remove
*/
- property bool fast: false
+ property real spread: 0.0
/*!
This property allows the effect output pixels to be cached in order to
@@ -337,8 +260,9 @@ Item {
properties are animated.
By default, the property is set to \c false.
+
*/
- property alias cached: dbs.cached
+ property bool cached: false
/*!
This property determines whether or not the effect has a transparent
@@ -347,16 +271,45 @@ Item {
When set to \c true, the exterior of the item is padded with a 1 pixel
wide transparent edge, making sampling outside the source texture use
transparency instead of the edge pixels. Without this property, an
- image which has opaque edges will not get a blurred shadow.
+ image which has opaque edges will not get a blurred edge.
In the image below, the Rectangle on the left has transparent borders
and has blurred edges, whereas the Rectangle on the right does not:
- By default, this property is set to \c true.
-
\snippet DropShadow-transparentBorder-example.qml example
- \image DropShadow-transparentBorder.png
+ \image transparentBorder.png
*/
- property alias transparentBorder: dbs.transparentBorder
+ property bool transparentBorder: false
+
+ Loader {
+ x: rootItem.horizontalOffset
+ y: rootItem.verticalOffset
+ width: parent.width
+ height: parent.height
+ sourceComponent: fastGlow
+ }
+
+ Component {
+ id: fastGlow
+ FastGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+ ShaderEffect {
+ anchors.fill: parent
+ property variant source: sourceProxy.output
+ }
}
diff --git a/src/effects/FastBlur.qml b/src/effects/FastBlur.qml
index 1d8a547..59344f5 100644
--- a/src/effects/FastBlur.qml
+++ b/src/effects/FastBlur.qml
@@ -48,13 +48,8 @@ import QtGraphicalEffects.private 1.12
\ingroup qtgraphicaleffects-blur
\brief Applies a fast blur effect to one or more source items.
- FastBlur offers lower blur quality than
- \l{QtGraphicalEffects::GaussianBlur}{GaussianBlur}, but it is faster to
- render. The FastBlur effect softens the source content by blurring it with
- algorithm which uses the source content downscaling and bilinear filtering.
- Use this effect in situations where the source content is rapidly changing
- and the highest possible blur quality is not
- needed.
+ The FastBlur effect softens the source content by blurring it with algorithm
+ which uses the source content downscaling and bilinear filtering.
\table
\header
@@ -65,8 +60,6 @@ import QtGraphicalEffects.private 1.12
\li \image FastBlur_bug.png
\endtable
- \note This effect is available when running with OpenGL.
- s
\section1 Example
The following example shows how to apply the effect.
@@ -177,10 +170,10 @@ Item {
}
/*! \internal */
- property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.vert"
+ property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/fastblur_internal.vert.qsb"
/*! \internal */
- property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.frag"
+ property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/fastblur_internal.frag.qsb"
ShaderEffect {
id: level0
@@ -437,6 +430,6 @@ Item {
onLodChanged: calculateWeights()
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/fastblur.frag.qsb"
}
}
diff --git a/src/effects/GammaAdjust.qml b/src/effects/GammaAdjust.qml
index 2c3edbb..d323c0b 100644
--- a/src/effects/GammaAdjust.qml
+++ b/src/effects/GammaAdjust.qml
@@ -62,8 +62,6 @@ import QtGraphicalEffects.private 1.12
\li \image GammaAdjust_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -179,6 +177,6 @@ luminance = pow(original_luminance, 1.0 / gamma); // The luminance is assumed to
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/gammaadjust.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/gammaadjust.frag.qsb"
}
}
diff --git a/src/effects/GaussianBlur.qml b/src/effects/GaussianBlur.qml
deleted file mode 100644
index 4af9714..0000000
--- a/src/effects/GaussianBlur.qml
+++ /dev/null
@@ -1,372 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtQuick.Window 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype GaussianBlur
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-blur
- \brief Applies a higher quality blur effect.
-
- GaussianBlur effect softens the image by blurring it with an algorithm that
- uses the Gaussian function to calculate the effect. The effect produces
- higher quality than \l{QtGraphicalEffects::FastBlur}{FastBlur}, but is
- slower to render.
-
- \table
- \header
- \li Source
- \li Effect applied
- \row
- \li \image Original_bug.png
- \li \image GaussianBlur_bug.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example
-
- The following example shows how to apply the effect.
- \snippet GaussianBlur-example.qml example
-
- Performing blur live is a costly operation. Fullscreen gaussian blur
- with even a moderate number of samples will only run at 60 fps on highend
- graphics hardware.
-
-*/
-Item {
- id: root
-
- /*!
- This property defines the source item that is going to be blurred.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property variant source
-
- /*!
- This property defines the distance of the neighboring pixels which
- affect the blurring of an individual pixel. A larger radius increases
- the blur effect.
-
- The ideal blur is achieved by selecting \c samples and \c radius such
- that \c {samples = 1 + radius * 2}, such as:
-
- \table
- \header \li Radius \li Samples
- \row \li 0 \e{(no blur)} \li 1
- \row \li 1 \li 3
- \row \li 2 \li 5
- \row \li 3 \li 7
- \endtable
-
- The value ranges from 0.0 (no blur) to inf. By default, the property is
- set to \c floor(samples / 2.0).
-
- \table
- \header
- \li Output examples with different radius values
- \li
- \li
- \row
- \li \image GaussianBlur_radius1.png
- \li \image GaussianBlur_radius2.png
- \li \image GaussianBlur_radius3.png
- \row
- \li \b { radius: 0 }
- \li \b { radius: 4 }
- \li \b { radius: 8 }
- \row
- \li \l samples: 16
- \li \l samples: 16
- \li \l samples: 16
- \row
- \li \l deviation: 3
- \li \l deviation: 3
- \li \l deviation: 3
- \endtable
-
- */
- property real radius: Math.floor(samples / 2);
-
- /*!
- This property defines how many samples are taken per pixel when blur
- calculation is done. Larger value produces better quality, but is slower
- to render.
-
- Ideally, this value should be twice as large as the highest required
- radius value plus 1, for example, if the radius is animated between 0.0
- and 4.0, samples should be set to 9.
-
- By default, the property is set to \c 9.
-
- \note This property is not intended to be animated. Changing this property may
- cause the underlying OpenGL shaders to be recompiled.
-
- */
- property int samples: 9
-
- /*!
- This property is a parameter to the gaussian function that is used when
- calculating neighboring pixel weights for the blurring. A larger
- deviation causes image to appear more blurry, but it also reduces the
- quality of the blur. A very large deviation value causes the effect to
- look a bit similar to what, for exmple, a box blur algorithm produces. A
- too small deviation values makes the effect insignificant for the pixels
- near the radius.
-
- \inlineimage GaussianBlur_deviation_graph.png
- \caption The image above shows the Gaussian function with two different
- deviation values, yellow (1) and cyan (2.7). The y-axis shows the
- weights, the x-axis shows the pixel distance.
-
- The value ranges from 0.0 (no deviation) to inf (maximum deviation). By
- default, devaition is binded to radius. When radius increases, deviation
- is automatically increased linearly. With the radius value of 8, the
- deviation default value becomes approximately 2.7034. This value
- produces a compromise between the blur quality and overall blurriness.
-
- \table
- \header
- \li Output examples with different deviation values
- \li
- \li
- \row
- \li \image GaussianBlur_deviation1.png
- \li \image GaussianBlur_deviation2.png
- \li \image GaussianBlur_deviation3.png
- \row
- \li \b { deviation: 1 }
- \li \b { deviation: 2 }
- \li \b { deviation: 4 }
- \row
- \li \l radius: 8
- \li \l radius: 8
- \li \l radius: 8
- \row
- \li \l samples: 16
- \li \l samples: 16
- \li \l samples: 16
- \endtable
-
- */
- property real deviation: (radius + 1) / 3.3333
-
- /*!
- This property defines the blur behavior near the edges of the item,
- where the pixel blurring is affected by the pixels outside the source
- edges.
-
- If the property is set to \c true, the pixels outside the source are
- interpreted to be transparent, which is similar to OpenGL
- clamp-to-border extension. The blur is expanded slightly outside the
- effect item area.
-
- If the property is set to \c false, the pixels outside the source are
- interpreted to contain the same color as the pixels at the edge of the
- item, which is similar to OpenGL clamp-to-edge behavior. The blur does
- not expand outside the effect item area.
-
- By default, the property is set to \c false.
-
- \table
- \header
- \li Output examples with different transparentBorder values
- \li
- \li
- \row
- \li \image GaussianBlur_transparentBorder1.png
- \li \image GaussianBlur_transparentBorder2.png
- \row
- \li \b { transparentBorder: false }
- \li \b { transparentBorder: true }
- \row
- \li \l radius: 8
- \li \l radius: 8
- \row
- \li \l samples: 16
- \li \l samples: 16
- \row
- \li \l deviation: 2.7
- \li \l deviation: 2.7
- \endtable
- */
- property bool transparentBorder: false
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance.
- Every time the source or effect properties are changed, the pixels in
- the cache must be updated. Memory consumption is increased, because an
- extra buffer of memory is required for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to \c false.
-
- */
- property bool cached: false
-
-
- // private members...
- /*! \internal */
- property int _paddedTexWidth: transparentBorder ? width + 2 * radius: width;
- /*! \internal */
- property int _paddedTexHeight: transparentBorder ? height + 2 * radius: height;
- /*! \internal */
- property int _kernelRadius: Math.max(0, samples / 2);
- /*! \internal */
- property int _kernelSize: _kernelRadius * 2 + 1;
- /*! \internal */
- property real _dpr: Screen.devicePixelRatio;
- /*! \internal */
- property bool _alphaOnly: false;
- /*! \internal */
- property var _maskSource: undefined
-
- /*! \internal */
- property alias _output: sourceProxy.output;
- /*! \internal */
- property alias _outputRect: sourceProxy.sourceRect;
- /*! \internal */
- property alias _color: verticalBlur.color;
- /*! \internal */
- property real _thickness: 0;
-
- onSamplesChanged: _rebuildShaders();
- on_KernelSizeChanged: _rebuildShaders();
- onDeviationChanged: _rebuildShaders();
- on_DprChanged: _rebuildShaders();
- on_MaskSourceChanged: _rebuildShaders();
- Component.onCompleted: _rebuildShaders();
-
- /*! \internal */
- function _rebuildShaders() {
- var params = {
- radius: _kernelRadius,
- // Limit deviation to something very small avoid getting NaN in the shader.
- deviation: Math.max(0.00001, deviation),
- alphaOnly: root._alphaOnly,
- masked: _maskSource != undefined,
- fallback: root.radius != _kernelRadius
- }
- var shaders = ShaderBuilder.gaussianBlur(params);
- horizontalBlur.fragmentShader = shaders.fragmentShader;
- horizontalBlur.vertexShader = shaders.vertexShader;
- }
-
- SourceProxy {
- id: sourceProxy
- interpolation: SourceProxy.LinearInterpolation
- input: root.source
- sourceRect: root.transparentBorder
- ? Qt.rect(-root.radius, 0, root._paddedTexWidth, parent.height)
- : Qt.rect(0, 0, 0, 0)
- }
-
- ShaderEffect {
- id: horizontalBlur
- width: root.transparentBorder ? root._paddedTexWidth : root.width
- height: root.height;
-
- // Used by all shaders
- property Item source: sourceProxy.output;
- property real spread: root.radius / root._kernelRadius;
- property var dirstep: Qt.vector2d(1 / (root._paddedTexWidth * root._dpr), 0);
-
- // Used by fallback shader (sampleCount exceeds number of varyings)
- property real deviation: root.deviation
-
- // Only in use for DropShadow and Glow
- property color color: "white"
- property real thickness: Math.max(0, Math.min(0.98, 1 - root._thickness * 0.98));
-
- // Only in use for MaskedBlur
- property var mask: root._maskSource;
-
- layer.enabled: true
- layer.smooth: true
- layer.sourceRect: root.transparentBorder
- ? Qt.rect(0, -root.radius, width, root._paddedTexHeight)
- : Qt.rect(0, 0, 0, 0)
- visible: false
- blending: false
- }
-
- ShaderEffect {
- id: verticalBlur
- x: transparentBorder ? -root.radius : 0
- y: x;
- width: root.transparentBorder ? root._paddedTexWidth: root.width
- height: root.transparentBorder ? root._paddedTexHeight : root.height;
- fragmentShader: horizontalBlur.fragmentShader
- vertexShader: horizontalBlur.vertexShader
-
- property Item source: horizontalBlur
- property real spread: horizontalBlur.spread
- property var dirstep: Qt.vector2d(0, 1 / (root._paddedTexHeight * root._dpr));
-
- property real deviation: horizontalBlur.deviation
-
- property color color: "black"
- property real thickness: horizontalBlur.thickness;
-
- property var mask: horizontalBlur.mask;
-
- visible: true
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: verticalBlur
- visible: root.cached
- smooth: true
- sourceItem: verticalBlur
- hideSource: visible
- }
-
-}
diff --git a/src/effects/Glow.qml b/src/effects/Glow.qml
index 39e69a3..12a2c69 100644
--- a/src/effects/Glow.qml
+++ b/src/effects/Glow.qml
@@ -47,13 +47,8 @@ import QtGraphicalEffects.private 1.12
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-glow
- \brief Generates a halo like glow around the source item.
-
- The Glow effect blurs the alpha channel of the source and colorizes it
- with \l {Glow::color}{color} and places it behind the source, resulting in a halo or glow
- around the object. The quality of the blurred edge can be controlled using
- \l samples and \l radius and the strength of the glow can be changed using
- \l spread.
+ \brief Generates a blurred and colorized image of the source and places it
+ behind the original, giving impression that the source is glowing.
\table
\header
@@ -64,13 +59,6 @@ import QtGraphicalEffects.private 1.12
\li \image Glow_butterfly.png
\endtable
- The glow is created by blurring the image live using a gaussian blur.
- Performing blur live is a costly operation. Fullscreen gaussian blur with
- even a moderate number of samples will only run at 60 fps on highend
- graphics hardware.
-
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -78,16 +66,7 @@ import QtGraphicalEffects.private 1.12
*/
Item {
- id: root
-
- DropShadowBase {
- id: dps
- anchors.fill: parent
- color: "white"
- spread: 0.5
- horizontalOffset: 0
- verticalOffset: 0
- }
+ id: rootItem
/*!
This property defines the source item that is going to be used as source
@@ -96,27 +75,14 @@ Item {
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
- property alias source: dps.source
+ property variant source
/*!
Radius defines the softness of the glow. A larger radius causes the
edges of the glow to appear more blurry.
- Depending on the radius value, value of the \l{Glow::samples}{samples}
- should be set to sufficiently large to ensure the visual quality.
-
- The ideal blur is achieved by selecting \c samples and \c radius such
- that \c {samples = 1 + radius * 2}, such as:
-
- \table
- \header \li Radius \li Samples
- \row \li 0 \e{(no blur)} \li 1
- \row \li 1 \li 3
- \row \li 2 \li 5
- \row \li 3 \li 7
- \endtable
-
- By default, the property is set to \c {floor(samples/2)}.
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
\table
\header
@@ -132,10 +98,6 @@ Item {
\li \b { radius: 6 }
\li \b { radius: 12 }
\row
- \li \l samples: 25
- \li \l samples: 25
- \li \l samples: 25
- \row
\li \l color: #ffffff
\li \l color: #ffffff
\li \l color: #ffffff
@@ -145,42 +107,15 @@ Item {
\li \l spread: 0
\endtable
*/
- property alias radius: dps.radius
+ property real radius: 0.0
/*!
- This property defines how many samples are taken per pixel when edge
- softening blur calculation is done. Larger value produces better
- quality, but is slower to render.
-
- Ideally, this value should be twice as large as the highest required
- radius value plus one, such as:
-
- \table
- \header \li Radius \li Samples
- \row \li 0 \e{(no blur)} \li 1
- \row \li 1 \li 3
- \row \li 2 \li 5
- \row \li 3 \li 7
- \endtable
-
- By default, the property is set to \c 9.
-
- This property is not intended to be animated. Changing this property will
- cause the underlying OpenGL shaders to be recompiled.
- */
- property alias samples: dps.samples
-
- /*!
- This property defines how large part of the glow color is strengthened
+ This property defines how large part of the glow color is strenghtened
near the source edges.
The values range from 0.0 to 1.0. By default, the property is set to \c
0.5.
- \note The implementation is optimized for medium and low spread values.
- Depending on the source, spread values closer to 1.0 may yield visually
- asymmetrical results.
-
\table
\header
\li Output examples with different spread values
@@ -199,16 +134,12 @@ Item {
\li \l radius: 8
\li \l radius: 8
\row
- \li \l samples: 17
- \li \l samples: 17
- \li \l samples: 17
- \row
\li \l color: #ffffff
\li \l color: #ffffff
\li \l color: #ffffff
\endtable
*/
- property alias spread: dps.spread
+ property real spread: 0.0
/*!
This property defines the RGBA color value which is used for the glow.
@@ -233,27 +164,13 @@ Item {
\li \l radius: 8
\li \l radius: 8
\row
- \li \l samples: 17
- \li \l samples: 17
- \li \l samples: 17
- \row
\li \l spread: 0.5
\li \l spread: 0.5
\li \l spread: 0.5
\endtable
*/
- property alias color: dps.color
-
- /*!
- \internal
-
- Starting Qt 5.6, this property has no effect. It is left here
- for source compatibility only.
-
- ### Qt 6: remove
- */
- property bool fast: false
+ property color color: "white"
/*!
This property allows the effect output pixels to be cached in order to
@@ -269,26 +186,51 @@ Item {
By default, the property is set to \c false.
*/
- property alias cached: dps.cached
+ property bool cached: false
/*!
This property determines whether or not the effect has a transparent
border.
- When set to \c true, the exterior of the item is padded with a
- transparent edge, making sampling outside the source texture use
+ When set to \c true, the exterior of the item is padded with a 1 pixel
+ wide transparent edge, making sampling outside the source texture use
transparency instead of the edge pixels. Without this property, an
image which has opaque edges will not get a blurred edge.
- By default, the property is set to \c true. Set it to false if the source
- already has a transparent edge to make the blurring a tiny bit faster.
-
In the snippet below, the Rectangle on the left has transparent borders
and has blurred edges, whereas the Rectangle on the right does not.
\snippet Glow-transparentBorder-example.qml example
- \image Glow-transparentBorder.png
+ \image transparentBorder.png
*/
- property alias transparentBorder: dps.transparentBorder
+ property bool transparentBorder: false
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: fastGlow
+ }
+
+ Component {
+ id: fastGlow
+ FastGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+ ShaderEffect {
+ anchors.fill: parent
+ property variant source: sourceProxy.output
+ }
}
diff --git a/src/effects/HueSaturation.qml b/src/effects/HueSaturation.qml
index eb13dcb..de38db7 100644
--- a/src/effects/HueSaturation.qml
+++ b/src/effects/HueSaturation.qml
@@ -62,8 +62,6 @@ import QtGraphicalEffects.private 1.12
\li \image HueSaturation_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -219,6 +217,6 @@ Item {
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/huesaturation.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/huesaturation.frag.qsb"
}
}
diff --git a/src/effects/InnerShadow.qml b/src/effects/InnerShadow.qml
deleted file mode 100644
index 7a388e3..0000000
--- a/src/effects/InnerShadow.qml
+++ /dev/null
@@ -1,386 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype InnerShadow
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-drop-shadow
- \brief Generates a colorized and blurred shadow inside the
- source.
-
- By default the effect produces a high quality shadow image, thus the
- rendering speed of the shadow might not be the highest possible. The
- rendering speed is reduced especially if the shadow edges are heavily
- softened. For use cases that require faster rendering speed and for which
- the highest possible visual quality is not necessary, property
- \l{InnerShadow::fast}{fast} can be set to true.
-
- \table
- \header
- \li Source
- \li Effect applied
- \row
- \li \image Original_butterfly.png
- \li \image InnerShadow_butterfly.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example
-
- The following example shows how to apply the effect.
- \snippet InnerShadow-example.qml example
-
-*/
-Item {
- id: rootItem
-
- /*!
- This property defines the source item that is going to be used as the
- source for the generated shadow.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property variant source
-
- /*!
- Radius defines the softness of the shadow. A larger radius causes the
- edges of the shadow to appear more blurry.
-
- Depending on the radius value, value of the
- \l{InnerShadow::samples}{samples} should be set to sufficiently large to
- ensure the visual quality.
-
- The value ranges from 0.0 (no blur) to inf. By default, the property is
- set to \c 0.0 (no blur).
-
- \table
- \header
- \li Output examples with different radius values
- \li
- \li
- \row
- \li \image InnerShadow_radius1.png
- \li \image InnerShadow_radius2.png
- \li \image InnerShadow_radius3.png
- \row
- \li \b { radius: 0 }
- \li \b { radius: 6 }
- \li \b { radius: 12 }
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l color: #000000
- \li \l color: #000000
- \li \l color: #000000
- \row
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \row
- \li \l spread: 0
- \li \l spread: 0
- \li \l spread: 0
- \endtable
-
- */
- property real radius: 0.0
-
- /*!
- This property defines how many samples are taken per pixel when edge
- softening blur calculation is done. Larger value produces better
- quality, but is slower to render.
-
- Ideally, this value should be twice as large as the highest required
- radius value, for example, if the radius is animated between 0.0 and
- 4.0, samples should be set to 8.
-
- The value ranges from 0 to 32. By default, the property is set to \c 0.
-
- This property is not intended to be animated. Changing this property may
- cause the underlying OpenGL shaders to be recompiled.
-
- When \l{InnerShadow::fast}{fast} property is set to true, this property
- has no effect.
-
- */
- property int samples: 0
-
- /*!
- This property defines how large part of the shadow color is strengthened
- near the source edges.
-
- The value ranges from 0.0 to 1.0. By default, the property is set to \c
- 0.5.
-
- \table
- \header
- \li Output examples with different spread values
- \li
- \li
- \row
- \li \image InnerShadow_spread1.png
- \li \image InnerShadow_spread2.png
- \li \image InnerShadow_spread3.png
- \row
- \li \b { spread: 0.0 }
- \li \b { spread: 0.3 }
- \li \b { spread: 0.5 }
- \row
- \li \l radius: 16
- \li \l radius: 16
- \li \l radius: 16
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l color: #000000
- \li \l color: #000000
- \li \l color: #000000
- \row
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \endtable
-
- */
- property real spread: 0.0
-
- /*!
- This property defines the RGBA color value which is used for the shadow.
-
- By default, the property is set to \c "black".
-
- \table
- \header
- \li Output examples with different color values
- \li
- \li
- \row
- \li \image InnerShadow_color1.png
- \li \image InnerShadow_color2.png
- \li \image InnerShadow_color3.png
- \row
- \li \b { color: #000000 }
- \li \b { color: #ffffff }
- \li \b { color: #ff0000 }
- \row
- \li \l radius: 16
- \li \l radius: 16
- \li \l radius: 16
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \row
- \li \l spread: 0.2
- \li \l spread: 0.2
- \li \l spread: 0.2
- \endtable
- */
- property color color: "black"
-
- /*!
- \qmlproperty real QtGraphicalEffects::InnerShadow::horizontalOffset
- \qmlproperty real QtGraphicalEffects::InnerShadow::verticalOffset
-
- HorizontalOffset and verticalOffset properties define the offset for the
- rendered shadow compared to the InnerShadow item position. Often, the
- InnerShadow item is anchored so that it fills the source element. In
- this case, if the HorizontalOffset and verticalOffset properties are set
- to 0, the shadow is rendered fully inside the source item. By changing
- the offset properties, the shadow can be positioned relatively to the
- source item.
-
- The values range from -inf to inf. By default, the properties are set to
- \c 0.
-
- \table
- \header
- \li Output examples with different horizontalOffset values
- \li
- \li
- \row
- \li \image InnerShadow_horizontalOffset1.png
- \li \image InnerShadow_horizontalOffset2.png
- \li \image InnerShadow_horizontalOffset3.png
- \row
- \li \b { horizontalOffset: -20 }
- \li \b { horizontalOffset: 0 }
- \li \b { horizontalOffset: 20 }
- \row
- \li \l radius: 16
- \li \l radius: 16
- \li \l radius: 16
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l color: #000000
- \li \l color: #000000
- \li \l color: #000000
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \row
- \li \l spread: 0
- \li \l spread: 0
- \li \l spread: 0
- \endtable
-
- */
- property real horizontalOffset: 0
- property real verticalOffset: 0
-
- /*!
- This property selects the blurring algorithm that is used to produce the
- softness for the effect. Setting this to true enables fast algorithm,
- setting value to false produces higher quality result.
-
- By default, the property is set to \c false.
-
- \table
- \header
- \li Output examples with different fast values
- \li
- \li
- \row
- \li \image InnerShadow_fast1.png
- \li \image InnerShadow_fast2.png
- \row
- \li \b { fast: false }
- \li \b { fast: true }
- \row
- \li \l radius: 16
- \li \l radius: 16
- \row
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l color: #000000
- \li \l color: #000000
- \row
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \row
- \li \l spread: 0.2
- \li \l spread: 0.2
- \endtable
- */
- property bool fast: false
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance. Every time the source or effect
- properties are changed, the pixels in the cache must be updated. Memory
- consumption is increased, because an extra buffer of memory is required
- for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to \c false.
-
- */
- property bool cached: false
-
- Loader {
- anchors.fill: parent
- sourceComponent: rootItem.fast ? innerShadow : gaussianInnerShadow
- }
-
- Component {
- id: gaussianInnerShadow
- GaussianInnerShadow {
- anchors.fill: parent
- source: rootItem.source
- radius: rootItem.radius
- maximumRadius: rootItem.samples * 0.5
- color: rootItem.color
- cached: rootItem.cached
- spread: rootItem.spread
- horizontalOffset: rootItem.horizontalOffset
- verticalOffset: rootItem.verticalOffset
- }
- }
-
- Component {
- id: innerShadow
- FastInnerShadow {
- anchors.fill: parent
- source: rootItem.source
- blur: Math.pow(rootItem.radius / 64.0, 0.4)
- color: rootItem.color
- cached: rootItem.cached
- spread: rootItem.spread
- horizontalOffset: rootItem.horizontalOffset
- verticalOffset: rootItem.verticalOffset
- }
- }
-}
diff --git a/src/effects/LevelAdjust.qml b/src/effects/LevelAdjust.qml
index b98faca..c314785 100644
--- a/src/effects/LevelAdjust.qml
+++ b/src/effects/LevelAdjust.qml
@@ -60,8 +60,6 @@ import QtGraphicalEffects.private 1.12
\li \image LevelAdjust_butterfly.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -435,6 +433,6 @@ Item {
property variant gamma: Qt.vector3d(1.0 / Math.max(rootItem.gamma.x, 0.0001), 1.0 / Math.max(rootItem.gamma.y, 0.0001), 1.0 / Math.max(rootItem.gamma.z, 0.0001))
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/leveladjust.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/leveladjust.frag.qsb"
}
}
diff --git a/src/effects/LinearGradient.qml b/src/effects/LinearGradient.qml
index 1f73a21..5d4d93e 100644
--- a/src/effects/LinearGradient.qml
+++ b/src/effects/LinearGradient.qml
@@ -58,8 +58,6 @@ import QtGraphicalEffects.private 1.12
\li \image LinearGradient.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -311,13 +309,13 @@ Item {
property real angle: Math.atan2(dx, dy)
property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle))
- vertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/lineargradient.vert"
+ vertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/lineargradient.vert.qsb"
fragmentShader: maskSource == undefined ? noMaskShader : maskShader
onFragmentShaderChanged: lChanged()
- property string maskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/lineargradient_mask.frag"
- property string noMaskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/lineargradient_nomask.frag"
+ property string maskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/lineargradient_mask.frag.qsb"
+ property string noMaskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/lineargradient_nomask.frag.qsb"
}
}
diff --git a/src/effects/MaskedBlur.qml b/src/effects/MaskedBlur.qml
deleted file mode 100644
index d777b0a..0000000
--- a/src/effects/MaskedBlur.qml
+++ /dev/null
@@ -1,218 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype MaskedBlur
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-blur
- \brief Applies a blur effect with a varying intesity.
-
- MaskedBlur effect softens the image by blurring it. The intensity of the
- blur can be controlled for each pixel using maskSource so that some parts of
- the source are blurred more than others.
-
- Performing blur live is a costly operation. Fullscreen gaussian blur
- with even a moderate number of samples will only run at 60 fps on highend
- graphics hardware.
-
- \table
- \header
- \li Source
- \li MaskSource
- \li Effect applied
- \row
- \li \image Original_bug.png
- \li \image MaskedBlur_mask.png
- \li \image MaskedBlur_bug.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example
-
- The following example shows how to apply the effect.
- \snippet MaskedBlur-example.qml example
-
-*/
-Item {
- id: root
-
- /*!
- This property defines the source item that is going to be blurred.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property alias source: blur.source
-
- /*!
- This property defines the item that is controlling the final intensity
- of the blur. The pixel alpha channel value from maskSource defines the
- actual blur radius that is going to be used for blurring the
- corresponding source pixel.
-
- Opaque maskSource pixels produce blur with specified
- \l{MaskedBlur::radius}{radius}, while transparent pixels suppress the
- blur completely. Semitransparent maskSource pixels produce blur with a
- radius that is interpolated according to the pixel transparency level.
- */
- property alias maskSource: maskProxy.input
-
- /*!
- This property defines the distance of the neighboring pixels which
- affect the blurring of an individual pixel. A larger radius increases
- the blur effect.
-
- Depending on the radius value, value of the
- \l{MaskedBlur::samples}{samples} should be set to sufficiently large to
- ensure the visual quality.
-
- The value ranges from 0.0 (no blur) to inf. By default, the property is
- set to \c 0.0 (no blur).
-
- \table
- \header
- \li Output examples with different radius values
- \li
- \li
- \row
- \li \image MaskedBlur_radius1.png
- \li \image MaskedBlur_radius2.png
- \li \image MaskedBlur_radius3.png
- \row
- \li \b { radius: 0 }
- \li \b { radius: 8 }
- \li \b { radius: 16 }
- \row
- \li \l samples: 25
- \li \l samples: 25
- \li \l samples: 25
- \endtable
-
- */
- property alias radius: blur.radius
-
- /*!
- This property defines how many samples are taken per pixel when blur
- calculation is done. Larger value produces better quality, but is slower
- to render.
-
- Ideally, this value should be twice as large as the highest required
- radius value plus 1, for example, if the radius is animated between 0.0
- and 4.0, samples should be set to 9.
-
- By default, the property is set to \c 9.
-
- This property is not intended to be animated. Changing this property may
- cause the underlying OpenGL shaders to be recompiled.
- */
- property alias samples: blur.samples
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance. Every time the source or effect
- properties are changed, the pixels in the cache must be updated. Memory
- consumption is increased, because an extra buffer of memory is required
- for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to \c false.
-
- */
- property alias cached: cacheItem.visible
-
- /*!
- \internal
-
- Kept for source compatibility only. Removed in Qt 5.6
- ### Qt6: remove
- */
- property bool fast: false
-
- /*!
- \internal
-
- Kept for source compatibility only. Removed in Qt 5.6
-
- Doing transparent border on a masked source doesn't make any sense
- as the padded exterior will have a mask alpha value of 0 which means
- no blurring and as the padded exterior of the source is a transparent
- pixel, the result is no pixels at all.
-
- In Qt 5.6 and before, this worked based on that the mask source
- was scaled up to fit the padded blur target rect, which would lead
- to inconsistent and buggy results.
-
- ### Qt6: remove
- */
- property bool transparentBorder;
-
- GaussianBlur {
- id: blur
-
- source: root.source;
- anchors.fill: parent
- _maskSource: maskProxy.output;
-
- SourceProxy {
- id: maskProxy
- }
- }
-
- ShaderEffectSource {
- id: cacheItem
- x: -blur._kernelRadius
- y: -blur._kernelRadius
- width: blur.width + 2 * blur._kernelRadius
- height: blur.height + 2 * blur._kernelRadius
- visible: false
- smooth: true
- sourceRect: Qt.rect(-blur._kernelRadius, -blur._kernelRadius, width, height);
- sourceItem: blur
- hideSource: visible
- }
-}
diff --git a/src/effects/OpacityMask.qml b/src/effects/OpacityMask.qml
index 7dffb6d..e3fa94e 100644
--- a/src/effects/OpacityMask.qml
+++ b/src/effects/OpacityMask.qml
@@ -59,8 +59,6 @@ import QtGraphicalEffects.private 1.12
\li \image OpacityMask_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -157,6 +155,6 @@ Item {
anchors.fill: parent
- fragmentShader: invert ? "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/opacitymask_invert.frag" : "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/opacitymask.frag"
+ fragmentShader: invert ? "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/opacitymask_invert.frag.qsb" : "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/opacitymask.frag.qsb"
}
}
diff --git a/src/effects/RadialBlur.qml b/src/effects/RadialBlur.qml
deleted file mode 100644
index 71d3b64..0000000
--- a/src/effects/RadialBlur.qml
+++ /dev/null
@@ -1,316 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype RadialBlur
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-motion-blur
- \brief Applies directional blur in a circular direction around the items
- center point.
-
- Effect creates perceived impression that the source item appears to be
- rotating to the direction of the blur.
-
- Other available motionblur effects are
- \l{QtGraphicalEffects::ZoomBlur}{ZoomBlur} and
- \l{QtGraphicalEffects::DirectionalBlur}{DirectionalBlur}.
-
- \table
- \header
- \li Source
- \li Effect applied
- \row
- \li \image Original_bug.png
- \li \image RadialBlur_bug.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example Usage
-
- The following example shows how to apply the effect.
- \snippet RadialBlur-example.qml example
-*/
-Item {
- id: rootItem
-
- /*!
- This property defines the source item that is going to be blurred.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property variant source
-
- /*!
- This property defines the direction for the blur and at the same time
- the level of blurring. The larger the angle, the more the result becomes
- blurred. The quality of the blur depends on
- \l{RadialBlur::samples}{samples} property. If angle value is large, more
- samples are needed to keep the visual quality at high level.
-
- Allowed values are between 0.0 and 360.0. By default the property is set
- to \c 0.0.
-
- \table
- \header
- \li Output examples with different angle values
- \li
- \li
- \row
- \li \image RadialBlur_angle1.png
- \li \image RadialBlur_angle2.png
- \li \image RadialBlur_angle3.png
- \row
- \li \b { angle: 0.0 }
- \li \b { angle: 15.0 }
- \li \b { angle: 30.0 }
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \endtable
- */
- property real angle: 0.0
-
- /*!
- This property defines how many samples are taken per pixel when blur
- calculation is done. Larger value produces better quality, but is slower
- to render.
-
- This property is not intended to be animated. Changing this property may
- cause the underlying OpenGL shaders to be recompiled.
-
- Allowed values are between 0 and inf (practical maximum depends on GPU).
- By default the property is set to \c 0 (no samples).
-
- */
- property int samples: 0
-
- /*!
- \qmlproperty real QtGraphicalEffects::RadialBlur::horizontalOffset
- \qmlproperty real QtGraphicalEffects::RadialBlur::verticalOffset
-
- These properties define the offset in pixels for the perceived center
- point of the rotation.
-
- Allowed values are between -inf and inf.
- By default these properties are set to \c 0.
-
- \table
- \header
- \li Output examples with different horizontalOffset values
- \li
- \li
- \row
- \li \image RadialBlur_horizontalOffset1.png
- \li \image RadialBlur_horizontalOffset2.png
- \li \image RadialBlur_horizontalOffset3.png
- \row
- \li \b { horizontalOffset: 75.0 }
- \li \b { horizontalOffset: 0.0 }
- \li \b { horizontalOffset: -75.0 }
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l angle: 20
- \li \l angle: 20
- \li \l angle: 20
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \endtable
- */
- property real horizontalOffset: 0.0
- property real verticalOffset: 0.0
-
- /*!
- This property defines the blur behavior near the edges of the item,
- where the pixel blurring is affected by the pixels outside the source
- edges.
-
- If the property is set to \c true, the pixels outside the source are
- interpreted to be transparent, which is similar to OpenGL
- clamp-to-border extension. The blur is expanded slightly outside the
- effect item area.
-
- If the property is set to \c false, the pixels outside the source are
- interpreted to contain the same color as the pixels at the edge of the
- item, which is similar to OpenGL clamp-to-edge behavior. The blur does
- not expand outside the effect item area.
-
- By default, the property is set to \c false.
- */
- property bool transparentBorder: false
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance.
-
- Every time the source or effect properties are changed, the pixels in
- the cache must be updated. Memory consumption is increased, because an
- extra buffer of memory is required for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to \c false.
-
- */
- property bool cached: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- sourceRect: shaderItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: shaderItem
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- ShaderEffect {
- id: shaderItem
- property variant source: sourceProxy.output
- property variant center: Qt.point(0.5 + rootItem.horizontalOffset / parent.width, 0.5 + rootItem.verticalOffset / parent.height)
- property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1
- property int samples: rootItem.samples
- property real weight: 1.0 / Math.max(1.0, rootItem.samples)
- property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180)
- property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180)
- property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
- property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
- property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0)
- property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
- property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
- property real w: parent.width
- property real h: parent.height
-
- x: transparentBorder ? -expandPixels.width - 1 : 0
- y: transparentBorder ? -expandPixels.height - 1 : 0
- width: transparentBorder ? parent.width + expandPixels.width * 2.0 + 2 : parent.width
- height: transparentBorder ? parent.height + expandPixels.height * 2.0 + 2 : parent.height
-
- property string fragmentShaderSkeleton: "
- varying highp vec2 qt_TexCoord0;
- uniform highp float qt_Opacity;
- uniform lowp sampler2D source;
- uniform highp float angleSin;
- uniform highp float angleCos;
- uniform highp float angleSinStep;
- uniform highp float angleCosStep;
- uniform highp float weight;
- uniform highp vec2 expand;
- uniform highp vec2 center;
- uniform highp vec2 delta;
- uniform highp float w;
- uniform highp float h;
-
- void main(void) {
- highp mat2 m;
- gl_FragColor = vec4(0.0);
- mediump vec2 texCoord = qt_TexCoord0;
-
- PLACEHOLDER_EXPAND_STEPS
-
- highp vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y);
- m[0] = vec2(angleCos, -angleSin);
- m[1] = vec2(angleSin, angleCos);
- dir *= m;
-
- m[0] = vec2(angleCosStep, -angleSinStep);
- m[1] = vec2(angleSinStep, angleCosStep);
-
- PLACEHOLDER_UNROLLED_LOOP
-
- gl_FragColor *= weight * qt_Opacity;
- }
- "
-
- function buildFragmentShader() {
- var shader = ""
- if (GraphicsInfo.profile == GraphicsInfo.OpenGLCoreProfile)
- shader += "#version 150 core\n#define varying in\n#define gl_FragColor fragColor\n#define texture2D texture\nout vec4 fragColor;\n"
- shader += fragmentShaderSkeleton
- var expandSteps = ""
-
- if (transparentBorder) {
- expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
- }
-
- var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
-
- if (rootItem.samples > 1) {
- unrolledLoop = ""
- for (var i = 0; i < rootItem.samples; i++)
- unrolledLoop += "gl_FragColor += texture2D(source, center + dir * delta); dir *= m;\n"
- }
-
- shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
- fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
- }
-
- onFragmentShaderChanged: sourceChanged()
- onSamplesChanged: buildFragmentShader()
- onTransparentBorderChanged: buildFragmentShader()
- Component.onCompleted: buildFragmentShader()
- }
-}
diff --git a/src/effects/RadialGradient.qml b/src/effects/RadialGradient.qml
index 52b3ff3..32800c5 100644
--- a/src/effects/RadialGradient.qml
+++ b/src/effects/RadialGradient.qml
@@ -58,8 +58,6 @@ import QtGraphicalEffects.private 1.12
\li \image RadialGradient.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -398,13 +396,13 @@ Item {
anchors.fill: parent
- vertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/radialgradient.vert"
+ vertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/radialgradient.vert.qsb"
fragmentShader: maskSource == undefined ? noMaskShader : maskShader
onFragmentShaderChanged: horizontalRatioChanged()
- property string maskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/radialgradient_mask.frag"
- property string noMaskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/radialgradient_nomask.frag"
+ property string maskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/radialgradient_mask.frag.qsb"
+ property string noMaskShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/radialgradient_nomask.frag.qsb"
}
}
diff --git a/src/effects/RectangularGlow.qml b/src/effects/RectangularGlow.qml
index 62862e3..153dbfb 100644
--- a/src/effects/RectangularGlow.qml
+++ b/src/effects/RectangularGlow.qml
@@ -61,8 +61,6 @@ import QtGraphicalEffects.private 1.12
\li \image RectangularGlow_applied.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -264,6 +262,6 @@ Item {
property real spread: rootItem.spread / 2.0
property real cornerRadius: clampedCornerRadius()
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/rectangularglow.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/rectangularglow.frag.qsb"
}
}
diff --git a/src/effects/RecursiveBlur.qml b/src/effects/RecursiveBlur.qml
deleted file mode 100644
index 7d93802..0000000
--- a/src/effects/RecursiveBlur.qml
+++ /dev/null
@@ -1,329 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype RecursiveBlur
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-blur
- \brief Blurs repeatedly, providing a strong blur effect.
-
- The RecursiveBlur effect softens the image by blurring it with an algorithm
- that uses a recursive feedback loop to blur the source multiple times. The
- effect may give more blurry results than
- \l{QtGraphicalEffects::GaussianBlur}{GaussianBlur} or
- \l{QtGraphicalEffects::FastBlur}{FastBlur}, but the result is produced
- asynchronously and takes more time.
-
- \table
- \header
- \li Source
- \li Effect applied
- \row
- \li \image Original_bug.png
- \li \image RecursiveBlur_bug.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example
-
- The following example shows how to apply the effect.
- \snippet RecursiveBlur-example.qml example
-
-*/
-Item {
- id: rootItem
-
- /*!
- This property defines the source item that is going to be blurred.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property variant source
-
- /*!
- This property defines the distance of neighboring pixels which influence
- the blurring of individual pixels. A larger radius provides better
- quality, but is slower to render.
-
- \b Note: The radius value in this effect is not intended to be changed
- or animated frequently. The correct way to use it is to set the correct
- value and keep it unchanged for the whole duration of the iterative blur
- sequence.
-
- The value ranges from (no blur) to 16.0 (maximum blur step). By default,
- the property is set to \c 0.0 (no blur).
-
- \table
- \header
- \li Output examples with different radius values
- \li
- \li
- \row
- \li \image RecursiveBlur_radius1.png
- \li \image RecursiveBlur_radius2.png
- \li \image RecursiveBlur_radius3.png
- \row
- \li \b { radius: 2.5 }
- \li \b { radius: 4.5 }
- \li \b { radius: 7.5 }
- \row
- \li \l loops: 20
- \li \l loops: 20
- \li \l loops: 20
- \endtable
-
- */
- property real radius: 0.0
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance.
-
- Every time the source or effect properties are changed, the pixels in
- the cache must be updated. Memory consumption is increased, because an
- extra buffer of memory is required for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to \c false.
-
- */
- property bool cached: false
-
- /*!
- This property defines the blur behavior near the edges of the item,
- where the pixel blurring is affected by the pixels outside the source
- edges.
-
- If the property is set to \c true, the pixels outside the source are
- interpreted to be transparent, which is similar to OpenGL
- clamp-to-border extension. The blur is expanded slightly outside the
- effect item area.
-
- If the property is set to \c false, the pixels outside the source are
- interpreted to contain the same color as the pixels at the edge of the
- item, which is similar to OpenGL clamp-to-edge behavior. The blur does
- not expand outside the effect item area.
-
- By default, the property is set to \c false.
-
- \table
- \header
- \li Output examples with different transparentBorder values
- \li
- \li
- \row
- \li \image RecursiveBlur_transparentBorder1.png
- \li \image RecursiveBlur_transparentBorder2.png
- \row
- \li \b { transparentBorder: false }
- \li \b { transparentBorder: true }
- \row
- \li \l loops: 20
- \li \l loops: 20
- \row
- \li \l radius: 7.5
- \li \l radius: 7.5
- \endtable
- */
- property bool transparentBorder: false
-
- /*!
- This property defines the amount of blur iterations that are going to be
- performed for the source. When the property changes, the iterative
- blurring process starts. If the value is decreased or if the value
- changes from zero to non-zero, a snapshot is taken from the source. The
- snapshot is used as a starting point for the process.
-
- The iteration loop tries to run as fast as possible. The speed might be
- limited by the VSYNC or the time needed for one blur step, or both.
- Sometimes it may be desirable to perform the blurring with a slower
- pace. In that case, it may be convenient to control the property with
- Animation which increases the value.
-
- The value ranges from 0 to inf. By default, the property is set to \c 0.
-
- \table
- \header
- \li Output examples with different loops values
- \li
- \li
- \row
- \li \image RecursiveBlur_loops1.png
- \li \image RecursiveBlur_loops2.png
- \li \image RecursiveBlur_loops3.png
- \row
- \li \b { loops: 4 }
- \li \b { loops: 20 }
- \li \b { loops: 70 }
- \row
- \li \l radius: 7.5
- \li \l radius: 7.5
- \li \l radius: 7.5
- \endtable
-
- */
- property int loops: 0
-
- /*!
- This property holds the progress of asynchronous source blurring
- process, from 0.0 (nothing blurred) to 1.0 (finished).
- */
- property real progress: loops > 0.0 ? Math.min(1.0, recursionTimer.counter / loops) : 0.0
-
- onLoopsChanged: recursiveSource.scheduleUpdate()
- onSourceChanged: recursionTimer.reset()
- onRadiusChanged: recursionTimer.reset()
- onTransparentBorderChanged: recursionTimer.reset()
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2, parent.height + 2) : Qt.rect(0, 0, 0, 0)
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: verticalBlur
- smooth: true
- visible: rootItem.cached
- hideSource: visible
- live: true
- sourceItem: inputItem.visible ? inputItem : verticalBlur
- }
-
- Item {
- id: recursionTimer
- property int counter: 0
-
- function reset() {
- counter = 0
- recursiveSource.scheduleUpdate()
- }
-
- function nextFrame() {
- if (loops < counter)
- recursionTimer.counter = 0
-
- if (counter > 0)
- recursiveSource.sourceItem = verticalBlur
- else
- recursiveSource.sourceItem = inputItem
-
- if (counter < loops) {
- recursiveSource.scheduleUpdate()
- counter++
- }
- }
- }
-
- ShaderEffect {
- id: inputItem
- property variant source: sourceProxy.output
- property real expandX: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.width : 0.0
- property real expandY: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.height : 0.0
-
- anchors.fill: verticalBlur
- visible: !verticalBlur.visible
-
- vertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/recursiveblur.vert"
-
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/recursiveblur.frag"
- }
-
- ShaderEffectSource {
- id: recursiveSource
- visible: false
- smooth: true
- hideSource: false
- live: false
- sourceItem: inputItem
- recursive: true
- onSourceItemChanged: scheduleUpdate()
- onScheduledUpdateCompleted: recursionTimer.nextFrame()
- }
-
- GaussianDirectionalBlur {
- id: verticalBlur
- x: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
- y: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
- width: horizontalBlur.width + 2
- height: horizontalBlur.height + 2
-
- horizontalStep: 0.0
- verticalStep: 1.0 / parent.height
-
- source: ShaderEffectSource {
- sourceItem: horizontalBlur
- hideSource: true
- visible: false
- smooth: true
- }
-
- deviation: (radius + 1) / 2.3333
- radius: rootItem.radius
- maximumRadius: Math.ceil(rootItem.radius)
- transparentBorder: false
- visible: loops > 0
- }
-
- GaussianDirectionalBlur {
- id: horizontalBlur
- width: rootItem.transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
- height: rootItem.transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
-
- horizontalStep: 1.0 / parent.width
- verticalStep: 0.0
-
- source: recursiveSource
- deviation: (radius + 1) / 2.3333
- radius: rootItem.radius
- maximumRadius: Math.ceil(rootItem.radius)
- transparentBorder: false
- visible: false
- }
-}
diff --git a/src/effects/ThresholdMask.qml b/src/effects/ThresholdMask.qml
index 204d8c9..feb7dcb 100644
--- a/src/effects/ThresholdMask.qml
+++ b/src/effects/ThresholdMask.qml
@@ -63,8 +63,6 @@ import QtGraphicalEffects.private 1.12
\li \image ThresholdMask_bug.png
\endtable
- \note This effect is available when running with OpenGL.
-
\section1 Example
The following example shows how to apply the effect.
@@ -210,6 +208,6 @@ Item {
anchors.fill: parent
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/thresholdmask.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/thresholdmask.frag.qsb"
}
}
diff --git a/src/effects/ZoomBlur.qml b/src/effects/ZoomBlur.qml
deleted file mode 100644
index 66ba710..0000000
--- a/src/effects/ZoomBlur.qml
+++ /dev/null
@@ -1,306 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-/*!
- \qmltype ZoomBlur
- \inqmlmodule QtGraphicalEffects
- \since QtGraphicalEffects 1.0
- \inherits QtQuick2::Item
- \ingroup qtgraphicaleffects-motion-blur
- \brief Applies directional blur effect towards source items center point.
-
- Effect creates perceived impression that the source item appears to be
- moving towards the center point in Z-direction or that the camera appears
- to be zooming rapidly. Other available motion blur effects are
- \l{QtGraphicalEffects::DirectionalBlur}{DirectionalBlur}
- and \l{QtGraphicalEffects::RadialBlur}{RadialBlur}.
-
- \table
- \header
- \li Source
- \li Effect applied
- \row
- \li \image Original_bug.png
- \li \image ZoomBlur_bug.png
- \endtable
-
- \note This effect is available when running with OpenGL.
-
- \section1 Example
-
- The following example shows how to apply the effect.
- \snippet ZoomBlur-example.qml example
-
-*/
-Item {
- id: rootItem
-
- /*!
- This property defines the source item that is going to be blurred.
-
- \note It is not supported to let the effect include itself, for
- instance by setting source to the effect's parent.
- */
- property variant source
-
- /*!
- This property defines the maximum perceived amount of movement for each
- pixel. The amount is smaller near the center and reaches the specified
- value at the edges.
-
- The quality of the blur depends on \l{ZoomBlur::samples}{samples}
- property. If length value is large, more samples are needed to keep the
- visual quality at high level.
-
- The value ranges from 0.0 to inf. By default the property is set to \c
- 0.0 (no blur).
-
- \table
- \header
- \li Output examples with different length values
- \li
- \li
- \row
- \li \image ZoomBlur_length1.png
- \li \image ZoomBlur_length2.png
- \li \image ZoomBlur_length3.png
- \row
- \li \b { length: 0.0 }
- \li \b { length: 32.0 }
- \li \b { length: 48.0 }
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \li \l horizontalOffset: 0
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \endtable
-
- */
- property real length: 0.0
-
- /*!
- This property defines how many samples are taken per pixel when blur
- calculation is done. Larger value produces better quality, but is slower
- to render.
-
- This property is not intended to be animated. Changing this property may
- cause the underlying OpenGL shaders to be recompiled.
-
- Allowed values are between 0 and inf (practical maximum depends on GPU).
- By default the property is set to \c 0 (no samples).
-
- */
- property int samples: 0
-
- /*!
- \qmlproperty real QtGraphicalEffects::ZoomBlur::horizontalOffset
- \qmlproperty real QtGraphicalEffects::ZoomBlur::verticalOffset
-
- These properties define an offset in pixels for the blur direction
- center point.
-
- The values range from -inf to inf. By default these properties are set
- to \c 0.
-
- \table
- \header
- \li Output examples with different horizontalOffset values
- \li
- \li
- \row
- \li \image ZoomBlur_horizontalOffset1.png
- \li \image ZoomBlur_horizontalOffset2.png
- \li \image ZoomBlur_horizontalOffset3.png
- \row
- \li \b { horizontalOffset: 100.0 }
- \li \b { horizontalOffset: 0.0 }
- \li \b { horizontalOffset: -100.0 }
- \row
- \li \l samples: 24
- \li \l samples: 24
- \li \l samples: 24
- \row
- \li \l length: 32
- \li \l length: 32
- \li \l length: 32
- \row
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \li \l verticalOffset: 0
- \endtable
- */
- property real horizontalOffset: 0.0
- property real verticalOffset: 0.0
-
- /*!
- This property defines the blur behavior near the edges of the item,
- where the pixel blurring is affected by the pixels outside the source
- edges.
-
- If the property is set to \c true, the pixels outside the source are
- interpreted to be transparent, which is similar to OpenGL
- clamp-to-border extension. The blur is expanded slightly outside the
- effect item area.
-
- If the property is set to \c false, the pixels outside the source are
- interpreted to contain the same color as the pixels at the edge of the
- item, which is similar to OpenGL clamp-to-edge behavior. The blur does
- not expand outside the effect item area.
-
- By default, the property is set to \c false.
-
- */
- property bool transparentBorder: false
-
- /*!
- This property allows the effect output pixels to be cached in order to
- improve the rendering performance.
-
- Every time the source or effect properties are changed, the pixels in
- the cache must be updated. Memory consumption is increased, because an
- extra buffer of memory is required for storing the effect output.
-
- It is recommended to disable the cache when the source or the effect
- properties are animated.
-
- By default, the property is set to \c false.
- */
- property bool cached: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: shaderItem
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- ShaderEffect {
- id: shaderItem
- property variant source: sourceProxy.output
- property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height)
- property real len: rootItem.length
- property bool transparentBorder: rootItem.transparentBorder
- property real samples: rootItem.samples
- property real weight: 1.0 / Math.max(1.0, rootItem.samples)
- property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
- property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
- property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
-
- x: transparentBorder ? -expandPixels.width - 1 : 0
- y: transparentBorder ? -expandPixels.height - 1 : 0
- width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
- height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
-
- property string fragmentShaderSkeleton: "
- varying highp vec2 qt_TexCoord0;
- uniform highp float qt_Opacity;
- uniform lowp sampler2D source;
- uniform highp float len;
- uniform highp float weight;
- uniform highp float samples;
- uniform highp vec2 center;
- uniform highp vec2 expand;
- uniform highp vec2 delta;
-
- void main(void) {
- mediump vec2 texCoord = qt_TexCoord0;
- mediump vec2 centerCoord = center;
-
- PLACEHOLDER_EXPAND_STEPS
-
- highp vec2 dir = vec2(centerCoord.x - texCoord.s, centerCoord.y - texCoord.t);
- dir /= max(1.0, length(dir) * 2.0);
- highp vec2 shift = delta * len * dir * 2.0 / max(1.0, samples - 1.0);
- gl_FragColor = vec4(0.0);
-
- PLACEHOLDER_UNROLLED_LOOP
-
- gl_FragColor *= weight * qt_Opacity;
- }
- "
-
- function buildFragmentShader() {
- var shader = ""
- if (GraphicsInfo.profile == GraphicsInfo.OpenGLCoreProfile)
- shader += "#version 150 core\n#define varying in\n#define gl_FragColor fragColor\n#define texture2D texture\nout vec4 fragColor;\n"
- shader += fragmentShaderSkeleton
- var expandSteps = ""
-
- if (transparentBorder) {
- expandSteps += "centerCoord = (centerCoord - expand) / (1.0 - 2.0 * expand);"
- expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
- }
-
- var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
-
- if (rootItem.samples > 1) {
- unrolledLoop = ""
- for (var i = 0; i < rootItem.samples; i++)
- unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n"
- }
-
- shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
- fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
- }
-
- onFragmentShaderChanged: sourceChanged()
- onSamplesChanged: buildFragmentShader()
- onTransparentBorderChanged: buildFragmentShader()
- Component.onCompleted: buildFragmentShader()
- }
-}
diff --git a/src/effects/effects_plugin.pro b/src/effects/effects_plugin.pro
index 48b1030..4cfe4e3 100644
--- a/src/effects/effects_plugin.pro
+++ b/src/effects/effects_plugin.pro
@@ -4,31 +4,23 @@ TARGETPATH = QtGraphicalEffects
QT += quick qml
IMPORT_VERSION = 1.$$QT_MINOR_VERSION
QML_FILES = \
- Blend.qml \
BrightnessContrast.qml \
ColorOverlay.qml \
Colorize.qml \
ConicalGradient.qml \
Desaturate.qml \
- DirectionalBlur.qml \
Displace.qml \
DropShadow.qml \
FastBlur.qml \
GammaAdjust.qml \
- GaussianBlur.qml \
Glow.qml \
HueSaturation.qml \
- InnerShadow.qml \
LevelAdjust.qml \
LinearGradient.qml \
- MaskedBlur.qml \
OpacityMask.qml \
- RadialBlur.qml \
RadialGradient.qml \
RectangularGlow.qml \
- RecursiveBlur.qml \
- ThresholdMask.qml \
- ZoomBlur.qml \
+ ThresholdMask.qml
# !static: CONFIG += qmlcache
diff --git a/src/effects/private/CMakeLists.txt b/src/effects/private/CMakeLists.txt
index aba6f59..a75eda4 100644
--- a/src/effects/private/CMakeLists.txt
+++ b/src/effects/private/CMakeLists.txt
@@ -10,7 +10,6 @@ qt_add_qml_module(qtgraphicaleffectsprivate
CLASSNAME QtGraphicalEffectsPrivatePlugin
SOURCES
plugin.cpp
- qgfxshaderbuilder.cpp qgfxshaderbuilder_p.h
qgfxsourceproxy.cpp qgfxsourceproxy_p.h
PUBLIC_LIBRARIES
Qt::Core
@@ -25,7 +24,7 @@ qt_add_qml_module(qtgraphicaleffectsprivate
#### Keys ignored in scope 1:.:.:private.pro:<TRUE>:
# CXX_MODULE = "qml"
-# QML_FILES = "DropShadowBase.qml" "FastGlow.qml" "FastInnerShadow.qml" "FastMaskedBlur.qml" "GaussianDirectionalBlur.qml" "GaussianGlow.qml" "GaussianInnerShadow.qml" "GaussianMaskedBlur.qml"
+# QML_FILES = "FastGlow.qml"
# QML_IMPORT_VERSION = "$$QT_VERSION"
# TARGETPATH = "QtGraphicalEffects/private"
@@ -33,39 +32,11 @@ qt_add_qml_module(qtgraphicaleffectsprivate
#####################################################################
set(qml_files
- "DropShadowBase.qml"
"FastGlow.qml"
- "FastInnerShadow.qml"
- "FastMaskedBlur.qml"
- "GaussianDirectionalBlur.qml"
- "GaussianGlow.qml"
- "GaussianInnerShadow.qml"
- "GaussianMaskedBlur.qml"
-)
-set_source_files_properties(DropShadowBase.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
)
set_source_files_properties(FastGlow.qml PROPERTIES
QT_QML_SOURCE_VERSION "1.0"
)
-set_source_files_properties(FastInnerShadow.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
-set_source_files_properties(FastMaskedBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
-set_source_files_properties(GaussianDirectionalBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
-set_source_files_properties(GaussianGlow.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
-set_source_files_properties(GaussianInnerShadow.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
-set_source_files_properties(GaussianMaskedBlur.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
qt6_target_qml_files(qtgraphicaleffectsprivate
FILES
diff --git a/src/effects/private/DropShadowBase.qml b/src/effects/private/DropShadowBase.qml
deleted file mode 100644
index e9927ea..0000000
--- a/src/effects/private/DropShadowBase.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtQuick.Window 2.12
-import QtGraphicalEffects.private 1.12
-import QtGraphicalEffects 1.12
-
-Item {
- id: root
-
- property variant source
- property real radius: Math.floor(samples / 2)
- property int samples: 9
- property color color: "black"
- property real horizontalOffset: 0
- property real verticalOffset: 0
- property real spread: 0.0
- property bool cached: false
- property bool transparentBorder: true
-
- GaussianBlur {
- id: blur
- width: parent.width
- height: parent.height
- x: Math.round(horizontalOffset)
- y: Math.round(verticalOffset)
- source: root.source
- radius: root.radius * Screen.devicePixelRatio
- samples: root.samples * Screen.devicePixelRatio
- _thickness: root.spread
- transparentBorder: root.transparentBorder
-
-
- _color: root.color;
- _alphaOnly: true
- // ignoreDevicePixelRatio: root.ignoreDevicePixelRatio
-
- ShaderEffect {
- x: blur._outputRect.x - parent.x
- y: blur._outputRect.y - parent.y
- width: transparentBorder ? blur._outputRect.width : blur.width
- height: transparentBorder ? blur._outputRect.height : blur.height
- property variant source: blur._output;
- }
-
- }
-
- ShaderEffectSource {
- id: cacheItem
- x: -blur._kernelRadius + horizontalOffset
- y: -blur._kernelRadius + verticalOffset
- width: blur.width + 2 * blur._kernelRadius
- height: blur.height + 2 * blur._kernelRadius
- visible: root.cached
- smooth: true
- sourceRect: Qt.rect(-blur._kernelRadius, -blur._kernelRadius, width, height);
- sourceItem: blur
- hideSource: visible
- }
-
-
-}
diff --git a/src/effects/private/FastGlow.qml b/src/effects/private/FastGlow.qml
index 5c737f1..c9012b9 100644
--- a/src/effects/private/FastGlow.qml
+++ b/src/effects/private/FastGlow.qml
@@ -64,9 +64,9 @@ Item {
hideSource: visible
}
- property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.vert"
+ property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/fastblur_internal.vert.qsb"
- property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.frag"
+ property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/fastblur_internal.frag.qsb"
ShaderEffect {
id: level0
@@ -326,6 +326,6 @@ Item {
onLodChanged: calculateWeights()
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastglow.frag"
+ fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders_ng/fastglow.frag.qsb"
}
}
diff --git a/src/effects/private/FastInnerShadow.qml b/src/effects/private/FastInnerShadow.qml
deleted file mode 100644
index bd361ca..0000000
--- a/src/effects/private/FastInnerShadow.qml
+++ /dev/null
@@ -1,335 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-Item {
- id: rootItem
- property variant source
- property real blur: 0.0
- property real horizontalOffset: 0
- property real verticalOffset: 0
- property real spread: 0.0
- property color color: "black"
- property bool cached: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: shaderItem
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.vert"
-
- property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.frag"
-
- ShaderEffect {
- id: level0
- property variant source: sourceProxy.output
- property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
- property real verticalOffset: rootItem.verticalOffset / rootItem.width
- property color color: rootItem.color
-
- anchors.fill: parent
- visible: false
- smooth: true
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastinnershadow_level0.frag"
- }
-
- ShaderEffectSource {
- id: level1
- width: Math.ceil(shaderItem.width / 32) * 32
- height: Math.ceil(shaderItem.height / 32) * 32
- sourceItem: level0
- hideSource: rootItem.visible
- smooth: true
- visible: false
- }
-
- ShaderEffect {
- id: effect1
- property variant source: level1
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level2
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level2
- width: level1.width / 2
- height: level1.height / 2
- sourceItem: effect1
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect2
- property variant source: level2
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level3
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level3
- width: level2.width / 2
- height: level2.height / 2
- sourceItem: effect2
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect3
- property variant source: level3
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level4
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level4
- width: level3.width / 2
- height: level3.height / 2
- sourceItem: effect3
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect4
- property variant source: level4
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level5
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level5
- width: level4.width / 2
- height: level4.height / 2
- sourceItem: effect4
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect5
- property variant source: level5
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level6
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level6
- width: level5.width / 2
- height: level5.height / 2
- sourceItem: effect5
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- Item {
- id: dummysource
- width: 1
- height: 1
- visible: false
- }
-
- ShaderEffectSource {
- id: dummy
- width: 1
- height: 1
- sourceItem: dummysource
- visible: false
- smooth: false
- live: false
- }
-
- ShaderEffect {
- id: shaderItem
- width: parent.width
- height: parent.height
-
- property variant original: sourceProxy.output
- property variant source1: level1
- property variant source2: level2
- property variant source3: level3
- property variant source4: level4
- property variant source5: level5
- property variant source6: level6
- property real lod: rootItem.blur
-
- property real weight1;
- property real weight2;
- property real weight3;
- property real weight4;
- property real weight5;
- property real weight6;
-
- property real spread: 1.0 - (rootItem.spread * 0.98)
- property color color: rootItem.color
-
- function weight(v) {
- if (v <= 0.0)
- return 1
- if (v >= 0.5)
- return 0
-
- return 1.0 - v / 0.5
- }
-
- function calculateWeights() {
-
- var w1 = weight(Math.abs(lod - 0.100))
- var w2 = weight(Math.abs(lod - 0.300))
- var w3 = weight(Math.abs(lod - 0.500))
- var w4 = weight(Math.abs(lod - 0.700))
- var w5 = weight(Math.abs(lod - 0.900))
- var w6 = weight(Math.abs(lod - 1.100))
-
- var sum = w1 + w2 + w3 + w4 + w5 + w6;
- weight1 = w1 / sum;
- weight2 = w2 / sum;
- weight3 = w3 / sum;
- weight4 = w4 / sum;
- weight5 = w5 / sum;
- weight6 = w6 / sum;
-
- upateSources()
- }
-
- function upateSources() {
- var sources = new Array();
- var weights = new Array();
-
- if (weight1 > 0) {
- sources.push(level1)
- weights.push(weight1)
- }
-
- if (weight2 > 0) {
- sources.push(level2)
- weights.push(weight2)
- }
-
- if (weight3 > 0) {
- sources.push(level3)
- weights.push(weight3)
- }
-
- if (weight4 > 0) {
- sources.push(level4)
- weights.push(weight4)
- }
-
- if (weight5 > 0) {
- sources.push(level5)
- weights.push(weight5)
- }
-
- if (weight6 > 0) {
- sources.push(level6)
- weights.push(weight6)
- }
-
- for (var j = sources.length; j < 6; j++) {
- sources.push(dummy)
- weights.push(0.0)
- }
-
- source1 = sources[0]
- source2 = sources[1]
- source3 = sources[2]
- source4 = sources[3]
- source5 = sources[4]
- source6 = sources[5]
-
- weight1 = weights[0]
- weight2 = weights[1]
- weight3 = weights[2]
- weight4 = weights[3]
- weight5 = weights[4]
- weight6 = weights[5]
- }
-
- Component.onCompleted: calculateWeights()
-
- onLodChanged: calculateWeights()
-
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastinnershadow.frag"
- }
-}
diff --git a/src/effects/private/FastMaskedBlur.qml b/src/effects/private/FastMaskedBlur.qml
deleted file mode 100644
index 56800c6..0000000
--- a/src/effects/private/FastMaskedBlur.qml
+++ /dev/null
@@ -1,247 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-Item {
- id: rootItem
- property variant source
- property variant maskSource
- property real blur: 0.0
- property bool transparentBorder: false
- property bool cached: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- }
-
- SourceProxy {
- id: maskSourceProxy
- input: rootItem.maskSource
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: shaderItem
- visible: rootItem.cached
- sourceItem: shaderItem
- live: true
- hideSource: visible
- smooth: rootItem.blur > 0
- }
-
- property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.vert"
-
- property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastblur_internal.frag"
-
- ShaderEffect {
- id: mask0
- property variant source: maskSourceProxy.output
- anchors.fill: parent
- visible: false
- smooth: true
- }
-
- ShaderEffectSource {
- id: masklevel1
- width: Math.ceil(shaderItem.width / 32) * 32
- height: Math.ceil(shaderItem.height / 32) * 32
- sourceItem: mask0
- hideSource: rootItem.visible
- sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
- visible: false
- smooth: rootItem.blur > 0
- }
-
- ShaderEffect {
- id: level0
- property variant source: sourceProxy.output
- anchors.fill: parent
- visible: false
- smooth: true
- }
-
- ShaderEffectSource {
- id: level1
- width: Math.ceil(shaderItem.width / 32) * 32
- height: Math.ceil(shaderItem.height / 32) * 32
- sourceItem: level0
- hideSource: rootItem.visible
- sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
- visible: false
- smooth: rootItem.blur > 0
- }
-
- ShaderEffect {
- id: effect1
- property variant source: level1
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level2
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level2
- width: level1.width / 2
- height: level1.height / 2
- sourceItem: effect1
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect2
- property variant source: level2
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level3
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level3
- width: level2.width / 2
- height: level2.height / 2
- sourceItem: effect2
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect3
- property variant source: level3
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level4
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level4
- width: level3.width / 2
- height: level3.height / 2
- sourceItem: effect3
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect4
- property variant source: level4
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level5
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level5
- width: level4.width / 2
- height: level4.height / 2
- sourceItem: effect4
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: effect5
- property variant source: level5
- property real yStep: 1/height
- property real xStep: 1/width
- anchors.fill: level6
- visible: false
- smooth: true
- vertexShader: __internalBlurVertexShader
- fragmentShader: __internalBlurFragmentShader
- }
-
- ShaderEffectSource {
- id: level6
- width: level5.width / 2
- height: level5.height / 2
- sourceItem: effect5
- hideSource: rootItem.visible
- visible: false
- smooth: true
- }
-
- ShaderEffect {
- id: shaderItem
- property variant mask: masklevel1
- property variant source1: level1
- property variant source2: level2
- property variant source3: level3
- property variant source4: level4
- property variant source5: level5
- property variant source6: level6
- property real lod: Math.sqrt(rootItem.blur) * 1.2 - 0.2
- property real weight1
- property real weight2
- property real weight3
- property real weight4
- property real weight5
- property real weight6
-
- x: transparentBorder ? -64 : 0
- y: transparentBorder ? -64 : 0
- width: transparentBorder ? parent.width + 128 : parent.width
- height: transparentBorder ? parent.height + 128 : parent.height
-
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/fastmaskedblur.frag"
- }
-}
diff --git a/src/effects/private/GaussianDirectionalBlur.qml b/src/effects/private/GaussianDirectionalBlur.qml
deleted file mode 100644
index 4d52b2e..0000000
--- a/src/effects/private/GaussianDirectionalBlur.qml
+++ /dev/null
@@ -1,289 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-Item {
- id: rootItem
- property variant source
- property real deviation: (radius + 1) / 3.3333
- property real radius: 0.0
- property int maximumRadius: 0
- property real horizontalStep: 0.0
- property real verticalStep: 0.0
- property bool transparentBorder: false
- property bool cached: false
-
- property bool enableColor: false
- property color color: "white"
- property real spread: 0.0
-
- property bool enableMask: false
- property variant maskSource
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- }
-
- SourceProxy {
- id: maskSourceProxy
- input: rootItem.maskSource
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: rootItem
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- ShaderEffect {
- id: shaderItem
- property variant source: sourceProxy.output
- property real deviation: Math.max(0.1, rootItem.deviation)
- property real radius: rootItem.radius
- property int maxRadius: rootItem.maximumRadius
- property bool transparentBorder: rootItem.transparentBorder
- property real gaussianSum: 0.0
- property real startIndex: 0.0
- property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1)
- property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0
- property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0
- property variant gwts: []
- property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex);
- property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]);
- property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]);
- property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]);
- property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]);
- property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]);
- property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]);
- property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]);
- property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]);
- property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]);
- property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]);
- property variant factor_30_31: Qt.point(gwts[30], gwts[31]);
-
- property color color: rootItem.color
- property real spread: 1.0 - (rootItem.spread * 0.98)
- property variant maskSource: maskSourceProxy.output
-
- anchors.fill: rootItem
-
- function gausFunc(x){
- //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2)));
- return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2)))));
- }
-
- function updateGaussianWeights() {
- gaussianSum = 0.0;
- startIndex = -maxRadius + 0.5
-
- var n = new Array(32);
- for (var j = 0; j < 32; j++)
- n[j] = 0;
-
- var max = maxRadius * 2
- var delta = (2 * radius - 1) / (max - 1);
- for (var i = 0; i < max; i++) {
- n[i] = gausFunc(-radius + 0.5 + i * delta);
- gaussianSum += n[i];
- }
-
- gwts = n;
- }
-
- function buildFragmentShader() {
-
- var shaderSteps = [
- "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;",
-
- "gl_FragColor += texture2D(source, texCoord) * factor_30_31.x; texCoord += shift;",
- "gl_FragColor += texture2D(source, texCoord) * factor_30_31.y; texCoord += shift;"
- ]
-
- var shader = ""
- if (GraphicsInfo.profile == GraphicsInfo.OpenGLCoreProfile)
- shader += "#version 150 core\n#define varying in\n#define gl_FragColor fragColor\n#define texture2D texture\nout vec4 fragColor;\n"
- shader += fragmentShaderBegin
- var samples = maxRadius * 2
- if (samples > 32) {
- console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!")
- samples = 32
- }
-
- for (var i = 0; i < samples; i++) {
- shader += shaderSteps[i]
- }
-
- shader += fragmentShaderEnd
-
- var colorizeSteps = ""
- var colorizeUniforms = ""
-
- var maskSteps = ""
- var maskUniforms = ""
-
- if (enableColor) {
- colorizeSteps += "gl_FragColor = mix(vec4(0), color, clamp((gl_FragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n"
- colorizeUniforms += "uniform highp vec4 color;\n"
- colorizeUniforms += "uniform highp float spread;\n"
- }
-
- if (enableMask) {
- maskSteps += "shift *= texture2D(maskSource, qt_TexCoord0).a;\n"
- maskUniforms += "uniform sampler2D maskSource;\n"
- }
-
- shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps)
- shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms)
- shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps)
- shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms)
-
- fragmentShader = shader
- }
-
- onDeviationChanged: updateGaussianWeights()
-
- onRadiusChanged: updateGaussianWeights()
-
- onTransparentBorderChanged: {
- buildFragmentShader()
- updateGaussianWeights()
- }
-
- onMaxRadiusChanged: {
- buildFragmentShader()
- updateGaussianWeights()
- }
-
- Component.onCompleted: {
- buildFragmentShader()
- updateGaussianWeights()
- }
-
- property string fragmentShaderBegin: "
- varying mediump vec2 qt_TexCoord0;
- uniform highp float qt_Opacity;
- uniform lowp sampler2D source;
- uniform highp vec3 delta;
- uniform highp vec3 factor_0_2;
- uniform highp vec3 factor_3_5;
- uniform highp vec3 factor_6_8;
- uniform highp vec3 factor_9_11;
- uniform highp vec3 factor_12_14;
- uniform highp vec3 factor_15_17;
- uniform highp vec3 factor_18_20;
- uniform highp vec3 factor_21_23;
- uniform highp vec3 factor_24_26;
- uniform highp vec3 factor_27_29;
- uniform highp vec3 factor_30_31;
- uniform highp float gaussianSum;
- uniform highp float expandX;
- uniform highp float expandY;
- PLACEHOLDER_MASK_UNIFORMS
- PLACEHOLDER_COLORIZE_UNIFORMS
-
- void main() {
- highp vec2 shift = vec2(delta.x, delta.y);
-
- PLACEHOLDER_MASK_STEPS
-
- highp float index = delta.z;
- mediump vec2 texCoord = qt_TexCoord0;
- texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
- texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
- texCoord += (shift * index);
-
- gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
- "
-
- property string fragmentShaderEnd: "
-
- gl_FragColor /= gaussianSum;
-
- PLACEHOLDER_COLORIZE_STEPS
-
- gl_FragColor *= qt_Opacity;
- }
- "
- }
-}
diff --git a/src/effects/private/GaussianGlow.qml b/src/effects/private/GaussianGlow.qml
deleted file mode 100644
index f0d328a..0000000
--- a/src/effects/private/GaussianGlow.qml
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-Item {
- id: rootItem
- property variant source
- property real radius: 0.0
- property int maximumRadius: 0
- property real spread: 0.0
- property color color: "white"
- property bool cached: false
- property bool transparentBorder: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: shaderItem
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- GaussianDirectionalBlur {
- id: shaderItem
- x: transparentBorder ? -maximumRadius - 1 : 0
- y: transparentBorder ? -maximumRadius - 1 : 0
- width: horizontalBlur.width
- height: horizontalBlur.height
- horizontalStep: 0.0
- verticalStep: 1.0 / parent.height
- source: horizontalBlur
- radius: rootItem.radius
- maximumRadius: rootItem.maximumRadius
- transparentBorder: rootItem.transparentBorder
- enableColor: true
- color: rootItem.color
- spread: rootItem.spread
- }
-
- GaussianDirectionalBlur {
- id: horizontalBlur
- width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
- height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
- horizontalStep: 1.0 / parent.width
- verticalStep: 0.0
- source: sourceProxy.output
- radius: rootItem.radius
- maximumRadius: rootItem.maximumRadius
- transparentBorder: rootItem.transparentBorder
- visible: false
- }
-}
diff --git a/src/effects/private/GaussianInnerShadow.qml b/src/effects/private/GaussianInnerShadow.qml
deleted file mode 100644
index a0b39e9..0000000
--- a/src/effects/private/GaussianInnerShadow.qml
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-Item {
- id: rootItem
- property variant source
- property real radius: 0.0
- property int maximumRadius: 0
- property real horizontalOffset: 0
- property real verticalOffset: 0
- property real spread: 0
- property color color: "black"
- property bool cached: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: shaderItem
- visible: rootItem.cached
- smooth: true
- sourceItem: shaderItem
- live: true
- hideSource: visible
- }
-
- ShaderEffect{
- id: shadowItem
- anchors.fill: parent
-
- property variant original: sourceProxy.output
- property color color: rootItem.color
- property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
- property real verticalOffset: rootItem.verticalOffset / rootItem.height
-
- visible: false
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/gaussianinnershadow_shadow.frag"
- }
-
- GaussianDirectionalBlur {
- id: blurItem
- anchors.fill: parent
- horizontalStep: 0.0
- verticalStep: 1.0 / parent.height
- source: horizontalBlur
- radius: rootItem.radius
- maximumRadius: rootItem.maximumRadius
- visible: false
- }
-
- GaussianDirectionalBlur {
- id: horizontalBlur
- width: transparentBorder ? parent.width + 2 * maximumRadius : parent.width
- height: parent.height
- horizontalStep: 1.0 / parent.width
- verticalStep: 0.0
- source: shadowItem
- radius: rootItem.radius
- maximumRadius: rootItem.maximumRadius
- visible: false
- }
-
- ShaderEffectSource {
- id: blurredSource
- sourceItem: blurItem
- live: true
- smooth: true
- }
-
- ShaderEffect {
- id: shaderItem
- anchors.fill: parent
-
- property variant original: sourceProxy.output
- property variant shadow: blurredSource
- property real spread: 1.0 - (rootItem.spread * 0.98)
- property color color: rootItem.color
-
- fragmentShader: "qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/gaussianinnershadow.frag"
- }
-}
diff --git a/src/effects/private/GaussianMaskedBlur.qml b/src/effects/private/GaussianMaskedBlur.qml
deleted file mode 100644
index 8273973..0000000
--- a/src/effects/private/GaussianMaskedBlur.qml
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects.private 1.12
-
-Item {
- id: rootItem
- property variant source
- property variant maskSource
- property real radius: 0.0
- property int maximumRadius: 0
- property bool cached: false
- property bool transparentBorder: false
-
- SourceProxy {
- id: sourceProxy
- input: rootItem.source
- sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
- }
-
- SourceProxy {
- id: maskSourceProxy
- input: rootItem.maskSource
- sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
- }
-
- ShaderEffectSource {
- id: cacheItem
- anchors.fill: blur
- visible: rootItem.cached
- smooth: true
- sourceItem: blur
- live: true
- hideSource: visible
- }
-
- GaussianDirectionalBlur {
- id: blur
- x: transparentBorder ? -maximumRadius - 1: 0
- y: transparentBorder ? -maximumRadius - 1: 0
- width: horizontalBlur.width
- height: horizontalBlur.height
- horizontalStep: 0.0
- verticalStep: 1.0 / parent.height
- source: horizontalBlur
- enableMask: true
- maskSource: maskSourceProxy.output
- radius: rootItem.radius
- maximumRadius: rootItem.maximumRadius
- transparentBorder: rootItem.transparentBorder
- }
-
- GaussianDirectionalBlur {
- id: horizontalBlur
- width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
- height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
- horizontalStep: 1.0 / parent.width
- verticalStep: 0.0
- source: sourceProxy.output
- enableMask: true
- maskSource: maskSourceProxy.output
- radius: rootItem.radius
- maximumRadius: rootItem.maximumRadius
- transparentBorder: rootItem.transparentBorder
- visible: false
- }
-}
diff --git a/src/effects/private/plugin.cpp b/src/effects/private/plugin.cpp
index ebb1dc7..82c35fc 100644
--- a/src/effects/private/plugin.cpp
+++ b/src/effects/private/plugin.cpp
@@ -42,15 +42,9 @@
#include <QtQml/qqmlengine.h>
#include "qgfxsourceproxy_p.h"
-#include "qgfxshaderbuilder_p.h"
QT_BEGIN_NAMESPACE
-static QObject *qgfxshaderbuilder_provider(QQmlEngine *, QJSEngine *)
-{
- return new QGfxShaderBuilder();
-}
-
class QtGraphicalEffectsPrivatePlugin : public QQmlExtensionPlugin
{
Q_OBJECT
@@ -62,7 +56,6 @@ public:
{
Q_ASSERT(QByteArray(uri) == QByteArrayLiteral("QtGraphicalEffects.private"));
qmlRegisterType<QGfxSourceProxy>(uri, 1, 0, "SourceProxy");
- qmlRegisterSingletonType<QGfxShaderBuilder>(uri, 1, 0, "ShaderBuilder", qgfxshaderbuilder_provider);
// The minor version used to be the current Qt 5 minor. For compatibility it is the last
// Qt 5 release.
diff --git a/src/effects/private/private.pro b/src/effects/private/private.pro
index ef63d6b..b8d162a 100644
--- a/src/effects/private/private.pro
+++ b/src/effects/private/private.pro
@@ -8,22 +8,13 @@ QT += quick qml
QT += quick-private gui-private core-private qml-private
SOURCES += plugin.cpp \
- qgfxshaderbuilder.cpp \
qgfxsourceproxy.cpp
HEADERS += \
- qgfxsourceproxy_p.h \
- qgfxshaderbuilder_p.h
+ qgfxsourceproxy_p.h
QML_FILES = \
- DropShadowBase.qml \
- FastGlow.qml \
- FastInnerShadow.qml \
- FastMaskedBlur.qml \
- GaussianDirectionalBlur.qml \
- GaussianGlow.qml \
- GaussianInnerShadow.qml \
- GaussianMaskedBlur.qml
+ FastGlow.qml
!static: CONFIG += qmlcache
diff --git a/src/effects/private/qgfxshaderbuilder.cpp b/src/effects/private/qgfxshaderbuilder.cpp
deleted file mode 100644
index 6439ff3..0000000
--- a/src/effects/private/qgfxshaderbuilder.cpp
+++ /dev/null
@@ -1,573 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Graphical Effects module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgfxshaderbuilder_p.h"
-
-#include <QtCore/QDebug>
-#include <QtGui/QOffscreenSurface>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-
-#include <qmath.h>
-#include <qnumeric.h>
-
-#ifndef GL_MAX_VARYING_COMPONENTS
-#define GL_MAX_VARYING_COMPONENTS 0x8B4B
-#endif
-
-#ifndef GL_MAX_VARYING_FLOATS
-#define GL_MAX_VARYING_FLOATS 0x8B4B
-#endif
-
-#ifndef GL_MAX_VARYING_VECTORS
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#endif
-
-QGfxShaderBuilder::QGfxShaderBuilder()
- : m_coreProfile(false)
-{
- // The following code makes the assumption that an OpenGL context the GUI
- // thread will get the same capabilities as the render thread's OpenGL
- // context. Not 100% accurate, but it works...
- QOpenGLContext context;
- if (!context.create()) {
- qDebug() << "failed to acquire GL context to resolve capabilities, using defaults..";
- m_maxBlurSamples = 8; // minimum number of varyings in the ES 2.0 spec.
- return;
- }
-
- QOffscreenSurface surface;
- // In very odd cases, we can get incompatible configs here unless we pass the
- // GL context's format on to the offscreen format.
- surface.setFormat(context.format());
- surface.create();
-
- QOpenGLContext *oldContext = QOpenGLContext::currentContext();
- QSurface *oldSurface = oldContext ? oldContext->surface() : 0;
- if (context.makeCurrent(&surface)) {
- QOpenGLFunctions *gl = context.functions();
- if (context.isOpenGLES()) {
- gl->glGetIntegerv(GL_MAX_VARYING_VECTORS, &m_maxBlurSamples);
- } else if (context.format().majorVersion() >= 3) {
- int components;
- gl->glGetIntegerv(GL_MAX_VARYING_COMPONENTS, &components);
- m_maxBlurSamples = components / 2.0;
- m_coreProfile = context.format().profile() == QSurfaceFormat::CoreProfile;
- } else {
- int floats;
- gl->glGetIntegerv(GL_MAX_VARYING_FLOATS, &floats);
- m_maxBlurSamples = floats / 2.0;
- }
- if (oldContext && oldSurface)
- oldContext->makeCurrent(oldSurface);
- else
- context.doneCurrent();
- } else {
- qDebug() << "failed to acquire GL context to resolve capabilities, using defaults..";
- m_maxBlurSamples = 8; // minimum number of varyings in the ES 2.0 spec.
- }
-}
-
-/*
-
- The algorithm works like this..
-
- For every two pixels we want to sample we take one sample between those
- two pixels and rely on linear interpoliation to get both values at the
- cost of one texture sample. The sample point is calculated based on the
- gaussian weights at the two texels.
-
- I've included the table here for future reference:
-
- Requested Effective Actual Actual
- Samples Radius/Kernel Samples Radius(*)
- -------------------------------------------------
- 0 0 / 1x1 1 0
- 1 0 / 1x1 1 0
- 2 1 / 3x3 2 0
- 3 1 / 3x3 2 0
- 4 2 / 5x5 3 1
- 5 2 / 5x5 3 1
- 6 3 / 7x7 4 1
- 7 3 / 7x7 4 1
- 8 4 / 9x9 5 2
- 9 4 / 9x9 5 2
- 10 5 / 11x11 6 2
- 11 5 / 11x11 6 2
- 12 6 / 13x13 7 3
- 13 6 / 13x13 7 3
- ... ... ... ...
-
- When ActualSamples is an 'odd' nunber, sample center pixel separately:
- EffectiveRadius: 4
- EffectiveKernel: 9x9
- ActualSamples: 5
- -4 -3 -2 -1 0 +1 +2 +3 +4
- | | | | | | | | | |
- \ / \ / | \ / \ /
- tL2 tL1 tC tR1 tR2
-
- When ActualSamples is an 'even' number, sample 3 center pixels with two
- samples:
- EffectiveRadius: 3
- EffectiveKernel: 7x7
- ActualSamples: 4
- -3 -2 -1 0 +1 +2 +3
- | | | | | | | |
- \ / \ / | \ /
- tL1 tL0 tR0 tR2
-
- From this table we have the following formulas:
- EffectiveRadius = RequestedSamples / 2;
- EffectiveKernel = EffectiveRadius * 2 + 1
- ActualSamples = 1 + RequstedSamples / 2;
- ActualRadius = RequestedSamples / 4;
-
- (*) ActualRadius excludes the pixel pair sampled in the center
- for even 'actual sample' counts
-*/
-
-static qreal qgfx_gaussian(qreal x, qreal d)
-{
- return qExp(- x * x / (2 * d * d));
-}
-
-struct QGfxGaussSample
-{
- QByteArray name;
- qreal pos;
- qreal weight;
- inline void set(const QByteArray &n, qreal p, qreal w) {
- name = n;
- pos = p;
- weight = w;
- }
-};
-
-static void qgfx_declareBlurVaryings(QByteArray &shader, QGfxGaussSample *s, int samples)
-{
- for (int i=0; i<samples; ++i) {
- shader += "varying highp vec2 ";
- shader += s[i].name;
- shader += ";\n";
- }
-}
-
-static void qgfx_declareCoreBlur(QByteArray &shader, const QByteArray& direction, QGfxGaussSample *s, int samples)
-{
- for (int i=0; i<samples; ++i) {
- shader += direction + " vec2 ";
- shader += s[i].name;
- shader += ";\n";
- }
-}
-
-static void qgfx_buildGaussSamplePoints(QGfxGaussSample *p, int samples, int radius, qreal deviation)
-{
-
- if ((samples % 2) == 1) {
- p[radius].set("tC", 0, 1);
- for (int i=0; i<radius; ++i) {
- qreal p0 = (i + 1) * 2 - 1;
- qreal p1 = (i + 1) * 2;
- qreal w0 = qgfx_gaussian(p0, deviation);
- qreal w1 = qgfx_gaussian(p1, deviation);
- qreal w = w0 + w1;
- qreal samplePos = (p0 * w0 + p1 * w1) / w;
- if (qIsNaN(samplePos)) {
- samplePos = 0;
- w = 0;
- }
- p[radius - i - 1].set("tL" + QByteArray::number(i), samplePos, w);
- p[radius + i + 1].set("tR" + QByteArray::number(i), -samplePos, w);
- }
- } else {
- { // tL0
- qreal wl = qgfx_gaussian(-1.0, deviation);
- qreal wc = qgfx_gaussian(0.0, deviation);
- qreal w = wl + wc;
- p[radius].set("tL0", -1.0 * wl / w, w);
- p[radius+1].set("tR0", 1.0, wl); // reuse wl as gauss(-1)==gauss(1);
- }
- for (int i=0; i<radius; ++i) {
- qreal p0 = (i + 1) * 2;
- qreal p1 = (i + 1) * 2 + 1;
- qreal w0 = qgfx_gaussian(p0, deviation);
- qreal w1 = qgfx_gaussian(p1, deviation);
- qreal w = w0 + w1;
- qreal samplePos = (p0 * w0 + p1 * w1) / w;
- if (qIsNaN(samplePos)) {
- samplePos = 0;
- w = 0;
- }
- p[radius - i - 1].set("tL" + QByteArray::number(i+1), samplePos, w);
- p[radius + i + 2].set("tR" + QByteArray::number(i+1), -samplePos, w);
-
- }
- }
-}
-
-QByteArray qgfx_gaussianVertexShader(QGfxGaussSample *p, int samples)
-{
- QByteArray shader;
- shader.reserve(1024);
- shader += "attribute highp vec4 qt_Vertex;\n"
- "attribute highp vec2 qt_MultiTexCoord0;\n\n"
- "uniform highp mat4 qt_Matrix;\n"
- "uniform highp float spread;\n"
- "uniform highp vec2 dirstep;\n\n";
-
- qgfx_declareBlurVaryings(shader, p, samples);
-
- shader += "\nvoid main() {\n"
- " gl_Position = qt_Matrix * qt_Vertex;\n\n";
-
- for (int i=0; i<samples; ++i) {
- shader += " ";
- shader += p[i].name;
- shader += " = qt_MultiTexCoord0";
- if (p[i].pos != 0.0) {
- shader += " + spread * dirstep * float(";
- shader += QByteArray::number(p[i].pos);
- shader += ')';
- }
- shader += ";\n";
- }
-
- shader += "}\n";
-
- return shader;
-}
-
-QByteArray qgfx_gaussianVertexCoreShader(QGfxGaussSample *p, int samples)
-{
- QByteArray shader;
- shader.reserve(1024);
- shader += "#version 150 core\n"
- "in vec4 qt_Vertex;\n"
- "in vec2 qt_MultiTexCoord0;\n\n"
- "uniform mat4 qt_Matrix;\n"
- "uniform float spread;\n"
- "uniform vec2 dirstep;\n\n";
-
- qgfx_declareCoreBlur(shader, "out", p, samples);
-
- shader += "\nvoid main() {\n"
- " gl_Position = qt_Matrix * qt_Vertex;\n\n";
-
- for (int i=0; i<samples; ++i) {
- shader += " ";
- shader += p[i].name;
- shader += " = qt_MultiTexCoord0";
- if (p[i].pos != 0.0) {
- shader += " + spread * dirstep * float(";
- shader += QByteArray::number(p[i].pos);
- shader += ')';
- }
- shader += ";\n";
- }
-
- shader += "}\n";
-
- return shader;
-}
-
-QByteArray qgfx_gaussianFragmentShader(QGfxGaussSample *p, int samples, bool alphaOnly)
-{
- QByteArray shader;
- shader.reserve(1024);
- shader += "uniform lowp sampler2D source;\n"
- "uniform lowp float qt_Opacity;\n";
-
- if (alphaOnly) {
- shader += "uniform lowp vec4 color;\n"
- "uniform lowp float thickness;\n";
- }
-
- shader += "\n";
-
-
-
- qgfx_declareBlurVaryings(shader, p, samples);
-
- shader += "\nvoid main() {\n"
- " gl_FragColor = ";
- if (alphaOnly)
- shader += "mix(vec4(0), color, clamp((";
- else
- shader += "(";
-
- qreal sum = 0;
- for (int i=0; i<samples; ++i)
- sum += p[i].weight;
-
- for (int i=0; i<samples; ++i) {
- shader += "\n + float(";
- shader += QByteArray::number(p[i].weight / sum);
- shader += ") * texture2D(source, ";
- shader += p[i].name;
- shader += ")";
- if (alphaOnly)
- shader += ".a";
- }
-
- shader += "\n )";
- if (alphaOnly)
- shader += "/thickness, 0.0, 1.0))";
- shader += "* qt_Opacity;\n}";
-
- return shader;
-}
-
-QByteArray qgfx_gaussianFragmentCoreShader(QGfxGaussSample *p, int samples, bool alphaOnly)
-{
- QByteArray shader;
- shader.reserve(1024);
- shader += "#version 150 core\n"
- "uniform sampler2D source;\n"
- "uniform float qt_Opacity;\n";
-
- if (alphaOnly) {
- shader += "uniform vec4 color;\n"
- "uniform float thickness;\n";
- }
-
- shader += "out vec4 fragColor;\n";
-
- qgfx_declareCoreBlur(shader, "in", p, samples);
-
- shader += "\nvoid main() {\n"
- " fragColor = ";
- if (alphaOnly)
- shader += "mix(vec4(0), color, clamp((";
- else
- shader += "(";
-
- qreal sum = 0;
- for (int i=0; i<samples; ++i)
- sum += p[i].weight;
-
- for (int i=0; i<samples; ++i) {
- shader += "\n + float(";
- shader += QByteArray::number(p[i].weight / sum);
- shader += ") * texture(source, ";
- shader += p[i].name;
- shader += ")";
- if (alphaOnly)
- shader += ".a";
- }
-
- shader += "\n )";
- if (alphaOnly)
- shader += "/thickness, 0.0, 1.0))";
- shader += "* qt_Opacity;\n}";
-
- return shader;
-}
-
-static QByteArray qgfx_fallbackVertexShader()
-{
- return "attribute highp vec4 qt_Vertex;\n"
- "attribute highp vec2 qt_MultiTexCoord0;\n"
- "uniform highp mat4 qt_Matrix;\n"
- "varying highp vec2 qt_TexCoord0;\n"
- "void main() {\n"
- " gl_Position = qt_Matrix * qt_Vertex;\n"
- " qt_TexCoord0 = qt_MultiTexCoord0;\n"
- "}\n";
-}
-
-static QByteArray qgfx_fallbackCoreVertexShader()
-{
- return "#version 150 core\n"
- "in vec4 qt_Vertex;\n"
- "in vec2 qt_MultiTexCoord0;\n"
- "uniform mat4 qt_Matrix;\n"
- "out vec2 qt_TexCoord0;\n"
- "void main() {\n"
- " gl_Position = qt_Matrix * qt_Vertex;\n"
- " qt_TexCoord0 = qt_MultiTexCoord0;\n"
- "}\n";
-}
-
-static QByteArray qgfx_fallbackFragmentShader(int requestedRadius, qreal deviation, bool masked, bool alphaOnly)
-{
- QByteArray fragShader;
- if (masked)
- fragShader += "uniform mediump sampler2D mask;\n";
- fragShader +=
- "uniform highp sampler2D source;\n"
- "uniform lowp float qt_Opacity;\n"
- "uniform mediump float spread;\n"
- "uniform highp vec2 dirstep;\n";
- if (alphaOnly) {
- fragShader += "uniform lowp vec4 color;\n"
- "uniform lowp float thickness;\n";
- }
- fragShader +=
- "\n"
- "varying highp vec2 qt_TexCoord0;\n"
- "\n"
- "void main() {\n";
- if (alphaOnly)
- fragShader += " mediump float result = 0.0;\n";
- else
- fragShader += " mediump vec4 result = vec4(0);\n";
- fragShader += " highp vec2 pixelStep = dirstep * spread;\n";
- if (masked)
- fragShader += " pixelStep *= texture2D(mask, qt_TexCoord0).a;\n";
-
- float wSum = 0;
- for (int r=-requestedRadius; r<=requestedRadius; ++r) {
- float w = qgfx_gaussian(r, deviation);
- wSum += w;
- fragShader += " result += float(";
- fragShader += QByteArray::number(w);
- fragShader += ") * texture2D(source, qt_TexCoord0 + pixelStep * float(";
- fragShader += QByteArray::number(r);
- fragShader += "))";
- if (alphaOnly)
- fragShader += ".a";
- fragShader += ";\n";
- }
- fragShader += " const mediump float wSum = float(";
- fragShader += QByteArray::number(wSum);
- fragShader += ");\n"
- " gl_FragColor = ";
- if (alphaOnly)
- fragShader += "mix(vec4(0), color, clamp((result / wSum) / thickness, 0.0, 1.0)) * qt_Opacity;\n";
- else
- fragShader += "(qt_Opacity / wSum) * result;\n";
- fragShader += "}\n";
-
- return fragShader;
-}
-
-static QByteArray qgfx_fallbackCoreFragmentShader(int requestedRadius, qreal deviation, bool masked, bool alphaOnly)
-{
- QByteArray fragShader = "#version 150 core\n";
- if (masked)
- fragShader += "uniform sampler2D mask;\n";
- fragShader +=
- "uniform sampler2D source;\n"
- "uniform float qt_Opacity;\n"
- "uniform float spread;\n"
- "uniform vec2 dirstep;\n";
- if (alphaOnly) {
- fragShader += "uniform vec4 color;\n"
- "uniform float thickness;\n";
- }
- fragShader +=
- "out vec4 fragColor;\n"
- "in vec2 qt_TexCoord0;\n"
- "\n"
- "void main() {\n";
- if (alphaOnly)
- fragShader += " float result = 0.0;\n";
- else
- fragShader += " vec4 result = vec4(0);\n";
- fragShader += " vec2 pixelStep = dirstep * spread;\n";
- if (masked)
- fragShader += " pixelStep *= texture(mask, qt_TexCoord0).a;\n";
-
- float wSum = 0;
- for (int r=-requestedRadius; r<=requestedRadius; ++r) {
- float w = qgfx_gaussian(r, deviation);
- wSum += w;
- fragShader += " result += float(";
- fragShader += QByteArray::number(w);
- fragShader += ") * texture(source, qt_TexCoord0 + pixelStep * float(";
- fragShader += QByteArray::number(r);
- fragShader += "))";
- if (alphaOnly)
- fragShader += ".a";
- fragShader += ";\n";
- }
- fragShader += " const float wSum = float(";
- fragShader += QByteArray::number(wSum);
- fragShader += ");\n"
- " fragColor = ";
- if (alphaOnly)
- fragShader += "mix(vec4(0), color, clamp((result / wSum) / thickness, 0.0, 1.0)) * qt_Opacity;\n";
- else
- fragShader += "(qt_Opacity / wSum) * result;\n";
- fragShader += "}\n";
-
- return fragShader;
-}
-
-QVariantMap QGfxShaderBuilder::gaussianBlur(const QJSValue &parameters)
-{
- int requestedRadius = qMax(0.0, parameters.property(QStringLiteral("radius")).toNumber());
- qreal deviation = parameters.property(QStringLiteral("deviation")).toNumber();
- bool masked = parameters.property(QStringLiteral("masked")).toBool();
- bool alphaOnly = parameters.property(QStringLiteral("alphaOnly")).toBool();
-
- int requestedSamples = requestedRadius * 2 + 1;
- int samples = 1 + requestedSamples / 2;
- int radius = requestedSamples / 4;
- bool fallback = parameters.property(QStringLiteral("fallback")).toBool();
-
- QVariantMap result;
-
- if (samples > m_maxBlurSamples || masked || fallback) {
-
- if (m_coreProfile) {
- result[QStringLiteral("fragmentShader")] = qgfx_fallbackCoreFragmentShader(requestedRadius, deviation, masked, alphaOnly);
- result[QStringLiteral("vertexShader")] = qgfx_fallbackCoreVertexShader();
- } else {
- result[QStringLiteral("fragmentShader")] = qgfx_fallbackFragmentShader(requestedRadius, deviation, masked, alphaOnly);
- result[QStringLiteral("vertexShader")] = qgfx_fallbackVertexShader();
- }
- return result;
- }
-
- QVarLengthArray<QGfxGaussSample, 64> p(samples);
- qgfx_buildGaussSamplePoints(p.data(), samples, radius, deviation);
-
- if (m_coreProfile) {
- result[QStringLiteral("fragmentShader")] = qgfx_gaussianFragmentCoreShader(p.data(), samples, alphaOnly);
- result[QStringLiteral("vertexShader")] = qgfx_gaussianVertexCoreShader(p.data(), samples);
- } else {
- result[QStringLiteral("fragmentShader")] = qgfx_gaussianFragmentShader(p.data(), samples, alphaOnly);
- result[QStringLiteral("vertexShader")] = qgfx_gaussianVertexShader(p.data(), samples);
- }
- return result;
-}
-
diff --git a/src/effects/private/qgfxshaderbuilder_p.h b/src/effects/private/qgfxshaderbuilder_p.h
deleted file mode 100644
index 4750f57..0000000
--- a/src/effects/private/qgfxshaderbuilder_p.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Graphical Effects module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGFXSHADERBUILDER_P_H
-#define QGFXSHADERBUILDER_P_H
-
-#include <QtCore/QObject>
-#include <QtCore/QVariantMap>
-
-#include <QtQml/QJSValue>
-
-QT_BEGIN_NAMESPACE
-
-class QGfxShaderBuilder : public QObject
-{
- Q_OBJECT
-
-public:
- QGfxShaderBuilder();
-
- Q_INVOKABLE QVariantMap gaussianBlur(const QJSValue &parameters);
-
-private:
- int m_maxBlurSamples = 0;
- bool m_coreProfile;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGFXSHADERBUILDER_P_H
diff --git a/src/effects/private/qmldir b/src/effects/private/qmldir
index 2d4bdac..da46a25 100644
--- a/src/effects/private/qmldir
+++ b/src/effects/private/qmldir
@@ -2,10 +2,3 @@ module QtGraphicalEffects.private
plugin qtgraphicaleffectsprivate
classname QtGraphicalEffectsPrivatePlugin
FastGlow 1.0 FastGlow.qml
-FastInnerShadow 1.0 FastInnerShadow.qml
-FastMaskedBlur 1.0 FastMaskedBlur.qml
-GaussianDirectionalBlur 1.0 GaussianDirectionalBlur.qml
-GaussianGlow 1.0 GaussianGlow.qml
-GaussianInnerShadow 1.0 GaussianInnerShadow.qml
-GaussianMaskedBlur 1.0 GaussianMaskedBlur.qml
-DropShadowBase 1.0 DropShadowBase.qml
diff --git a/src/effects/qmldir b/src/effects/qmldir
index 72233b5..c0b4dbe 100644
--- a/src/effects/qmldir
+++ b/src/effects/qmldir
@@ -1,31 +1,23 @@
module QtGraphicalEffects
plugin qtgraphicaleffectsplugin
classname QtGraphicalEffectsPlugin
-Blend 1.0 Blend.qml
BrightnessContrast 1.0 BrightnessContrast.qml
Colorize 1.0 Colorize.qml
ColorOverlay 1.0 ColorOverlay.qml
ConicalGradient 1.0 ConicalGradient.qml
Desaturate 1.0 Desaturate.qml
-DirectionalBlur 1.0 DirectionalBlur.qml
Displace 1.0 Displace.qml
DropShadow 1.0 DropShadow.qml
FastBlur 1.0 FastBlur.qml
GammaAdjust 1.0 GammaAdjust.qml
-GaussianBlur 1.0 GaussianBlur.qml
Glow 1.0 Glow.qml
HueSaturation 1.0 HueSaturation.qml
-InnerShadow 1.0 InnerShadow.qml
LevelAdjust 1.0 LevelAdjust.qml
LinearGradient 1.0 LinearGradient.qml
-MaskedBlur 1.0 MaskedBlur.qml
OpacityMask 1.0 OpacityMask.qml
-RadialBlur 1.0 RadialBlur.qml
RadialGradient 1.0 RadialGradient.qml
-RecursiveBlur 1.0 RecursiveBlur.qml
RectangularGlow 1.0 RectangularGlow.qml
ThresholdMask 1.0 ThresholdMask.qml
-ZoomBlur 1.0 ZoomBlur.qml
designersupported
depends QtGraphicalEffects/private 1.0
depends QtQuick.Window 2.1
diff --git a/src/effects/qtgraphicaleffectsshaders.qrc b/src/effects/qtgraphicaleffectsshaders.qrc
index 98f8846..169f190 100644
--- a/src/effects/qtgraphicaleffectsshaders.qrc
+++ b/src/effects/qtgraphicaleffectsshaders.qrc
@@ -1,66 +1,28 @@
<RCC>
<qresource prefix="/qt-project.org/imports/QtGraphicalEffects">
- <file>shaders/brightnesscontrast.frag</file>
- <file>shaders/+glslcore/brightnesscontrast.frag</file>
- <file>shaders/+glslcore/colorize.frag</file>
- <file>shaders/colorize.frag</file>
- <file>shaders/+glslcore/coloroverlay.frag</file>
- <file>shaders/coloroverlay.frag</file>
- <file>shaders/conicalgradient_nomask.frag</file>
- <file>shaders/conicalgradient_mask.frag</file>
- <file>shaders/+glslcore/conicalgradient_nomask.frag</file>
- <file>shaders/+glslcore/conicalgradient_mask.frag</file>
- <file>shaders/+glslcore/desaturate.frag</file>
- <file>shaders/desaturate.frag</file>
- <file>shaders/+glslcore/displace.frag</file>
- <file>shaders/displace.frag</file>
- <file>shaders/+glslcore/fastblur.frag</file>
- <file>shaders/+glslcore/fastblur_internal.frag</file>
- <file>shaders/+glslcore/fastblur_internal.vert</file>
- <file>shaders/fastblur.frag</file>
- <file>shaders/fastblur_internal.frag</file>
- <file>shaders/fastblur_internal.vert</file>
- <file>shaders/gammaadjust.frag</file>
- <file>shaders/+glslcore/gammaadjust.frag</file>
- <file>shaders/huesaturation.frag</file>
- <file>shaders/+glslcore/huesaturation.frag</file>
- <file>shaders/leveladjust.frag</file>
- <file>shaders/+glslcore/leveladjust.frag</file>
- <file>shaders/lineargradient.vert</file>
- <file>shaders/lineargradient_nomask.frag</file>
- <file>shaders/lineargradient_mask.frag</file>
- <file>shaders/+glslcore/lineargradient.vert</file>
- <file>shaders/+glslcore/lineargradient_nomask.frag</file>
- <file>shaders/+glslcore/lineargradient_mask.frag</file>
- <file>shaders/opacitymask.frag</file>
- <file>shaders/+glslcore/opacitymask.frag</file>
- <file>shaders/+glslcore/opacitymask_invert.frag</file>
- <file>shaders/opacitymask_invert.frag</file>
- <file>shaders/radialgradient_nomask.frag</file>
- <file>shaders/radialgradient_mask.frag</file>
- <file>shaders/radialgradient.vert</file>
- <file>shaders/+glslcore/radialgradient_nomask.frag</file>
- <file>shaders/+glslcore/radialgradient_mask.frag</file>
- <file>shaders/+glslcore/radialgradient.vert</file>
- <file>shaders/rectangularglow.frag</file>
- <file>shaders/+glslcore/rectangularglow.frag</file>
- <file>shaders/recursiveblur.frag</file>
- <file>shaders/recursiveblur.vert</file>
- <file>shaders/+glslcore/recursiveblur.frag</file>
- <file>shaders/+glslcore/recursiveblur.vert</file>
- <file>shaders/thresholdmask.frag</file>
- <file>shaders/+glslcore/thresholdmask.frag</file>
- <file>shaders/fastglow.frag</file>
- <file>shaders/+glslcore/fastglow.frag</file>
- <file>shaders/fastinnershadow_level0.frag</file>
- <file>shaders/+glslcore/fastinnershadow_level0.frag</file>
- <file>shaders/fastinnershadow.frag</file>
- <file>shaders/+glslcore/fastinnershadow.frag</file>
- <file>shaders/fastmaskedblur.frag</file>
- <file>shaders/+glslcore/fastmaskedblur.frag</file>
- <file>shaders/gaussianinnershadow.frag</file>
- <file>shaders/gaussianinnershadow_shadow.frag</file>
- <file>shaders/+glslcore/gaussianinnershadow.frag</file>
- <file>shaders/+glslcore/gaussianinnershadow_shadow.frag</file>
+ <file>shaders_ng/opacitymask.frag.qsb</file>
+ <file>shaders_ng/opacitymask_invert.frag.qsb</file>
+ <file>shaders_ng/fastblur.frag.qsb</file>
+ <file>shaders_ng/fastblur_internal.vert.qsb</file>
+ <file>shaders_ng/fastblur_internal.frag.qsb</file>
+ <file>shaders_ng/fastglow.frag.qsb</file>
+ <file>shaders_ng/colorize.frag.qsb</file>
+ <file>shaders_ng/brightnesscontrast.frag.qsb</file>
+ <file>shaders_ng/coloroverlay.frag.qsb</file>
+ <file>shaders_ng/desaturate.frag.qsb</file>
+ <file>shaders_ng/displace.frag.qsb</file>
+ <file>shaders_ng/gammaadjust.frag.qsb</file>
+ <file>shaders_ng/huesaturation.frag.qsb</file>
+ <file>shaders_ng/rectangularglow.frag.qsb</file>
+ <file>shaders_ng/thresholdmask.frag.qsb</file>
+ <file>shaders_ng/conicalgradient_nomask.frag.qsb</file>
+ <file>shaders_ng/conicalgradient_mask.frag.qsb</file>
+ <file>shaders_ng/lineargradient.vert.qsb</file>
+ <file>shaders_ng/lineargradient_nomask.frag.qsb</file>
+ <file>shaders_ng/lineargradient_mask.frag.qsb</file>
+ <file>shaders_ng/radialgradient_nomask.frag.qsb</file>
+ <file>shaders_ng/radialgradient_mask.frag.qsb</file>
+ <file>shaders_ng/radialgradient.vert.qsb</file>
+ <file>shaders_ng/leveladjust.frag.qsb</file>
</qresource>
</RCC>
diff --git a/src/effects/shaders/+glslcore/coloroverlay.frag b/src/effects/shaders/+glslcore/coloroverlay.frag
deleted file mode 100644
index 68c15ab..0000000
--- a/src/effects/shaders/+glslcore/coloroverlay.frag
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform vec4 color;
-out vec4 fragColor;
-void main() {
- vec4 pixelColor = texture(source, qt_TexCoord0);
- fragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/conicalgradient_mask.frag b/src/effects/shaders/+glslcore/conicalgradient_mask.frag
deleted file mode 100644
index 5724ebb..0000000
--- a/src/effects/shaders/+glslcore/conicalgradient_mask.frag
+++ /dev/null
@@ -1,16 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform sampler2D gradientSource;
-uniform sampler2D maskSource;
-uniform float qt_Opacity;
-uniform float startAngle;
-uniform vec2 center;
-out vec4 fragColor;
-
-void main() {
- float maskAlpha = texture(maskSource, qt_TexCoord0).a;
- const float PI = 3.14159265;
- const float PIx2inv = 0.1591549;
- float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
- fragColor = texture(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/conicalgradient_nomask.frag b/src/effects/shaders/+glslcore/conicalgradient_nomask.frag
deleted file mode 100644
index 89a3278..0000000
--- a/src/effects/shaders/+glslcore/conicalgradient_nomask.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform sampler2D gradientSource;
-uniform float qt_Opacity;
-uniform float startAngle;
-uniform vec2 center;
-out vec4 fragColor;
-
-void main() {
- const float PI = 3.14159265;
- const float PIx2inv = 0.1591549;
- float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
- fragColor = texture(gradientSource, vec2(0.0, fract(a))) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/desaturate.frag b/src/effects/shaders/+glslcore/desaturate.frag
deleted file mode 100644
index c95c0a5..0000000
--- a/src/effects/shaders/+glslcore/desaturate.frag
+++ /dev/null
@@ -1,11 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform float desaturation;
-out vec4 fragColor;
-void main(void) {
- vec4 textureColor = texture(source, qt_TexCoord0.st);
- float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0;
- fragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/displace.frag b/src/effects/shaders/+glslcore/displace.frag
deleted file mode 100644
index 0a1ba7c..0000000
--- a/src/effects/shaders/+glslcore/displace.frag
+++ /dev/null
@@ -1,29 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform sampler2D displacementSource;
-uniform float displacement;
-uniform float xPixel;
-uniform float yPixel;
-out vec4 fragColor;
-
-float linearstep(float e0, float e1, float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- vec4 offset = texture(displacementSource, qt_TexCoord0);
- offset.xy -= vec2(0.5, 0.5);
- offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy));
- vec2 tx = qt_TexCoord0 + (vec2(-offset.x, offset.y) * displacement);
-
- float e1 = linearstep(0.0, xPixel, tx.x);
- float e2 = linearstep(0.0, yPixel, tx.y);
- float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x);
- float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y);
-
- vec4 sample = texture(source, tx);
- sample.rgb *= e1 * e2 * e3 * e4;
- fragColor = sample * qt_Opacity * offset.a;
-}
diff --git a/src/effects/shaders/+glslcore/fastblur.frag b/src/effects/shaders/+glslcore/fastblur.frag
deleted file mode 100644
index d80ba4e..0000000
--- a/src/effects/shaders/+glslcore/fastblur.frag
+++ /dev/null
@@ -1,23 +0,0 @@
-#version 150 core
-uniform sampler2D source1;
-uniform sampler2D source2;
-uniform sampler2D source3;
-uniform sampler2D source4;
-uniform sampler2D source5;
-uniform float weight1;
-uniform float weight2;
-uniform float weight3;
-uniform float weight4;
-uniform float weight5;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord0;
-out vec4 fragColor;
-
-void main() {
- vec4 sourceColor = texture(source1, qt_TexCoord0) * weight1;
- sourceColor += texture(source2, qt_TexCoord0) * weight2;
- sourceColor += texture(source3, qt_TexCoord0) * weight3;
- sourceColor += texture(source4, qt_TexCoord0) * weight4;
- sourceColor += texture(source5, qt_TexCoord0) * weight5;
- fragColor = sourceColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/fastblur_internal.frag b/src/effects/shaders/+glslcore/fastblur_internal.frag
deleted file mode 100644
index 444e8ca..0000000
--- a/src/effects/shaders/+glslcore/fastblur_internal.frag
+++ /dev/null
@@ -1,16 +0,0 @@
-#version 150 core
-uniform sampler2D source;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord0;
-in vec2 qt_TexCoord1;
-in vec2 qt_TexCoord2;
-in vec2 qt_TexCoord3;
-out vec4 fragColor;
-
-void main() {
- vec4 sourceColor = (texture(source, qt_TexCoord0) +
- texture(source, qt_TexCoord1) +
- texture(source, qt_TexCoord2) +
- texture(source, qt_TexCoord3)) * 0.25;
- fragColor = sourceColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/fastblur_internal.vert b/src/effects/shaders/+glslcore/fastblur_internal.vert
deleted file mode 100644
index 1ceb9a2..0000000
--- a/src/effects/shaders/+glslcore/fastblur_internal.vert
+++ /dev/null
@@ -1,18 +0,0 @@
-#version 150 core
-in vec4 qt_Vertex;
-in vec2 qt_MultiTexCoord0;
-uniform mat4 qt_Matrix;
-uniform float yStep;
-uniform float xStep;
-out vec2 qt_TexCoord0;
-out vec2 qt_TexCoord1;
-out vec2 qt_TexCoord2;
-out vec2 qt_TexCoord3;
-
-void main() {
- qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
- qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
- qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
- qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/+glslcore/fastglow.frag b/src/effects/shaders/+glslcore/fastglow.frag
deleted file mode 100644
index 4e18c45..0000000
--- a/src/effects/shaders/+glslcore/fastglow.frag
+++ /dev/null
@@ -1,30 +0,0 @@
-#version 150 core
-uniform sampler2D source1;
-uniform sampler2D source2;
-uniform sampler2D source3;
-uniform sampler2D source4;
-uniform sampler2D source5;
-uniform float weight1;
-uniform float weight2;
-uniform float weight3;
-uniform float weight4;
-uniform float weight5;
-uniform vec4 color;
-uniform float spread;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord0;
-out vec4 fragColor;
-
-float linearstep(float e0, float e1, float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- vec4 sourceColor = texture(source1, qt_TexCoord0) * weight1;
- sourceColor += texture(source2, qt_TexCoord0) * weight2;
- sourceColor += texture(source3, qt_TexCoord0) * weight3;
- sourceColor += texture(source4, qt_TexCoord0) * weight4;
- sourceColor += texture(source5, qt_TexCoord0) * weight5;
- sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
- fragColor = sourceColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/fastinnershadow.frag b/src/effects/shaders/+glslcore/fastinnershadow.frag
deleted file mode 100644
index cf3f166..0000000
--- a/src/effects/shaders/+glslcore/fastinnershadow.frag
+++ /dev/null
@@ -1,32 +0,0 @@
-#version 150 core
-uniform sampler2D original;
-uniform sampler2D source1;
-uniform sampler2D source2;
-uniform sampler2D source3;
-uniform sampler2D source4;
-uniform sampler2D source5;
-uniform float weight1;
-uniform float weight2;
-uniform float weight3;
-uniform float weight4;
-uniform float weight5;
-uniform vec4 color;
-uniform float spread;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord0;
-out vec4 fragColor;
-
-float linearstep(float e0, float e1, float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- vec4 shadowColor = texture(source1, qt_TexCoord0) * weight1;
- shadowColor += texture(source2, qt_TexCoord0) * weight2;
- shadowColor += texture(source3, qt_TexCoord0) * weight3;
- shadowColor += texture(source4, qt_TexCoord0) * weight4;
- shadowColor += texture(source5, qt_TexCoord0) * weight5;
- vec4 originalColor = texture(original, qt_TexCoord0);
- shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
- fragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/fastinnershadow_level0.frag b/src/effects/shaders/+glslcore/fastinnershadow_level0.frag
deleted file mode 100644
index 4449bb0..0000000
--- a/src/effects/shaders/+glslcore/fastinnershadow_level0.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform vec4 color;
-uniform float horizontalOffset;
-uniform float verticalOffset;
-out vec4 fragColor;
-
-void main(void) {
- vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
- float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
- float eb = 1.0 - ea;
- fragColor = (eb * color + ea * color * (1.0 - texture(source, pos).a)) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/fastmaskedblur.frag b/src/effects/shaders/+glslcore/fastmaskedblur.frag
deleted file mode 100644
index ae4d628..0000000
--- a/src/effects/shaders/+glslcore/fastmaskedblur.frag
+++ /dev/null
@@ -1,53 +0,0 @@
-#version 150 core
-uniform sampler2D mask;
-uniform sampler2D source1;
-uniform sampler2D source2;
-uniform sampler2D source3;
-uniform sampler2D source4;
-uniform sampler2D source5;
-uniform sampler2D source6;
-uniform float lod;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord0;
-out vec4 fragColor;
-
-float weight(float v) {
- if (v <= 0.0)
- return 1.0;
-
- if (v >= 0.5)
- return 0.0;
-
- return 1.0 - v * 2.0;
-}
-
-void main() {
-
- vec4 maskColor = texture(mask, qt_TexCoord0);
- float l = lod * maskColor.a;
-
- float w1 = weight(abs(l - 0.100));
- float w2 = weight(abs(l - 0.300));
- float w3 = weight(abs(l - 0.500));
- float w4 = weight(abs(l - 0.700));
- float w5 = weight(abs(l - 0.900));
- float w6 = weight(abs(l - 1.100));
-
- float sum = w1 + w2 + w3 + w4 + w5 + w6;
- float weight1 = w1 / sum;
- float weight2 = w2 / sum;
- float weight3 = w3 / sum;
- float weight4 = w4 / sum;
- float weight5 = w5 / sum;
- float weight6 = w6 / sum;
-
- vec4 sourceColor = texture(source1, qt_TexCoord0) * weight1;
- sourceColor += texture(source2, qt_TexCoord0) * weight2;
- sourceColor += texture(source3, qt_TexCoord0) * weight3;
- sourceColor += texture(source4, qt_TexCoord0) * weight4;
- sourceColor += texture(source5, qt_TexCoord0) * weight5;
- sourceColor += texture(source6, qt_TexCoord0) * weight6;
-
- fragColor = sourceColor * qt_Opacity;
-
-}
diff --git a/src/effects/shaders/+glslcore/gammaadjust.frag b/src/effects/shaders/+glslcore/gammaadjust.frag
deleted file mode 100644
index 7efdd89..0000000
--- a/src/effects/shaders/+glslcore/gammaadjust.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform float gamma;
-out vec4 fragColor;
-
-void main(void) {
- vec4 originalColor = texture(source, qt_TexCoord0.st);
- originalColor.rgb = originalColor.rgb / max(1.0/256.0, originalColor.a);
- vec3 adjustedColor = pow(originalColor.rgb, vec3(gamma));
- fragColor = vec4(adjustedColor * originalColor.a, originalColor.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/gaussianinnershadow.frag b/src/effects/shaders/+glslcore/gaussianinnershadow.frag
deleted file mode 100644
index 8b8c863..0000000
--- a/src/effects/shaders/+glslcore/gaussianinnershadow.frag
+++ /dev/null
@@ -1,19 +0,0 @@
-#version 150 core
-uniform sampler2D original;
-uniform sampler2D shadow;
-uniform float qt_Opacity;
-uniform float spread;
-uniform vec4 color;
-in vec2 qt_TexCoord0;
-out vec4 fragColor;
-
-float linearstep(float e0, float e1, float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main(void) {
- vec4 originalColor = texture(original, qt_TexCoord0);
- vec4 shadowColor = texture(shadow, qt_TexCoord0);
- shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
- fragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/gaussianinnershadow_shadow.frag b/src/effects/shaders/+glslcore/gaussianinnershadow_shadow.frag
deleted file mode 100644
index d511daf..0000000
--- a/src/effects/shaders/+glslcore/gaussianinnershadow_shadow.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 150 core
-uniform sampler2D original;
-uniform float qt_Opacity;
-uniform vec4 color;
-uniform float horizontalOffset;
-uniform float verticalOffset;
-in vec2 qt_TexCoord0;
-out vec4 fragColor;
-
-void main(void) {
- vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
- float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
- float eb = 1.0 - ea;
- fragColor = eb * color + ea * color * (1.0 - texture(original, pos).a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/lineargradient.vert b/src/effects/shaders/+glslcore/lineargradient.vert
deleted file mode 100644
index 4764f7e..0000000
--- a/src/effects/shaders/+glslcore/lineargradient.vert
+++ /dev/null
@@ -1,22 +0,0 @@
-#version 150 core
-in vec4 qt_Vertex;
-in vec2 qt_MultiTexCoord0;
-uniform mat4 qt_Matrix;
-out vec2 qt_TexCoord0;
-out vec2 qt_TexCoord1;
-uniform vec2 startPoint;
-uniform float l;
-uniform vec2 matrixData;
-
-void main() {
- mat2 rot = mat2(matrixData.y, -matrixData.x,
- matrixData.x, matrixData.y);
-
- qt_TexCoord0 = qt_MultiTexCoord0;
-
- qt_TexCoord1 = qt_MultiTexCoord0 * l;
- qt_TexCoord1 -= startPoint * l;
- qt_TexCoord1 *= rot;
-
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/+glslcore/lineargradient_mask.frag b/src/effects/shaders/+glslcore/lineargradient_mask.frag
deleted file mode 100644
index 351ff33..0000000
--- a/src/effects/shaders/+glslcore/lineargradient_mask.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-#version 150 core
-uniform sampler2D source;
-uniform sampler2D maskSource;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord0;
-in vec2 qt_TexCoord1;
-out vec4 fragColor;
-
-void main() {
- vec4 gradientColor = texture(source, qt_TexCoord1);
- float maskAlpha = texture(maskSource, qt_TexCoord0).a;
- fragColor = gradientColor * maskAlpha * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/lineargradient_nomask.frag b/src/effects/shaders/+glslcore/lineargradient_nomask.frag
deleted file mode 100644
index 4ca8ebe..0000000
--- a/src/effects/shaders/+glslcore/lineargradient_nomask.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 150 core
-uniform sampler2D source;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord1;
-out vec4 fragColor;
-
-void main() {
- fragColor = texture(source, qt_TexCoord1) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/opacitymask.frag b/src/effects/shaders/+glslcore/opacitymask.frag
deleted file mode 100644
index 629f82c..0000000
--- a/src/effects/shaders/+glslcore/opacitymask.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform sampler2D maskSource;
-out vec4 fragColor;
-void main(void) {
- fragColor = texture(source, qt_TexCoord0.st) * (texture(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/opacitymask_invert.frag b/src/effects/shaders/+glslcore/opacitymask_invert.frag
deleted file mode 100644
index c8090a4..0000000
--- a/src/effects/shaders/+glslcore/opacitymask_invert.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform sampler2D maskSource;
-out vec4 fragColor;
-void main(void) {
- fragColor = texture(source, qt_TexCoord0.st) * (1.0 - texture(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/radialgradient.vert b/src/effects/shaders/+glslcore/radialgradient.vert
deleted file mode 100644
index 8179122..0000000
--- a/src/effects/shaders/+glslcore/radialgradient.vert
+++ /dev/null
@@ -1,31 +0,0 @@
-#version 150 core
-in vec4 qt_Vertex;
-in vec2 qt_MultiTexCoord0;
-uniform mat4 qt_Matrix;
-uniform vec2 matrixData;
-uniform float horizontalRatio;
-uniform float verticalRatio;
-uniform vec2 center;
-out vec2 qt_TexCoord0;
-out vec2 qt_TexCoord1;
-out vec2 centerPoint;
-
-void main() {
- vec2 ratio = vec2(horizontalRatio, verticalRatio);
-
- // Rotation matrix
- mat2 rot = mat2(matrixData.y, -matrixData.x,
- matrixData.x, matrixData.y);
-
- qt_TexCoord0 = qt_MultiTexCoord0;
-
- qt_TexCoord1 = qt_MultiTexCoord0;
- qt_TexCoord1 -= center;
- qt_TexCoord1 *= rot;
- qt_TexCoord1 += center;
- qt_TexCoord1 *= ratio;
-
- centerPoint = center * ratio;
-
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/+glslcore/radialgradient_mask.frag b/src/effects/shaders/+glslcore/radialgradient_mask.frag
deleted file mode 100644
index 11a3395..0000000
--- a/src/effects/shaders/+glslcore/radialgradient_mask.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-#version 150 core
-uniform sampler2D gradientImage;
-uniform sampler2D maskSource;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord0;
-in vec2 qt_TexCoord1;
-in vec2 centerPoint;
-out vec4 fragColor;
-
-void main() {
- vec4 gradientColor = texture(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
- float maskAlpha = texture(maskSource, qt_TexCoord0).a;
- fragColor = gradientColor * maskAlpha * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/radialgradient_nomask.frag b/src/effects/shaders/+glslcore/radialgradient_nomask.frag
deleted file mode 100644
index 455777b..0000000
--- a/src/effects/shaders/+glslcore/radialgradient_nomask.frag
+++ /dev/null
@@ -1,11 +0,0 @@
-#version 150 core
-uniform sampler2D gradientImage;
-uniform float qt_Opacity;
-in vec2 qt_TexCoord1;
-in vec2 centerPoint;
-out vec4 fragColor;
-
-void main() {
- vec4 gradientColor = texture(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
- fragColor = gradientColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/rectangularglow.frag b/src/effects/shaders/+glslcore/rectangularglow.frag
deleted file mode 100644
index f749519..0000000
--- a/src/effects/shaders/+glslcore/rectangularglow.frag
+++ /dev/null
@@ -1,21 +0,0 @@
-#version 150 core
-uniform float qt_Opacity;
-uniform float relativeSizeX;
-uniform float relativeSizeY;
-uniform float spread;
-uniform vec4 color;
-in vec2 qt_TexCoord0;
-out vec4 fragColor;
-
-float linearstep(float e0, float e1, float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- float alpha =
- smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
- smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
-
- float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
- fragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
-}
diff --git a/src/effects/shaders/+glslcore/recursiveblur.frag b/src/effects/shaders/+glslcore/recursiveblur.frag
deleted file mode 100644
index ff47b7c..0000000
--- a/src/effects/shaders/+glslcore/recursiveblur.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-out vec4 fragColor;
-
-void main() {
- fragColor = texture(source, qt_TexCoord0) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/recursiveblur.vert b/src/effects/shaders/+glslcore/recursiveblur.vert
deleted file mode 100644
index 3dc3a0b..0000000
--- a/src/effects/shaders/+glslcore/recursiveblur.vert
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 150 core
-in vec4 qt_Vertex;
-in vec2 qt_MultiTexCoord0;
-uniform mat4 qt_Matrix;
-uniform float expandX;
-uniform float expandY;
-out vec2 qt_TexCoord0;
-
-void main() {
- vec2 texCoord = qt_MultiTexCoord0;
- texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
- texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
- qt_TexCoord0 = texCoord;
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/+glslcore/thresholdmask.frag b/src/effects/shaders/+glslcore/thresholdmask.frag
deleted file mode 100644
index 5b331d8..0000000
--- a/src/effects/shaders/+glslcore/thresholdmask.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform sampler2D maskSource;
-uniform float threshold;
-uniform float spread;
-out vec4 fragColor;
-
-void main(void) {
- vec4 colorFragment = texture(source, qt_TexCoord0.st);
- vec4 maskFragment = texture(maskSource, qt_TexCoord0.st);
- fragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/brightnesscontrast.frag b/src/effects/shaders/brightnesscontrast.frag
deleted file mode 100644
index 4a3d435..0000000
--- a/src/effects/shaders/brightnesscontrast.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-varying mediump vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform highp float brightness;
-uniform highp float contrast;
-void main() {
- highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
- pixelColor.rgb /= max(1.0/256.0, pixelColor.a);
- highp float c = 1.0 + contrast;
- highp float contrastGainFactor = 1.0 + c * c * c * c * step(0.0, contrast);
- pixelColor.rgb = ((pixelColor.rgb - 0.5) * (contrastGainFactor * contrast + 1.0)) + 0.5;
- pixelColor.rgb = mix(pixelColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
- gl_FragColor = vec4(pixelColor.rgb * pixelColor.a, pixelColor.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/colorize.frag b/src/effects/shaders/colorize.frag
deleted file mode 100644
index 88c3abc..0000000
--- a/src/effects/shaders/colorize.frag
+++ /dev/null
@@ -1,58 +0,0 @@
-varying mediump vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform highp float hue;
-uniform highp float saturation;
-uniform highp float lightness;
-
-highp float RGBtoL(highp vec3 color) {
- highp float cmin = min(color.r, min(color.g, color.b));
- highp float cmax = max(color.r, max(color.g, color.b));
- highp float l = (cmin + cmax) / 2.0;
- return l;
-}
-
-highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
- h = fract(h);
- if (h < 1.0 / 6.0)
- return v1 + (v2 - v1) * 6.0 * h;
- else if (h < 1.0 / 2.0)
- return v2;
- else if (h < 2.0 / 3.0)
- return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
-
- return v1;
-}
-
-highp vec3 HSLtoRGB(highp vec3 color) {
- highp float h = color.x;
- highp float l = color.z;
- highp float s = color.y;
-
- if (s < 1.0 / 256.0)
- return vec3(l, l, l);
-
- highp float v1;
- highp float v2;
- if (l < 0.5)
- v2 = l * (1.0 + s);
- else
- v2 = (l + s) - (s * l);
-
- v1 = 2.0 * l - v2;
-
- highp float d = 1.0 / 3.0;
- highp float r = hueToIntensity(v1, v2, h + d);
- highp float g = hueToIntensity(v1, v2, h);
- highp float b = hueToIntensity(v1, v2, h - d);
- return vec3(r, g, b);
-}
-
-void main() {
- lowp vec4 sample = texture2D(source, qt_TexCoord0);
- sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
- highp float light = RGBtoL(sample.rgb);
- highp float c = step(0.0, lightness);
- sample.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness))));
- gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/coloroverlay.frag b/src/effects/shaders/coloroverlay.frag
deleted file mode 100644
index a68d88c..0000000
--- a/src/effects/shaders/coloroverlay.frag
+++ /dev/null
@@ -1,8 +0,0 @@
-varying mediump vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform highp vec4 color;
-void main() {
- highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
- gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/conicalgradient_mask.frag b/src/effects/shaders/conicalgradient_mask.frag
deleted file mode 100644
index db78564..0000000
--- a/src/effects/shaders/conicalgradient_mask.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-varying mediump vec2 qt_TexCoord0;
-uniform lowp sampler2D gradientSource;
-uniform lowp sampler2D maskSource;
-uniform highp float qt_Opacity;
-uniform highp float startAngle;
-uniform highp vec2 center;
-
-void main() {
- lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
- const highp float PI = 3.14159265;
- const highp float PIx2inv = 0.1591549;
- highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
- gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity;
-}
diff --git a/src/effects/shaders/conicalgradient_nomask.frag b/src/effects/shaders/conicalgradient_nomask.frag
deleted file mode 100644
index 3f7d785..0000000
--- a/src/effects/shaders/conicalgradient_nomask.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-varying mediump vec2 qt_TexCoord0;
-uniform lowp sampler2D gradientSource;
-uniform highp float qt_Opacity;
-uniform highp float startAngle;
-uniform highp vec2 center;
-
-void main() {
- const highp float PI = 3.14159265;
- const highp float PIx2inv = 0.1591549;
- highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
- gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * qt_Opacity;
-}
diff --git a/src/effects/shaders/desaturate.frag b/src/effects/shaders/desaturate.frag
deleted file mode 100644
index c6491ca..0000000
--- a/src/effects/shaders/desaturate.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform highp float desaturation;
-void main(void) {
- lowp vec4 textureColor = texture2D(source, qt_TexCoord0.st);
- lowp float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0;
- gl_FragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity;
-}
diff --git a/src/effects/shaders/displace.frag b/src/effects/shaders/displace.frag
deleted file mode 100644
index e6ae990..0000000
--- a/src/effects/shaders/displace.frag
+++ /dev/null
@@ -1,27 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform lowp sampler2D displacementSource;
-uniform highp float displacement;
-uniform highp float xPixel;
-uniform highp float yPixel;
-
-highp float linearstep(highp float e0, highp float e1, highp float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- lowp vec4 offset = texture2D(displacementSource, qt_TexCoord0);
- offset.xy -= vec2(0.5, 0.5);
- offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy));
- highp vec2 tx = qt_TexCoord0 + (vec2(-offset.x, offset.y) * displacement);
-
- lowp float e1 = linearstep(0.0, xPixel, tx.x);
- lowp float e2 = linearstep(0.0, yPixel, tx.y);
- lowp float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x);
- lowp float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y);
-
- lowp vec4 sample = texture2D(source, tx);
- sample.rgb *= e1 * e2 * e3 * e4;
- gl_FragColor = sample * qt_Opacity * offset.a;
-}
diff --git a/src/effects/shaders/fastblur.frag b/src/effects/shaders/fastblur.frag
deleted file mode 100644
index 261127a..0000000
--- a/src/effects/shaders/fastblur.frag
+++ /dev/null
@@ -1,21 +0,0 @@
-uniform lowp sampler2D source1;
-uniform lowp sampler2D source2;
-uniform lowp sampler2D source3;
-uniform lowp sampler2D source4;
-uniform lowp sampler2D source5;
-uniform mediump float weight1;
-uniform mediump float weight2;
-uniform mediump float weight3;
-uniform mediump float weight4;
-uniform mediump float weight5;
-uniform lowp float qt_Opacity;
-varying mediump vec2 qt_TexCoord0;
-
-void main() {
- lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
- sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
- sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
- sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
- sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
- gl_FragColor = sourceColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/fastblur_internal.frag b/src/effects/shaders/fastblur_internal.frag
deleted file mode 100644
index c284326..0000000
--- a/src/effects/shaders/fastblur_internal.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-uniform lowp sampler2D source;
-uniform lowp float qt_Opacity;
-varying highp vec2 qt_TexCoord0;
-varying highp vec2 qt_TexCoord1;
-varying highp vec2 qt_TexCoord2;
-varying highp vec2 qt_TexCoord3;
-
-void main() {
- highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
- texture2D(source, qt_TexCoord1) +
- texture2D(source, qt_TexCoord2) +
- texture2D(source, qt_TexCoord3)) * 0.25;
- gl_FragColor = sourceColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/fastblur_internal.vert b/src/effects/shaders/fastblur_internal.vert
deleted file mode 100644
index aadfd68..0000000
--- a/src/effects/shaders/fastblur_internal.vert
+++ /dev/null
@@ -1,17 +0,0 @@
-attribute highp vec4 qt_Vertex;
-attribute highp vec2 qt_MultiTexCoord0;
-uniform highp mat4 qt_Matrix;
-uniform highp float yStep;
-uniform highp float xStep;
-varying highp vec2 qt_TexCoord0;
-varying highp vec2 qt_TexCoord1;
-varying highp vec2 qt_TexCoord2;
-varying highp vec2 qt_TexCoord3;
-
-void main() {
- qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
- qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
- qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
- qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/fastglow.frag b/src/effects/shaders/fastglow.frag
deleted file mode 100644
index 0eb3ece..0000000
--- a/src/effects/shaders/fastglow.frag
+++ /dev/null
@@ -1,28 +0,0 @@
-uniform lowp sampler2D source1;
-uniform lowp sampler2D source2;
-uniform lowp sampler2D source3;
-uniform lowp sampler2D source4;
-uniform lowp sampler2D source5;
-uniform mediump float weight1;
-uniform mediump float weight2;
-uniform mediump float weight3;
-uniform mediump float weight4;
-uniform mediump float weight5;
-uniform highp vec4 color;
-uniform highp float spread;
-uniform lowp float qt_Opacity;
-varying mediump vec2 qt_TexCoord0;
-
-highp float linearstep(highp float e0, highp float e1, highp float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
- sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
- sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
- sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
- sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
- sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
- gl_FragColor = sourceColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/fastinnershadow.frag b/src/effects/shaders/fastinnershadow.frag
deleted file mode 100644
index 323197e..0000000
--- a/src/effects/shaders/fastinnershadow.frag
+++ /dev/null
@@ -1,30 +0,0 @@
-uniform lowp sampler2D original;
-uniform lowp sampler2D source1;
-uniform lowp sampler2D source2;
-uniform lowp sampler2D source3;
-uniform lowp sampler2D source4;
-uniform lowp sampler2D source5;
-uniform mediump float weight1;
-uniform mediump float weight2;
-uniform mediump float weight3;
-uniform mediump float weight4;
-uniform mediump float weight5;
-uniform highp vec4 color;
-uniform highp float spread;
-uniform lowp float qt_Opacity;
-varying mediump vec2 qt_TexCoord0;
-
-highp float linearstep(highp float e0, highp float e1, highp float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- lowp vec4 shadowColor = texture2D(source1, qt_TexCoord0) * weight1;
- shadowColor += texture2D(source2, qt_TexCoord0) * weight2;
- shadowColor += texture2D(source3, qt_TexCoord0) * weight3;
- shadowColor += texture2D(source4, qt_TexCoord0) * weight4;
- shadowColor += texture2D(source5, qt_TexCoord0) * weight5;
- lowp vec4 originalColor = texture2D(original, qt_TexCoord0);
- shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
- gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
-}
diff --git a/src/effects/shaders/fastinnershadow_level0.frag b/src/effects/shaders/fastinnershadow_level0.frag
deleted file mode 100644
index 30a31ce..0000000
--- a/src/effects/shaders/fastinnershadow_level0.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform lowp float qt_Opacity;
-uniform highp sampler2D source;
-uniform lowp vec4 color;
-uniform highp float horizontalOffset;
-uniform highp float verticalOffset;
-
-void main(void) {
- highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
- lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
- lowp float eb = 1.0 - ea;
- gl_FragColor = (eb * color + ea * color * (1.0 - texture2D(source, pos).a)) * qt_Opacity;
-}
diff --git a/src/effects/shaders/fastmaskedblur.frag b/src/effects/shaders/fastmaskedblur.frag
deleted file mode 100644
index 9613012..0000000
--- a/src/effects/shaders/fastmaskedblur.frag
+++ /dev/null
@@ -1,51 +0,0 @@
-uniform lowp sampler2D mask;
-uniform lowp sampler2D source1;
-uniform lowp sampler2D source2;
-uniform lowp sampler2D source3;
-uniform lowp sampler2D source4;
-uniform lowp sampler2D source5;
-uniform lowp sampler2D source6;
-uniform lowp float lod;
-uniform lowp float qt_Opacity;
-varying mediump vec2 qt_TexCoord0;
-
-mediump float weight(mediump float v) {
- if (v <= 0.0)
- return 1.0;
-
- if (v >= 0.5)
- return 0.0;
-
- return 1.0 - v * 2.0;
-}
-
-void main() {
-
- lowp vec4 maskColor = texture2D(mask, qt_TexCoord0);
- mediump float l = lod * maskColor.a;
-
- mediump float w1 = weight(abs(l - 0.100));
- mediump float w2 = weight(abs(l - 0.300));
- mediump float w3 = weight(abs(l - 0.500));
- mediump float w4 = weight(abs(l - 0.700));
- mediump float w5 = weight(abs(l - 0.900));
- mediump float w6 = weight(abs(l - 1.100));
-
- mediump float sum = w1 + w2 + w3 + w4 + w5 + w6;
- mediump float weight1 = w1 / sum;
- mediump float weight2 = w2 / sum;
- mediump float weight3 = w3 / sum;
- mediump float weight4 = w4 / sum;
- mediump float weight5 = w5 / sum;
- mediump float weight6 = w6 / sum;
-
- lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
- sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
- sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
- sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
- sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
- sourceColor += texture2D(source6, qt_TexCoord0) * weight6;
-
- gl_FragColor = sourceColor * qt_Opacity;
-
-}
diff --git a/src/effects/shaders/gammaadjust.frag b/src/effects/shaders/gammaadjust.frag
deleted file mode 100644
index f87492a..0000000
--- a/src/effects/shaders/gammaadjust.frag
+++ /dev/null
@@ -1,10 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform highp float gamma;
-void main(void) {
- highp vec4 originalColor = texture2D(source, qt_TexCoord0.st);
- originalColor.rgb = originalColor.rgb / max(1.0/256.0, originalColor.a);
- highp vec3 adjustedColor = pow(originalColor.rgb, vec3(gamma));
- gl_FragColor = vec4(adjustedColor * originalColor.a, originalColor.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/gaussianinnershadow.frag b/src/effects/shaders/gaussianinnershadow.frag
deleted file mode 100644
index c9f57a6..0000000
--- a/src/effects/shaders/gaussianinnershadow.frag
+++ /dev/null
@@ -1,17 +0,0 @@
-uniform highp sampler2D original;
-uniform highp sampler2D shadow;
-uniform lowp float qt_Opacity;
-uniform highp float spread;
-uniform lowp vec4 color;
-varying highp vec2 qt_TexCoord0;
-
-highp float linearstep(highp float e0, highp float e1, highp float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main(void) {
- lowp vec4 originalColor = texture2D(original, qt_TexCoord0);
- lowp vec4 shadowColor = texture2D(shadow, qt_TexCoord0);
- shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
- gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
-}
diff --git a/src/effects/shaders/gaussianinnershadow_shadow.frag b/src/effects/shaders/gaussianinnershadow_shadow.frag
deleted file mode 100644
index fc95dd6..0000000
--- a/src/effects/shaders/gaussianinnershadow_shadow.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-uniform highp sampler2D original;
-uniform lowp float qt_Opacity;
-uniform lowp vec4 color;
-uniform highp float horizontalOffset;
-uniform highp float verticalOffset;
-varying highp vec2 qt_TexCoord0;
-
-void main(void) {
- highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
- lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
- lowp float eb = 1.0 - ea;
- gl_FragColor = eb * color + ea * color * (1.0 - texture2D(original, pos).a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/huesaturation.frag b/src/effects/shaders/huesaturation.frag
deleted file mode 100644
index c6073be..0000000
--- a/src/effects/shaders/huesaturation.frag
+++ /dev/null
@@ -1,77 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform highp sampler2D source;
-uniform highp vec3 hsl;
-
-highp vec3 RGBtoHSL(highp vec3 color) {
- highp float cmin = min(color.r, min(color.g, color.b));
- highp float cmax = max(color.r, max(color.g, color.b));
- highp float h = 0.0;
- highp float s = 0.0;
- highp float l = (cmin + cmax) / 2.0;
- highp float diff = cmax - cmin;
-
- if (diff > 1.0 / 256.0) {
- if (l < 0.5)
- s = diff / (cmin + cmax);
- else
- s = diff / (2.0 - (cmin + cmax));
-
- if (color.r == cmax)
- h = (color.g - color.b) / diff;
- else if (color.g == cmax)
- h = 2.0 + (color.b - color.r) / diff;
- else
- h = 4.0 + (color.r - color.g) / diff;
-
- h /= 6.0;
- }
- return vec3(h, s, l);
-}
-
-highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
- h = fract(h);
- if (h < 1.0 / 6.0)
- return v1 + (v2 - v1) * 6.0 * h;
- else if (h < 1.0 / 2.0)
- return v2;
- else if (h < 2.0 / 3.0)
- return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
-
- return v1;
-}
-
-highp vec3 HSLtoRGB(highp vec3 color) {
- highp float h = color.x;
- highp float l = color.z;
- highp float s = color.y;
-
- if (s < 1.0 / 256.0)
- return vec3(l);
-
- highp float v1;
- highp float v2;
- if (l < 0.5)
- v2 = l * (1.0 + s);
- else
- v2 = (l + s) - (s * l);
-
- v1 = 2.0 * l - v2;
-
- highp float d = 1.0 / 3.0;
- highp float r = hueToIntensity(v1, v2, h + d);
- highp float g = hueToIntensity(v1, v2, h);
- highp float b = hueToIntensity(v1, v2, h - d);
- return vec3(r, g, b);
-}
-
-void main() {
- lowp vec4 sample = texture2D(source, qt_TexCoord0);
- sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
- sample.rgb = mix(vec3(dot(sample.rgb, vec3(0.2125, 0.7154, 0.0721))), sample.rgb, 1.0 + hsl.y);
- sample.xyz = RGBtoHSL(sample.rgb);
- sample.rgb = HSLtoRGB(vec3(sample.x + hsl.x, sample.y, sample.z));
- highp float c = step(0.0, hsl.z);
- sample.rgb = mix(sample.rgb, vec3(c), abs(hsl.z));
- gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/leveladjust.frag b/src/effects/shaders/leveladjust.frag
deleted file mode 100644
index 9462a0c..0000000
--- a/src/effects/shaders/leveladjust.frag
+++ /dev/null
@@ -1,35 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform highp vec3 minimumInputRGB;
-uniform highp vec3 maximumInputRGB;
-uniform highp float minimumInputAlpha;
-uniform highp float maximumInputAlpha;
-uniform highp vec3 minimumOutputRGB;
-uniform highp vec3 maximumOutputRGB;
-uniform highp float minimumOutputAlpha;
-uniform highp float maximumOutputAlpha;
-uniform highp vec3 gamma;
-
-highp float linearstep(highp float e0, highp float e1, highp float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main(void) {
- highp vec4 textureColor = texture2D(source, qt_TexCoord0.st);
- highp vec4 color = vec4(textureColor.rgb / max(1.0/256.0, textureColor.a), textureColor.a);
-
- color.r = linearstep(minimumInputRGB.r, maximumInputRGB.r, color.r);
- color.g = linearstep(minimumInputRGB.g, maximumInputRGB.g, color.g);
- color.b = linearstep(minimumInputRGB.b, maximumInputRGB.b, color.b);
- color.a = linearstep(minimumInputAlpha, maximumInputAlpha, color.a);
-
- color.rgb = pow(color.rgb, gamma);
-
- color.r = minimumOutputRGB.r + color.r * (maximumOutputRGB.r - minimumOutputRGB.r);
- color.g = minimumOutputRGB.g + color.g * (maximumOutputRGB.g - minimumOutputRGB.g);
- color.b = minimumOutputRGB.b + color.b * (maximumOutputRGB.b - minimumOutputRGB.b);
- color.a = minimumOutputAlpha + color.a * (maximumOutputAlpha - minimumOutputAlpha);
-
- gl_FragColor = vec4(color.rgb * color.a, color.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/lineargradient.vert b/src/effects/shaders/lineargradient.vert
deleted file mode 100644
index e01854c..0000000
--- a/src/effects/shaders/lineargradient.vert
+++ /dev/null
@@ -1,21 +0,0 @@
-attribute highp vec4 qt_Vertex;
-attribute highp vec2 qt_MultiTexCoord0;
-uniform highp mat4 qt_Matrix;
-varying highp vec2 qt_TexCoord0;
-varying highp vec2 qt_TexCoord1;
-uniform highp vec2 startPoint;
-uniform highp float l;
-uniform highp vec2 matrixData;
-
-void main() {
- highp mat2 rot = mat2(matrixData.y, -matrixData.x,
- matrixData.x, matrixData.y);
-
- qt_TexCoord0 = qt_MultiTexCoord0;
-
- qt_TexCoord1 = qt_MultiTexCoord0 * l;
- qt_TexCoord1 -= startPoint * l;
- qt_TexCoord1 *= rot;
-
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/lineargradient_mask.frag b/src/effects/shaders/lineargradient_mask.frag
deleted file mode 100644
index 0fed39f..0000000
--- a/src/effects/shaders/lineargradient_mask.frag
+++ /dev/null
@@ -1,11 +0,0 @@
-uniform lowp sampler2D source;
-uniform lowp sampler2D maskSource;
-uniform lowp float qt_Opacity;
-varying highp vec2 qt_TexCoord0;
-varying highp vec2 qt_TexCoord1;
-
-void main() {
- lowp vec4 gradientColor = texture2D(source, qt_TexCoord1);
- lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
- gl_FragColor = gradientColor * maskAlpha * qt_Opacity;
-}
diff --git a/src/effects/shaders/lineargradient_nomask.frag b/src/effects/shaders/lineargradient_nomask.frag
deleted file mode 100644
index ada02db..0000000
--- a/src/effects/shaders/lineargradient_nomask.frag
+++ /dev/null
@@ -1,7 +0,0 @@
-uniform lowp sampler2D source;
-uniform lowp float qt_Opacity;
-varying highp vec2 qt_TexCoord1;
-
-void main() {
- gl_FragColor = texture2D(source, qt_TexCoord1) * qt_Opacity;
-}
diff --git a/src/effects/shaders/opacitymask.frag b/src/effects/shaders/opacitymask.frag
deleted file mode 100644
index 84f9bc3..0000000
--- a/src/effects/shaders/opacitymask.frag
+++ /dev/null
@@ -1,7 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform lowp sampler2D maskSource;
-void main(void) {
- gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/opacitymask_invert.frag b/src/effects/shaders/opacitymask_invert.frag
deleted file mode 100644
index e48c78e..0000000
--- a/src/effects/shaders/opacitymask_invert.frag
+++ /dev/null
@@ -1,7 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform lowp sampler2D maskSource;
-void main(void) {
- gl_FragColor = texture2D(source, qt_TexCoord0.st) * (1.0 - texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/radialgradient.vert b/src/effects/shaders/radialgradient.vert
deleted file mode 100644
index ce69586..0000000
--- a/src/effects/shaders/radialgradient.vert
+++ /dev/null
@@ -1,30 +0,0 @@
-attribute highp vec4 qt_Vertex;
-attribute highp vec2 qt_MultiTexCoord0;
-uniform highp mat4 qt_Matrix;
-uniform highp vec2 matrixData;
-uniform highp float horizontalRatio;
-uniform highp float verticalRatio;
-uniform highp vec2 center;
-varying highp vec2 qt_TexCoord0;
-varying highp vec2 qt_TexCoord1;
-varying highp vec2 centerPoint;
-
-void main() {
- highp vec2 ratio = vec2(horizontalRatio, verticalRatio);
-
- // Rotation matrix
- highp mat2 rot = mat2(matrixData.y, -matrixData.x,
- matrixData.x, matrixData.y);
-
- qt_TexCoord0 = qt_MultiTexCoord0;
-
- qt_TexCoord1 = qt_MultiTexCoord0;
- qt_TexCoord1 -= center;
- qt_TexCoord1 *= rot;
- qt_TexCoord1 += center;
- qt_TexCoord1 *= ratio;
-
- centerPoint = center * ratio;
-
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/radialgradient_mask.frag b/src/effects/shaders/radialgradient_mask.frag
deleted file mode 100644
index 5911753..0000000
--- a/src/effects/shaders/radialgradient_mask.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-uniform lowp sampler2D gradientImage;
-uniform lowp sampler2D maskSource;
-uniform lowp float qt_Opacity;
-varying highp vec2 qt_TexCoord0;
-varying highp vec2 qt_TexCoord1;
-varying highp vec2 centerPoint;
-
-void main() {
- lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
- lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
- gl_FragColor = gradientColor * maskAlpha * qt_Opacity;
-}
diff --git a/src/effects/shaders/radialgradient_nomask.frag b/src/effects/shaders/radialgradient_nomask.frag
deleted file mode 100644
index cf92236..0000000
--- a/src/effects/shaders/radialgradient_nomask.frag
+++ /dev/null
@@ -1,10 +0,0 @@
-
-uniform lowp sampler2D gradientImage;
-uniform lowp float qt_Opacity;
-varying highp vec2 qt_TexCoord1;
-varying highp vec2 centerPoint;
-
-void main() {
- lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
- gl_FragColor = gradientColor * qt_Opacity;
-}
diff --git a/src/effects/shaders/rectangularglow.frag b/src/effects/shaders/rectangularglow.frag
deleted file mode 100644
index 40bab58..0000000
--- a/src/effects/shaders/rectangularglow.frag
+++ /dev/null
@@ -1,19 +0,0 @@
-uniform highp float qt_Opacity;
-uniform mediump float relativeSizeX;
-uniform mediump float relativeSizeY;
-uniform mediump float spread;
-uniform lowp vec4 color;
-varying highp vec2 qt_TexCoord0;
-
-highp float linearstep(highp float e0, highp float e1, highp float x) {
- return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
-}
-
-void main() {
- lowp float alpha =
- smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
- smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
-
- highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
- gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
-}
diff --git a/src/effects/shaders/recursiveblur.frag b/src/effects/shaders/recursiveblur.frag
deleted file mode 100644
index 5562929..0000000
--- a/src/effects/shaders/recursiveblur.frag
+++ /dev/null
@@ -1,6 +0,0 @@
-varying mediump vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-void main() {
- gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;
-}
diff --git a/src/effects/shaders/recursiveblur.vert b/src/effects/shaders/recursiveblur.vert
deleted file mode 100644
index 67f64e1..0000000
--- a/src/effects/shaders/recursiveblur.vert
+++ /dev/null
@@ -1,14 +0,0 @@
-attribute highp vec4 qt_Vertex;
-attribute highp vec2 qt_MultiTexCoord0;
-uniform highp mat4 qt_Matrix;
-uniform highp float expandX;
-uniform highp float expandY;
-varying highp vec2 qt_TexCoord0;
-
-void main() {
- mediump vec2 texCoord = qt_MultiTexCoord0;
- texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
- texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
- qt_TexCoord0 = texCoord;
- gl_Position = qt_Matrix * qt_Vertex;
-}
diff --git a/src/effects/shaders/thresholdmask.frag b/src/effects/shaders/thresholdmask.frag
deleted file mode 100644
index b979589..0000000
--- a/src/effects/shaders/thresholdmask.frag
+++ /dev/null
@@ -1,11 +0,0 @@
-varying highp vec2 qt_TexCoord0;
-uniform highp float qt_Opacity;
-uniform lowp sampler2D source;
-uniform lowp sampler2D maskSource;
-uniform highp float threshold;
-uniform highp float spread;
-void main(void) {
- lowp vec4 colorFragment = texture2D(source, qt_TexCoord0.st);
- lowp vec4 maskFragment = texture2D(maskSource, qt_TexCoord0.st);
- gl_FragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity;
-}
diff --git a/src/effects/shaders/+glslcore/brightnesscontrast.frag b/src/effects/shaders_ng/brightnesscontrast.frag
index 414e268..c9ae173 100644
--- a/src/effects/shaders/+glslcore/brightnesscontrast.frag
+++ b/src/effects/shaders_ng/brightnesscontrast.frag
@@ -1,12 +1,21 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform float brightness;
-uniform float contrast;
-out vec4 fragColor;
+#version 440
-void main() {
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float brightness;
+ float contrast;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+void main()
+{
vec4 pixelColor = texture(source, qt_TexCoord0);
pixelColor.rgb /= max(1.0/256.0, pixelColor.a);
float c = 1.0 + contrast;
diff --git a/src/effects/shaders_ng/brightnesscontrast.frag.qsb b/src/effects/shaders_ng/brightnesscontrast.frag.qsb
new file mode 100644
index 0000000..2fc9761
--- /dev/null
+++ b/src/effects/shaders_ng/brightnesscontrast.frag.qsb
Binary files differ
diff --git a/src/effects/shaders/+glslcore/colorize.frag b/src/effects/shaders_ng/colorize.frag
index 67496c6..a109a45 100644
--- a/src/effects/shaders/+glslcore/colorize.frag
+++ b/src/effects/shaders_ng/colorize.frag
@@ -1,20 +1,30 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform float hue;
-uniform float saturation;
-uniform float lightness;
-out vec4 fragColor;
-
-float RGBtoL(vec3 color) {
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float hue;
+ float saturation;
+ float lightness;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+float RGBtoL(vec3 color)
+{
float cmin = min(color.r, min(color.g, color.b));
float cmax = max(color.r, max(color.g, color.b));
float l = (cmin + cmax) / 2.0;
return l;
}
-float hueToIntensity(float v1, float v2, float h) {
+float hueToIntensity(float v1, float v2, float h)
+{
h = fract(h);
if (h < 1.0 / 6.0)
return v1 + (v2 - v1) * 6.0 * h;
@@ -26,7 +36,8 @@ float hueToIntensity(float v1, float v2, float h) {
return v1;
}
-vec3 HSLtoRGB(vec3 color) {
+vec3 HSLtoRGB(vec3 color)
+{
float h = color.x;
float l = color.z;
float s = color.y;
@@ -50,11 +61,12 @@ vec3 HSLtoRGB(vec3 color) {
return vec3(r, g, b);
}
-void main() {
- vec4 sample = texture(source, qt_TexCoord0);
- sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
- float light = RGBtoL(sample.rgb);
+void main()
+{
+ vec4 samp = texture(source, qt_TexCoord0);
+ samp = vec4(samp.rgb / max(1.0/256.0, samp.a), samp.a);
+ float light = RGBtoL(samp.rgb);
float c = step(0.0, lightness);
- sample.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness))));
- fragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
+ samp.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness))));
+ fragColor = vec4(samp.rgb * samp.a, samp.a) * qt_Opacity;
}
diff --git a/src/effects/shaders_ng/colorize.frag.qsb b/src/effects/shaders_ng/colorize.frag.qsb
new file mode 100644
index 0000000..eb55cb3
--- /dev/null
+++ b/src/effects/shaders_ng/colorize.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/coloroverlay.frag b/src/effects/shaders_ng/coloroverlay.frag
new file mode 100644
index 0000000..5ec1666
--- /dev/null
+++ b/src/effects/shaders_ng/coloroverlay.frag
@@ -0,0 +1,20 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec4 color;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+void main()
+{
+ vec4 pixelColor = texture(source, qt_TexCoord0);
+ fragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/coloroverlay.frag.qsb b/src/effects/shaders_ng/coloroverlay.frag.qsb
new file mode 100644
index 0000000..e1eb955
--- /dev/null
+++ b/src/effects/shaders_ng/coloroverlay.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/compile.bat b/src/effects/shaders_ng/compile.bat
new file mode 100644
index 0000000..cb0e222
--- /dev/null
+++ b/src/effects/shaders_ng/compile.bat
@@ -0,0 +1,66 @@
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2020 The Qt Company Ltd.
+:: Contact: https://www.qt.io/licensing/
+::
+:: This file is part of the QtQuick module of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:LGPL$
+:: Commercial License Usage
+:: Licensees holding valid commercial Qt licenses may use this file in
+:: accordance with the commercial license agreement provided with the
+:: Software or, alternatively, in accordance with the terms contained in
+:: a written agreement between you and The Qt Company. For licensing terms
+:: and conditions see https://www.qt.io/terms-conditions. For further
+:: information use the contact form at https://www.qt.io/contact-us.
+::
+:: GNU Lesser General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU Lesser
+:: General Public License version 3 as published by the Free Software
+:: Foundation and appearing in the file LICENSE.LGPL3 included in the
+:: packaging of this file. Please review the following information to
+:: ensure the GNU Lesser General Public License version 3 requirements
+:: will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+::
+:: GNU General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU
+:: General Public License version 2.0 or (at your option) the GNU General
+:: Public license version 3 or any later version approved by the KDE Free
+:: Qt Foundation. The licenses are as published by the Free Software
+:: Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+:: included in the packaging of this file. Please review the following
+:: information to ensure the GNU General Public License requirements will
+:: be met: https://www.gnu.org/licenses/gpl-2.0.html and
+:: https://www.gnu.org/licenses/gpl-3.0.html.
+::
+:: $QT_END_LICENSE$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+:: For HLSL we invoke fxc.exe (-c argument) and store the resulting intermediate format
+:: instead of HLSL source, so this needs to be run on Windows from a developer command prompt.
+
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o opacitymask.frag.qsb opacitymask.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o opacitymask_invert.frag.qsb opacitymask_invert.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o fastblur.frag.qsb fastblur.frag
+qsb -b --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o fastblur_internal.vert.qsb fastblur_internal.vert
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o fastblur_internal.frag.qsb fastblur_internal.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o fastglow.frag.qsb fastglow.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o colorize.frag.qsb colorize.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o brightnesscontrast.frag.qsb brightnesscontrast.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o coloroverlay.frag.qsb coloroverlay.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o desaturate.frag.qsb desaturate.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o displace.frag.qsb displace.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o gammaadjust.frag.qsb gammaadjust.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o huesaturation.frag.qsb huesaturation.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o rectangularglow.frag.qsb rectangularglow.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o thresholdmask.frag.qsb thresholdmask.frag
+qsb -b --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o lineargradient.vert.qsb lineargradient.vert
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o lineargradient_nomask.frag.qsb lineargradient_nomask.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o lineargradient_mask.frag.qsb lineargradient_mask.frag
+qsb -b --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o radialgradient.vert.qsb radialgradient.vert
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o radialgradient_nomask.frag.qsb radialgradient_nomask.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o radialgradient_mask.frag.qsb radialgradient_mask.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o conicalgradient_nomask.frag.qsb conicalgradient_nomask.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o conicalgradient_mask.frag.qsb conicalgradient_mask.frag
+qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o leveladjust.frag.qsb leveladjust.frag
diff --git a/src/effects/shaders_ng/conicalgradient_mask.frag b/src/effects/shaders_ng/conicalgradient_mask.frag
new file mode 100644
index 0000000..5c1f2ed
--- /dev/null
+++ b/src/effects/shaders_ng/conicalgradient_mask.frag
@@ -0,0 +1,25 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 center;
+ float startAngle;
+};
+
+layout(binding = 1) uniform sampler2D gradientSource;
+layout(binding = 2) uniform sampler2D maskSource;
+
+void main()
+{
+ float maskAlpha = texture(maskSource, qt_TexCoord0).a;
+ const float PI = 3.14159265;
+ const float PIx2inv = 0.1591549;
+ float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
+ fragColor = texture(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/conicalgradient_mask.frag.qsb b/src/effects/shaders_ng/conicalgradient_mask.frag.qsb
new file mode 100644
index 0000000..f0ce8e7
--- /dev/null
+++ b/src/effects/shaders_ng/conicalgradient_mask.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/conicalgradient_nomask.frag b/src/effects/shaders_ng/conicalgradient_nomask.frag
new file mode 100644
index 0000000..b63d7e6
--- /dev/null
+++ b/src/effects/shaders_ng/conicalgradient_nomask.frag
@@ -0,0 +1,23 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 center;
+ float startAngle;
+};
+
+layout(binding = 1) uniform sampler2D gradientSource;
+
+void main()
+{
+ const float PI = 3.14159265;
+ const float PIx2inv = 0.1591549;
+ float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
+ fragColor = texture(gradientSource, vec2(0.0, fract(a))) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/conicalgradient_nomask.frag.qsb b/src/effects/shaders_ng/conicalgradient_nomask.frag.qsb
new file mode 100644
index 0000000..d074e61
--- /dev/null
+++ b/src/effects/shaders_ng/conicalgradient_nomask.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/desaturate.frag b/src/effects/shaders_ng/desaturate.frag
new file mode 100644
index 0000000..b54b3ac
--- /dev/null
+++ b/src/effects/shaders_ng/desaturate.frag
@@ -0,0 +1,21 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float desaturation;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+void main(void)
+{
+ vec4 textureColor = texture(source, qt_TexCoord0.st);
+ float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0;
+ fragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/desaturate.frag.qsb b/src/effects/shaders_ng/desaturate.frag.qsb
new file mode 100644
index 0000000..8a0b4da
--- /dev/null
+++ b/src/effects/shaders_ng/desaturate.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/displace.frag b/src/effects/shaders_ng/displace.frag
new file mode 100644
index 0000000..df6bc78
--- /dev/null
+++ b/src/effects/shaders_ng/displace.frag
@@ -0,0 +1,39 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float displacement;
+ float xPixel;
+ float yPixel;
+};
+
+layout(binding = 1) uniform sampler2D source;
+layout(binding = 2) uniform sampler2D displacementSource;
+
+float linearstep(float e0, float e1, float x)
+{
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+}
+
+void main()
+{
+ vec4 offset = texture(displacementSource, qt_TexCoord0);
+ offset.xy -= vec2(0.5, 0.5);
+ offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy));
+ vec2 tx = qt_TexCoord0 + (vec2(-offset.x, offset.y) * displacement);
+
+ float e1 = linearstep(0.0, xPixel, tx.x);
+ float e2 = linearstep(0.0, yPixel, tx.y);
+ float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x);
+ float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y);
+
+ vec4 samp = texture(source, tx);
+ samp.rgb *= e1 * e2 * e3 * e4;
+ fragColor = samp * qt_Opacity * offset.a;
+}
diff --git a/src/effects/shaders_ng/displace.frag.qsb b/src/effects/shaders_ng/displace.frag.qsb
new file mode 100644
index 0000000..3c3656c
--- /dev/null
+++ b/src/effects/shaders_ng/displace.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/fastblur.frag b/src/effects/shaders_ng/fastblur.frag
new file mode 100644
index 0000000..6e2ca14
--- /dev/null
+++ b/src/effects/shaders_ng/fastblur.frag
@@ -0,0 +1,32 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float weight1;
+ float weight2;
+ float weight3;
+ float weight4;
+ float weight5;
+};
+
+layout(binding = 1) uniform sampler2D source1;
+layout(binding = 2) uniform sampler2D source2;
+layout(binding = 3) uniform sampler2D source3;
+layout(binding = 4) uniform sampler2D source4;
+layout(binding = 5) uniform sampler2D source5;
+
+void main()
+{
+ vec4 sourceColor = texture(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture(source5, qt_TexCoord0) * weight5;
+ fragColor = sourceColor * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/fastblur.frag.qsb b/src/effects/shaders_ng/fastblur.frag.qsb
new file mode 100644
index 0000000..24c623a
--- /dev/null
+++ b/src/effects/shaders_ng/fastblur.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/fastblur_internal.frag b/src/effects/shaders_ng/fastblur_internal.frag
new file mode 100644
index 0000000..7a608de
--- /dev/null
+++ b/src/effects/shaders_ng/fastblur_internal.frag
@@ -0,0 +1,25 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 1) in vec2 qt_TexCoord1;
+layout(location = 2) in vec2 qt_TexCoord2;
+layout(location = 3) in vec2 qt_TexCoord3;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float xStep;
+ float yStep;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+void main()
+{
+ vec4 sourceColor = (texture(source, qt_TexCoord0) +
+ texture(source, qt_TexCoord1) +
+ texture(source, qt_TexCoord2) +
+ texture(source, qt_TexCoord3)) * 0.25;
+ fragColor = sourceColor * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/fastblur_internal.frag.qsb b/src/effects/shaders_ng/fastblur_internal.frag.qsb
new file mode 100644
index 0000000..fd439c8
--- /dev/null
+++ b/src/effects/shaders_ng/fastblur_internal.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/fastblur_internal.vert b/src/effects/shaders_ng/fastblur_internal.vert
new file mode 100644
index 0000000..e9a14b0
--- /dev/null
+++ b/src/effects/shaders_ng/fastblur_internal.vert
@@ -0,0 +1,27 @@
+#version 440
+
+layout(location = 0) in vec4 qt_Vertex;
+layout(location = 1) in vec2 qt_MultiTexCoord0;
+
+layout(location = 0) out vec2 qt_TexCoord0;
+layout(location = 1) out vec2 qt_TexCoord1;
+layout(location = 2) out vec2 qt_TexCoord2;
+layout(location = 3) out vec2 qt_TexCoord3;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float xStep;
+ float yStep;
+};
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+}
diff --git a/src/effects/shaders_ng/fastblur_internal.vert.qsb b/src/effects/shaders_ng/fastblur_internal.vert.qsb
new file mode 100644
index 0000000..96781b8
--- /dev/null
+++ b/src/effects/shaders_ng/fastblur_internal.vert.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/fastglow.frag b/src/effects/shaders_ng/fastglow.frag
new file mode 100644
index 0000000..fa19239
--- /dev/null
+++ b/src/effects/shaders_ng/fastglow.frag
@@ -0,0 +1,40 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec4 color;
+ float spread;
+ float weight1;
+ float weight2;
+ float weight3;
+ float weight4;
+ float weight5;
+};
+
+layout(binding = 1) uniform sampler2D source1;
+layout(binding = 2) uniform sampler2D source2;
+layout(binding = 3) uniform sampler2D source3;
+layout(binding = 4) uniform sampler2D source4;
+layout(binding = 5) uniform sampler2D source5;
+
+float linearstep(float e0, float e1, float x)
+{
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+}
+
+void main()
+{
+ vec4 sourceColor = texture(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture(source5, qt_TexCoord0) * weight5;
+ sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
+ fragColor = sourceColor * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/fastglow.frag.qsb b/src/effects/shaders_ng/fastglow.frag.qsb
new file mode 100644
index 0000000..d78cd6d
--- /dev/null
+++ b/src/effects/shaders_ng/fastglow.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/gammaadjust.frag b/src/effects/shaders_ng/gammaadjust.frag
new file mode 100644
index 0000000..0a1175a
--- /dev/null
+++ b/src/effects/shaders_ng/gammaadjust.frag
@@ -0,0 +1,22 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float gamma;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+void main()
+{
+ vec4 originalColor = texture(source, qt_TexCoord0.st);
+ originalColor.rgb = originalColor.rgb / max(1.0/256.0, originalColor.a);
+ vec3 adjustedColor = pow(originalColor.rgb, vec3(gamma));
+ fragColor = vec4(adjustedColor * originalColor.a, originalColor.a) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/gammaadjust.frag.qsb b/src/effects/shaders_ng/gammaadjust.frag.qsb
new file mode 100644
index 0000000..40ab6c1
--- /dev/null
+++ b/src/effects/shaders_ng/gammaadjust.frag.qsb
Binary files differ
diff --git a/src/effects/shaders/+glslcore/huesaturation.frag b/src/effects/shaders_ng/huesaturation.frag
index c593dcb..0b1e10e 100644
--- a/src/effects/shaders/+glslcore/huesaturation.frag
+++ b/src/effects/shaders_ng/huesaturation.frag
@@ -1,11 +1,20 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform vec3 hsl;
-out vec4 fragColor;
+#version 440
-vec3 RGBtoHSL(vec3 color) {
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec3 hsl;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+vec3 RGBtoHSL(vec3 color)
+{
float cmin = min(color.r, min(color.g, color.b));
float cmax = max(color.r, max(color.g, color.b));
float h = 0.0;
@@ -31,7 +40,8 @@ vec3 RGBtoHSL(vec3 color) {
return vec3(h, s, l);
}
-float hueToIntensity(float v1, float v2, float h) {
+float hueToIntensity(float v1, float v2, float h)
+{
h = fract(h);
if (h < 1.0 / 6.0)
return v1 + (v2 - v1) * 6.0 * h;
@@ -43,7 +53,8 @@ float hueToIntensity(float v1, float v2, float h) {
return v1;
}
-vec3 HSLtoRGB(vec3 color) {
+vec3 HSLtoRGB(vec3 color)
+{
float h = color.x;
float l = color.z;
float s = color.y;
@@ -67,13 +78,14 @@ vec3 HSLtoRGB(vec3 color) {
return vec3(r, g, b);
}
-void main() {
- vec4 sample = texture(source, qt_TexCoord0);
- sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
- sample.rgb = mix(vec3(dot(sample.rgb, vec3(0.2125, 0.7154, 0.0721))), sample.rgb, 1.0 + hsl.y);
- sample.xyz = RGBtoHSL(sample.rgb);
- sample.rgb = HSLtoRGB(vec3(sample.x + hsl.x, sample.y, sample.z));
+void main()
+{
+ vec4 samp = texture(source, qt_TexCoord0);
+ samp = vec4(samp.rgb / max(1.0/256.0, samp.a), samp.a);
+ samp.rgb = mix(vec3(dot(samp.rgb, vec3(0.2125, 0.7154, 0.0721))), samp.rgb, 1.0 + hsl.y);
+ samp.xyz = RGBtoHSL(samp.rgb);
+ samp.rgb = HSLtoRGB(vec3(samp.x + hsl.x, samp.y, samp.z));
float c = step(0.0, hsl.z);
- sample.rgb = mix(sample.rgb, vec3(c), abs(hsl.z));
- fragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
+ samp.rgb = mix(samp.rgb, vec3(c), abs(hsl.z));
+ fragColor = vec4(samp.rgb * samp.a, samp.a) * qt_Opacity;
}
diff --git a/src/effects/shaders_ng/huesaturation.frag.qsb b/src/effects/shaders_ng/huesaturation.frag.qsb
new file mode 100644
index 0000000..028a8b8
--- /dev/null
+++ b/src/effects/shaders_ng/huesaturation.frag.qsb
Binary files differ
diff --git a/src/effects/shaders/+glslcore/leveladjust.frag b/src/effects/shaders_ng/leveladjust.frag
index 67370ec..d8cde59 100644
--- a/src/effects/shaders/+glslcore/leveladjust.frag
+++ b/src/effects/shaders_ng/leveladjust.frag
@@ -1,23 +1,33 @@
-#version 150 core
-in vec2 qt_TexCoord0;
-uniform float qt_Opacity;
-uniform sampler2D source;
-uniform vec3 minimumInputRGB;
-uniform vec3 maximumInputRGB;
-uniform float minimumInputAlpha;
-uniform float maximumInputAlpha;
-uniform vec3 minimumOutputRGB;
-uniform vec3 maximumOutputRGB;
-uniform float minimumOutputAlpha;
-uniform float maximumOutputAlpha;
-uniform vec3 gamma;
-out vec4 fragColor;
-
-float linearstep(float e0, float e1, float x) {
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec3 minimumInputRGB;
+ vec3 maximumInputRGB;
+ float minimumInputAlpha;
+ float maximumInputAlpha;
+ vec3 minimumOutputRGB;
+ vec3 maximumOutputRGB;
+ float minimumOutputAlpha;
+ float maximumOutputAlpha;
+ vec3 gamma;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+float linearstep(float e0, float e1, float x)
+{
return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
}
-void main(void) {
+void main()
+{
vec4 textureColor = texture(source, qt_TexCoord0.st);
vec4 color = vec4(textureColor.rgb / max(1.0/256.0, textureColor.a), textureColor.a);
diff --git a/src/effects/shaders_ng/leveladjust.frag.qsb b/src/effects/shaders_ng/leveladjust.frag.qsb
new file mode 100644
index 0000000..fad450d
--- /dev/null
+++ b/src/effects/shaders_ng/leveladjust.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/lineargradient.vert b/src/effects/shaders_ng/lineargradient.vert
new file mode 100644
index 0000000..cd8f8a8
--- /dev/null
+++ b/src/effects/shaders_ng/lineargradient.vert
@@ -0,0 +1,31 @@
+#version 440
+
+layout(location = 0) in vec4 qt_Vertex;
+layout(location = 1) in vec2 qt_MultiTexCoord0;
+
+layout(location = 0) out vec2 qt_TexCoord0;
+layout(location = 1) out vec2 qt_TexCoord1;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 startPoint;
+ vec2 matrixData;
+ float l;
+};
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
+ mat2 rot = mat2(matrixData.y, -matrixData.x,
+ matrixData.x, matrixData.y);
+
+ qt_TexCoord0 = qt_MultiTexCoord0;
+
+ qt_TexCoord1 = qt_MultiTexCoord0 * l;
+ qt_TexCoord1 -= startPoint * l;
+ qt_TexCoord1 *= rot;
+
+ gl_Position = qt_Matrix * qt_Vertex;
+}
diff --git a/src/effects/shaders_ng/lineargradient.vert.qsb b/src/effects/shaders_ng/lineargradient.vert.qsb
new file mode 100644
index 0000000..475ace8
--- /dev/null
+++ b/src/effects/shaders_ng/lineargradient.vert.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/lineargradient_mask.frag b/src/effects/shaders_ng/lineargradient_mask.frag
new file mode 100644
index 0000000..dda85d7
--- /dev/null
+++ b/src/effects/shaders_ng/lineargradient_mask.frag
@@ -0,0 +1,23 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 1) in vec2 qt_TexCoord1;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 startPoint;
+ vec2 matrixData;
+ float l;
+};
+
+layout(binding = 1) uniform sampler2D source;
+layout(binding = 2) uniform sampler2D maskSource;
+
+void main()
+{
+ vec4 gradientColor = texture(source, qt_TexCoord1);
+ float maskAlpha = texture(maskSource, qt_TexCoord0).a;
+ fragColor = gradientColor * maskAlpha * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/lineargradient_mask.frag.qsb b/src/effects/shaders_ng/lineargradient_mask.frag.qsb
new file mode 100644
index 0000000..1e99b35
--- /dev/null
+++ b/src/effects/shaders_ng/lineargradient_mask.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/lineargradient_nomask.frag b/src/effects/shaders_ng/lineargradient_nomask.frag
new file mode 100644
index 0000000..be1d992
--- /dev/null
+++ b/src/effects/shaders_ng/lineargradient_nomask.frag
@@ -0,0 +1,20 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 1) in vec2 qt_TexCoord1;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 startPoint;
+ vec2 matrixData;
+ float l;
+};
+
+layout(binding = 1) uniform sampler2D source;
+
+void main()
+{
+ fragColor = texture(source, qt_TexCoord1) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/lineargradient_nomask.frag.qsb b/src/effects/shaders_ng/lineargradient_nomask.frag.qsb
new file mode 100644
index 0000000..99c479c
--- /dev/null
+++ b/src/effects/shaders_ng/lineargradient_nomask.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/opacitymask.frag b/src/effects/shaders_ng/opacitymask.frag
new file mode 100644
index 0000000..94a80b8
--- /dev/null
+++ b/src/effects/shaders_ng/opacitymask.frag
@@ -0,0 +1,19 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D source;
+layout(binding = 2) uniform sampler2D maskSource;
+
+void main()
+{
+ fragColor = texture(source, qt_TexCoord0.st) * (texture(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/opacitymask.frag.qsb b/src/effects/shaders_ng/opacitymask.frag.qsb
new file mode 100644
index 0000000..cef12b4
--- /dev/null
+++ b/src/effects/shaders_ng/opacitymask.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/opacitymask_invert.frag b/src/effects/shaders_ng/opacitymask_invert.frag
new file mode 100644
index 0000000..2506bdb
--- /dev/null
+++ b/src/effects/shaders_ng/opacitymask_invert.frag
@@ -0,0 +1,19 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D source;
+layout(binding = 2) uniform sampler2D maskSource;
+
+void main()
+{
+ fragColor = texture(source, qt_TexCoord0.st) * (1.0 - texture(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/opacitymask_invert.frag.qsb b/src/effects/shaders_ng/opacitymask_invert.frag.qsb
new file mode 100644
index 0000000..b622ff9
--- /dev/null
+++ b/src/effects/shaders_ng/opacitymask_invert.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/radialgradient.vert b/src/effects/shaders_ng/radialgradient.vert
new file mode 100644
index 0000000..27dd88a
--- /dev/null
+++ b/src/effects/shaders_ng/radialgradient.vert
@@ -0,0 +1,39 @@
+#version 440
+
+layout(location = 0) in vec4 qt_Vertex;
+layout(location = 1) in vec2 qt_MultiTexCoord0;
+
+layout(location = 0) out vec2 qt_TexCoord0;
+layout(location = 1) out vec2 qt_TexCoord1;
+layout(location = 2) out vec2 centerPoint;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 center;
+ vec2 matrixData;
+ float horizontalRatio;
+ float verticalRatio;
+};
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
+ vec2 ratio = vec2(horizontalRatio, verticalRatio);
+
+ mat2 rot = mat2(matrixData.y, -matrixData.x,
+ matrixData.x, matrixData.y);
+
+ qt_TexCoord0 = qt_MultiTexCoord0;
+
+ qt_TexCoord1 = qt_MultiTexCoord0;
+ qt_TexCoord1 -= center;
+ qt_TexCoord1 *= rot;
+ qt_TexCoord1 += center;
+ qt_TexCoord1 *= ratio;
+
+ centerPoint = center * ratio;
+
+ gl_Position = qt_Matrix * qt_Vertex;
+}
diff --git a/src/effects/shaders_ng/radialgradient.vert.qsb b/src/effects/shaders_ng/radialgradient.vert.qsb
new file mode 100644
index 0000000..38961b8
--- /dev/null
+++ b/src/effects/shaders_ng/radialgradient.vert.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/radialgradient_mask.frag b/src/effects/shaders_ng/radialgradient_mask.frag
new file mode 100644
index 0000000..b67d67f
--- /dev/null
+++ b/src/effects/shaders_ng/radialgradient_mask.frag
@@ -0,0 +1,25 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 1) in vec2 qt_TexCoord1;
+layout(location = 2) in vec2 centerPoint;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 center;
+ vec2 matrixData;
+ float horizontalRatio;
+ float verticalRatio;
+};
+
+layout(binding = 1) uniform sampler2D gradientImage;
+layout(binding = 2) uniform sampler2D maskSource;
+
+void main()
+{
+ vec4 gradientColor = texture(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
+ float maskAlpha = texture(maskSource, qt_TexCoord0).a;
+ fragColor = gradientColor * maskAlpha * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/radialgradient_mask.frag.qsb b/src/effects/shaders_ng/radialgradient_mask.frag.qsb
new file mode 100644
index 0000000..8606a67
--- /dev/null
+++ b/src/effects/shaders_ng/radialgradient_mask.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/radialgradient_nomask.frag b/src/effects/shaders_ng/radialgradient_nomask.frag
new file mode 100644
index 0000000..777d53d
--- /dev/null
+++ b/src/effects/shaders_ng/radialgradient_nomask.frag
@@ -0,0 +1,23 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 1) in vec2 qt_TexCoord1;
+layout(location = 2) in vec2 centerPoint;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 center;
+ vec2 matrixData;
+ float horizontalRatio;
+ float verticalRatio;
+};
+
+layout(binding = 1) uniform sampler2D gradientImage;
+
+void main()
+{
+ vec4 gradientColor = texture(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
+ fragColor = gradientColor * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/radialgradient_nomask.frag.qsb b/src/effects/shaders_ng/radialgradient_nomask.frag.qsb
new file mode 100644
index 0000000..1df3ebc
--- /dev/null
+++ b/src/effects/shaders_ng/radialgradient_nomask.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/rectangularglow.frag b/src/effects/shaders_ng/rectangularglow.frag
new file mode 100644
index 0000000..cf20b93
--- /dev/null
+++ b/src/effects/shaders_ng/rectangularglow.frag
@@ -0,0 +1,30 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec4 color;
+ float relativeSizeX;
+ float relativeSizeY;
+ float spread;
+};
+
+float linearstep(float e0, float e1, float x)
+{
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+}
+
+void main()
+{
+ float alpha =
+ smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
+ smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
+
+ float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
+ fragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
+}
diff --git a/src/effects/shaders_ng/rectangularglow.frag.qsb b/src/effects/shaders_ng/rectangularglow.frag.qsb
new file mode 100644
index 0000000..7eaf930
--- /dev/null
+++ b/src/effects/shaders_ng/rectangularglow.frag.qsb
Binary files differ
diff --git a/src/effects/shaders_ng/thresholdmask.frag b/src/effects/shaders_ng/thresholdmask.frag
new file mode 100644
index 0000000..7740e7e
--- /dev/null
+++ b/src/effects/shaders_ng/thresholdmask.frag
@@ -0,0 +1,23 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // qt_Matrix and qt_Opacity must always be both present
+ // if the built-in vertex shader is used.
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float threshold;
+ float spread;
+};
+
+layout(binding = 1) uniform sampler2D source;
+layout(binding = 2) uniform sampler2D maskSource;
+
+void main()
+{
+ vec4 colorFragment = texture(source, qt_TexCoord0.st);
+ vec4 maskFragment = texture(maskSource, qt_TexCoord0.st);
+ fragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity;
+}
diff --git a/src/effects/shaders_ng/thresholdmask.frag.qsb b/src/effects/shaders_ng/thresholdmask.frag.qsb
new file mode 100644
index 0000000..38e7391
--- /dev/null
+++ b/src/effects/shaders_ng/thresholdmask.frag.qsb
Binary files differ
diff --git a/tests/auto/tst_qtgraphicaleffects.cpp b/tests/auto/tst_qtgraphicaleffects.cpp
index a6e8127..f83fc02 100644
--- a/tests/auto/tst_qtgraphicaleffects.cpp
+++ b/tests/auto/tst_qtgraphicaleffects.cpp
@@ -38,31 +38,23 @@ class tst_qtgraphicaleffects : public QObject
private slots:
void initTestCase();
- void blend();
void brightnessContrast();
void colorize();
void colorOverlay();
void conicalGradient();
void desaturate();
- void directionalBlur();
void displace();
void dropShadow();
void fastBlur();
void gammaAdjust();
- void gaussianBlur();
void glow();
void hueSaturation();
- void innerShadow();
void levelAdjust();
void linearGradient();
- void maskedBlur();
void opacityMask();
- void radialBlur();
void radialGradient();
- void recursiveBlur();
void rectangularGlow();
void thresholdMask();
- void zoomBlur();
private:
QString componentErrors(const QQmlComponent*) const;
@@ -389,34 +381,6 @@ void tst_qtgraphicaleffects::colorOverlay()
QCOMPARE(obj->property("color").toString(), QString("#00000000"));
}
-void tst_qtgraphicaleffects::gaussianBlur()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "GaussianBlur {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("radius").type(), QVariant::Double);
- QCOMPARE(obj->property("radius").toDouble(), 4.0);
- QCOMPARE(obj->property("samples").toInt(), 9);
- QCOMPARE(obj->property("transparentBorder").toBool(), false);
-
- double res = obj->property("deviation").toDouble();
- QVERIFY(res > 0.0);
-
- QCOMPARE(obj->property("cached").toBool(), false);
-}
-
void tst_qtgraphicaleffects::dropShadow()
{
// Creation
@@ -435,40 +399,7 @@ void tst_qtgraphicaleffects::dropShadow()
// Default values
QCOMPARE(obj->property("radius").type(), QVariant::Double);
- QCOMPARE(obj->property("radius").toDouble(), 4.0);
- QCOMPARE(obj->property("samples").toInt(), 9);
- QCOMPARE(obj->property("horizontalOffset").type(), QVariant::Double);
- QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0);
- QCOMPARE(obj->property("verticalOffset").type(), QVariant::Double);
- QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0);
- QCOMPARE(obj->property("cached").toBool(), false);
- QCOMPARE(obj->property("source").toInt(), 0);
- QCOMPARE(obj->property("color").toString(), QString("#000000"));
- QCOMPARE(obj->property("spread").type(), QVariant::Double);
- QCOMPARE(obj->property("spread").toDouble(), 0.0);
- QCOMPARE(obj->property("transparentBorder").toBool(), true);
-}
-
-void tst_qtgraphicaleffects::innerShadow()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "InnerShadow {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("radius").type(), QVariant::Double);
QCOMPARE(obj->property("radius").toDouble(), 0.0);
- QCOMPARE(obj->property("samples").toInt(), 0);
QCOMPARE(obj->property("horizontalOffset").type(), QVariant::Double);
QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0);
QCOMPARE(obj->property("verticalOffset").type(), QVariant::Double);
@@ -478,7 +409,7 @@ void tst_qtgraphicaleffects::innerShadow()
QCOMPARE(obj->property("color").toString(), QString("#000000"));
QCOMPARE(obj->property("spread").type(), QVariant::Double);
QCOMPARE(obj->property("spread").toDouble(), 0.0);
- QCOMPARE(obj->property("fast").toBool(), false);
+ QCOMPARE(obj->property("transparentBorder").toBool(), false);
}
void tst_qtgraphicaleffects::gammaAdjust()
@@ -549,37 +480,12 @@ void tst_qtgraphicaleffects::glow()
// Default values
QCOMPARE(obj->property("radius").type(), QVariant::Double);
- QCOMPARE(obj->property("radius").toDouble(), 4.0);
- QCOMPARE(obj->property("samples").toInt(), 9);
+ QCOMPARE(obj->property("radius").toDouble(), 0);
QCOMPARE(obj->property("cached").toBool(), false);
QCOMPARE(obj->property("spread").type(), QVariant::Double);
- QCOMPARE(obj->property("spread").toDouble(), 0.5);
+ QCOMPARE(obj->property("spread").toDouble(), 0);
QCOMPARE(obj->property("color").toString(), QString("#ffffff"));
- QCOMPARE(obj->property("transparentBorder").toBool(), true);
-}
-
-void tst_qtgraphicaleffects::blend()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "Blend {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "foregroundSource: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("source").toInt(), 0);
- QCOMPARE(obj->property("foregroundSource").toInt(), 0);
- QCOMPARE(obj->property("cached").toBool(), false);
- QCOMPARE(obj->property("mode").toString(), QString("normal"));
+ QCOMPARE(obj->property("transparentBorder").toBool(), false);
}
void tst_qtgraphicaleffects::displace()
@@ -607,119 +513,6 @@ void tst_qtgraphicaleffects::displace()
QCOMPARE(obj->property("displacement").toDouble(), 0.0);
}
-void tst_qtgraphicaleffects::recursiveBlur()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "RecursiveBlur {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("source").toInt(), 0);
- QCOMPARE(obj->property("loops").toInt(), 0);
- QCOMPARE(obj->property("radius").type(), QVariant::Double);
- QCOMPARE(obj->property("radius").toDouble(), 0.0);
- QCOMPARE(obj->property("progress").type(), QVariant::Double);
- QCOMPARE(obj->property("progress").toDouble(), 0.0);
- QCOMPARE(obj->property("transparentBorder").toBool(), false);
- QCOMPARE(obj->property("cached").toBool(), false);
-}
-
-void tst_qtgraphicaleffects::directionalBlur()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "DirectionalBlur {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("source").toInt(), 0);
- QCOMPARE(obj->property("length").toInt(), 0);
- QCOMPARE(obj->property("samples").type(), QVariant::Int);
- QCOMPARE(obj->property("samples").toInt(), 0);
- QCOMPARE(obj->property("angle").type(), QVariant::Double);
- QCOMPARE(obj->property("angle").toDouble(), 0.0);
- QCOMPARE(obj->property("transparentBorder").toBool(), false);
- QCOMPARE(obj->property("cached").toBool(), false);
-}
-
-void tst_qtgraphicaleffects::radialBlur()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "RadialBlur {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("source").toInt(), 0);
- QCOMPARE(obj->property("samples").type(), QVariant::Int);
- QCOMPARE(obj->property("samples").toInt(), 0);
- QCOMPARE(obj->property("angle").type(), QVariant::Double);
- QCOMPARE(obj->property("angle").toDouble(), 0.0);
- QCOMPARE(obj->property("transparentBorder").toBool(), false);
- QCOMPARE(obj->property("cached").toBool(), false);
- QCOMPARE(obj->property("horizontalOffset").type(), QVariant::Double);
- QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0);
- QCOMPARE(obj->property("verticalOffset").type(), QVariant::Double);
- QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0);
-}
-
-void tst_qtgraphicaleffects::zoomBlur()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "ZoomBlur {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("source").toInt(), 0);
- QCOMPARE(obj->property("length").toInt(), 0);
- QCOMPARE(obj->property("samples").type(), QVariant::Int);
- QCOMPARE(obj->property("samples").toInt(), 0);
- QCOMPARE(obj->property("transparentBorder").toBool(), false);
- QCOMPARE(obj->property("cached").toBool(), false);
- QCOMPARE(obj->property("horizontalOffset").type(), QVariant::Double);
- QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0);
- QCOMPARE(obj->property("verticalOffset").type(), QVariant::Double);
- QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0);
-}
-
void tst_qtgraphicaleffects::levelAdjust()
{
// Creation
@@ -744,32 +537,6 @@ void tst_qtgraphicaleffects::levelAdjust()
QCOMPARE(obj->property("cached").toBool(), false);
}
-void tst_qtgraphicaleffects::maskedBlur()
-{
- // Creation
- QString componentStr = "import QtQuick 2.0\n"
- + importSelf +
- "MaskedBlur {"
- "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "maskSource: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}"
- "width: 50; height: 50\n"
- "}";
- QQmlComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QVERIFY2(component.status() != QQmlComponent::Error, qPrintable(componentErrors(&component)));
- QTRY_COMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
-
- // Default values
- QCOMPARE(obj->property("source").toInt(), 0);
- QCOMPARE(obj->property("maskSource").toInt(), 0);
- QCOMPARE(obj->property("radius").type(), QVariant::Double);
- QCOMPARE(obj->property("radius").toDouble(), 4.0);
- QCOMPARE(obj->property("samples").toInt(), 9);
- QCOMPARE(obj->property("cached").toBool(), false);
-}
-
QTEST_MAIN(tst_qtgraphicaleffects)
#include "tst_qtgraphicaleffects.moc"
diff --git a/tests/manual/testbed/ColorPicker.qml b/tests/manual/testbed/ColorPicker.qml
index 7181192..aa46d7a 100644
--- a/tests/manual/testbed/ColorPicker.qml
+++ b/tests/manual/testbed/ColorPicker.qml
@@ -52,7 +52,7 @@ Item {
color: root.color
}
- ShaderEffect {
+ Item { // ShaderEffect converted to an Item for now to keep it simple
id: map
anchors.left: parent.left
anchors.leftMargin: 10
@@ -63,54 +63,6 @@ Item {
opacity: 0.01
property real hue: root.hue
- fragmentShader: "
- varying mediump vec2 qt_TexCoord0;
- uniform highp float qt_Opacity;
- uniform highp float hue;
-
- highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
- h = fract(h);
- if (h < 1.0 / 6.0)
- return v1 + (v2 - v1) * 6.0 * h;
- else if (h < 1.0 / 2.0)
- return v2;
- else if (h < 2.0 / 3.0)
- return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
-
- return v1;
- }
-
- highp vec3 HSLtoRGB(highp vec3 color) {
- highp float h = color.x;
- highp float l = color.z;
- highp float s = color.y;
-
- if (s < 1.0 / 256.0)
- return vec3(l, l, l);
-
- highp float v1;
- highp float v2;
- if (l < 0.5)
- v2 = l * (1.0 + s);
- else
- v2 = (l + s) - (s * l);
-
- v1 = 2.0 * l - v2;
-
- highp float d = 1.0 / 3.0;
- highp float r = hueToIntensity(v1, v2, h + d);
- highp float g = hueToIntensity(v1, v2, h);
- highp float b = hueToIntensity(v1, v2, h - d);
- return vec3(r, g, b);
- }
-
- void main() {
- lowp vec4 c = vec4(1.0);
- c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s));
- gl_FragColor = c * qt_Opacity;
- }
- "
-
MouseArea {
id: mapMouseArea
anchors.fill: parent
diff --git a/tests/manual/testbed/TestBedModel.qml b/tests/manual/testbed/TestBedModel.qml
index c299c39..d396173 100644
--- a/tests/manual/testbed/TestBedModel.qml
+++ b/tests/manual/testbed/TestBedModel.qml
@@ -30,21 +30,13 @@ import QtQuick 2.12
ListModel {
id: testcaseModel
- ListElement { name: "TestBlend.qml"; group: "Blend"; last: true }
ListElement { name: "TestDisplace.qml"; group: "Distortion"; last: true }
ListElement { name: "TestOpacityMask.qml"; group: "Mask" }
ListElement { name: "TestThresholdMask.qml"; group: "Mask"; last: true }
ListElement { name: "TestGlow.qml"; group: "Glow" }
ListElement { name: "TestRectangularGlow.qml"; group: "Glow"; last: true }
ListElement { name: "TestFastBlur.qml"; group: "Blur" }
- ListElement { name: "TestGaussianBlur.qml"; group: "Blur" }
- ListElement { name: "TestMaskedBlur.qml"; group: "Blur" }
- ListElement { name: "TestRecursiveBlur.qml"; group: "Blur"; last: true }
- ListElement { name: "TestDirectionalBlur.qml"; group: "Motion Blur"; }
- ListElement { name: "TestRadialBlur.qml"; group: "Motion Blur"; }
- ListElement { name: "TestZoomBlur.qml"; group: "Motion Blur"; last: true }
ListElement { name: "TestDropShadow.qml"; group: "Drop Shadow" }
- ListElement { name: "TestInnerShadow.qml"; group: "Drop Shadow"; last: true }
ListElement { name: "TestLinearGradient.qml"; group: "Gradient" }
ListElement { name: "TestConicalGradient.qml"; group: "Gradient" }
ListElement { name: "TestRadialGradient.qml"; group: "Gradient"; last: true }
diff --git a/tests/manual/testbed/TestBlend.qml b/tests/manual/testbed/TestBlend.qml
deleted file mode 100644
index c3852e1..0000000
--- a/tests/manual/testbed/TestBlend.qml
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
- ImageSource {
- id: imageSource1
- source: "images/bug.jpg"
- }
-
- ImageSource {
- id: imageSource2
- source: "images/butterfly.png"
- }
-
- Blend {
- id: effect
- anchors.fill: imageSource1
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- source: imageSource1
- foregroundSource: imageSource2
- mode: blendMode.value
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
-
- RadioButtonColumn {
- id: blendMode
- value: "normal"
- caption: "mode"
- RadioButton {
- caption: "normal"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "addition"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "average"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "color"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "colorBurn"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "colorDodge"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "darken"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "darkerColor"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "difference"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "divide"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "exclusion"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "hardLight"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "hue"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "lighten"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "lighterColor"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "lightness"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "multiply"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "negation"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "saturation"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "screen"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "softlight"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- RadioButton {
- caption: "subtract"
- selected: caption == blendMode.value
- onPressedChanged: blendMode.value = caption
- }
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- CheckBox {
- id: updateCheckBox
- caption: "animated"
- selected: false
- }
- BGColorPicker {
- id: bgColorPicker
- }
- }
- ]
-}
diff --git a/tests/manual/testbed/TestDirectionalBlur.qml b/tests/manual/testbed/TestDirectionalBlur.qml
deleted file mode 100644
index a3455e8..0000000
--- a/tests/manual/testbed/TestDirectionalBlur.qml
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
- ImageSource {
- id: imageSource
- source: "images/butterfly.png"
- }
-
- DirectionalBlur {
- id: effect
- anchors.fill: imageSource
- transparentBorder: transparentBorderCheckBox.selected
- angle: angleSlider.value
- length: lengthSlider.value
- samples: samplesSlider.value
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- source: imageSource
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
- Slider {
- id: angleSlider
- minimum: -180.0
- maximum: 180.0
- value: 90.0
- caption: "angle"
- }
- Slider {
- id: lengthSlider
- minimum: 0.0
- maximum: 64.0
- value: 32.0
- caption: "length"
- }
- Slider {
- id: samplesSlider
- minimum: 0
- maximum: 32
- value: 32
- caption: "samples"
- integer: true
- }
- CheckBox {
- id: transparentBorderCheckBox
- caption: "transparentBorder"
- selected: false
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- CheckBox {
- id: updateCheckBox
- caption: "animated"
- selected: false
- }
- BGColorPicker {
- id: bgColorPicker
- }
- }
- ]
-}
diff --git a/tests/manual/testbed/TestDropShadow.qml b/tests/manual/testbed/TestDropShadow.qml
index 93070be..f67cc7b 100644
--- a/tests/manual/testbed/TestDropShadow.qml
+++ b/tests/manual/testbed/TestDropShadow.qml
@@ -44,12 +44,10 @@ TestCaseTemplate {
anchors.fill: imageSource
radius: radiusSlider.value
spread: spreadSlider.value
- samples: samplesSlider.value
color: colorPicker.color
visible: enabledCheckBox.selected
cached: cachedCheckBox.selected
source: imageSource
- fast: fastCheckBox.selected
}
PositionPicker {
@@ -78,25 +76,12 @@ TestCaseTemplate {
caption: "radius"
}
Slider {
- id: samplesSlider
- minimum: 0
- maximum: 32
- value: 32
- integer: true
- caption: "samples"
- }
- Slider {
id: spreadSlider
minimum: 0
maximum: 1.0
value: 0.0
caption: "spread"
}
- CheckBox {
- id: fastCheckBox
- caption: "fast"
- selected: false
- }
},
Control {
diff --git a/tests/manual/testbed/TestGaussianBlur.qml b/tests/manual/testbed/TestGaussianBlur.qml
deleted file mode 100644
index 13ce7fc..0000000
--- a/tests/manual/testbed/TestGaussianBlur.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
- ImageSource {
- id: imageSource
- }
-
- GaussianBlur {
- id: effect
- anchors.fill: imageSource
- radius: radiusSlider.value
- samples: samplesSlider.value
- deviation: deviationSlider.value
- transparentBorder: transparentBorderCheckBox.selected
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- source: imageSource
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
- Slider {
- id: radiusSlider
- minimum: 0.0
- maximum: 16.0
- value: 8.0
- caption: "radius"
- }
- Slider {
- id: deviationSlider
- minimum: 0
- maximum: 16
- value: (effect.radius + 1) / 3.3333
- caption: "deviation"
- }
- Slider {
- id: samplesSlider
- minimum: 0
- maximum: 32
- value: 32
- integer: true
- caption: "samples"
- }
- CheckBox {
- id: transparentBorderCheckBox
- caption: "transparentBorder"
- selected: false
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- CheckBox {
- id: updateCheckBox
- caption: "animated"
- selected: false
- }
- BGColorPicker {
- id: bgColorPicker
- }
- }
- ]
-}
diff --git a/tests/manual/testbed/TestGlow.qml b/tests/manual/testbed/TestGlow.qml
index 997a838..574eda8 100644
--- a/tests/manual/testbed/TestGlow.qml
+++ b/tests/manual/testbed/TestGlow.qml
@@ -43,10 +43,8 @@ TestCaseTemplate {
color: colorPicker.color
spread: spreadSlider.value
radius: radiusSlider.value
- samples: samplesSlider.value
visible: enabledCheckBox.selected
cached: cachedCheckBox.selected
- fast: fastCheckBox.selected
source: imageSource
}
@@ -68,19 +66,6 @@ TestCaseTemplate {
maximum: 1.0
value: 0.3
}
- Slider {
- id: samplesSlider
- minimum: 0
- maximum: 32
- value: 32
- integer: true
- caption: "samples"
- }
- CheckBox {
- id: fastCheckBox
- caption: "fast"
- selected: false
- }
},
Control {
diff --git a/tests/manual/testbed/TestInnerShadow.qml b/tests/manual/testbed/TestInnerShadow.qml
deleted file mode 100644
index d17be5f..0000000
--- a/tests/manual/testbed/TestInnerShadow.qml
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
-
- ImageSource {
- id: imageSource
- source: "images/butterfly.png"
- anchors.centerIn: parent
- }
-
- InnerShadow {
- id: effect
- anchors.fill: imageSource
- horizontalOffset: (offsetPicker.xValue - 0.5) * width
- verticalOffset: (offsetPicker.yValue - 0.5) * height
- samples: samplesSlider.value
- radius: radiusSlider.value
- spread: spreadSlider.value
- color: colorPicker.color
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- fast: fastCheckBox.selected
- source: imageSource
- }
-
- PositionPicker {
- id: offsetPicker
- xValue: 0.50
- yValue: 0.51
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
- Label {
- caption: "horizontalOffset"
- text: effect.horizontalOffset.toFixed(1)
- }
- Label {
- caption: "verticalOffset"
- text: effect.verticalOffset.toFixed(1)
- }
- Slider {
- id: radiusSlider
- minimum: 0
- maximum: 16
- value: 8
- caption: "radius"
- }
- Slider {
- id: samplesSlider
- minimum: 0
- maximum: 32
- value: 32
- integer: true
- caption: "samples"
- }
- Slider {
- id: spreadSlider
- minimum: 0
- maximum: 1.0
- value: 0.0
- caption: "spread"
- }
- CheckBox {
- id: fastCheckBox
- caption: "fast"
- selected: false
- }
- },
-
- Control {
- caption: "color"
- ColorPicker {
- id: colorPicker
- hue: 0
- saturation: 0
- lightness: 0
- alpha: 0.75
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- CheckBox {
- id: updateCheckBox
- caption: "animated"
- selected: false
- }
- BGColorPicker {
- id: bgColorPicker
- color: "#ababab"
- }
- }
- ]
-}
diff --git a/tests/manual/testbed/TestMaskedBlur.qml b/tests/manual/testbed/TestMaskedBlur.qml
deleted file mode 100644
index c8b6b2d..0000000
--- a/tests/manual/testbed/TestMaskedBlur.qml
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
- ImageSource {
- id: imageSource
- }
-
- Item {
- id: maskSource
- anchors.fill: imageSource
- visible: false
- Rectangle {
- rotation: -90
- anchors.fill: parent
- gradient: Gradient {
- GradientStop { position: 0.2; color: Qt.rgba(maskAlphaBeginSlider.value, maskAlphaBeginSlider.value, maskAlphaBeginSlider.value, maskAlphaBeginSlider.value) }
- GradientStop { position: 0.5; color: Qt.rgba(maskAlphaEndSlider.value, maskAlphaEndSlider.value, maskAlphaEndSlider.value, maskAlphaEndSlider.value) }
- }
- }
- }
-
- MaskedBlur {
- id: effect
- anchors.fill: imageSource
- radius: radiusSlider.value
- samples: samplesSlider.value
- transparentBorder: transparentBorderCheckBox.selected
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- fast: fastCheckBox.selected
- source: imageSource
- maskSource: maskSource
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
- Slider {
- id: radiusSlider
- minimum: 0.0
- maximum: 32.0
- value: 16.0
- caption: "radius"
- }
- Slider {
- id: samplesSlider
- minimum: 0
- maximum: 32
- value: 32
- integer: true
- caption: "samples"
- }
- CheckBox {
- id: transparentBorderCheckBox
- caption: "transparentBorder"
- selected: false
- }
- CheckBox {
- id: fastCheckBox
- caption: "fast"
- selected: false
- }
- },
- Control {
- caption: "maskSource gradient"
- Slider {
- id: maskAlphaBeginSlider
- minimum: 0.0
- maximum: 1.0
- value: 1.0
- caption: "opacity begin"
- }
- Slider {
- id: maskAlphaEndSlider
- minimum: 0.0
- maximum: 1.0
- value: 0.0
- caption: "opacity end"
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- CheckBox {
- id: updateCheckBox
- caption: "animated"
- selected: false
- }
- BGColorPicker {
- id: bgColorPicker
- }
- }
- ]
-}
diff --git a/tests/manual/testbed/TestRadialBlur.qml b/tests/manual/testbed/TestRadialBlur.qml
deleted file mode 100644
index c2e0d95..0000000
--- a/tests/manual/testbed/TestRadialBlur.qml
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
- ImageSource {
- id: imageSource
- source: "images/butterfly.png"
- }
-
- RadialBlur {
- id: effect
- anchors.fill: imageSource
- transparentBorder: transparentBorderCheckBox.selected
- angle: lengthSlider.value
- samples: samplesSlider.value
- horizontalOffset: (offsetPicker.xValue - 0.5) * width
- verticalOffset: (offsetPicker.yValue - 0.5) * height
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- source: imageSource
- }
-
- PositionPicker {
- id: offsetPicker
- xValue: 0.5
- yValue: 0.5
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
- Slider {
- id: lengthSlider
- minimum: 0.0
- maximum: 360.0
- value: 15.0
- caption: "angle"
- }
- Slider {
- id: samplesSlider
- minimum: 0
- maximum: 64
- value: 32
- caption: "samples"
- integer: true
- }
- CheckBox {
- id: transparentBorderCheckBox
- caption: "transparentBorder"
- selected: false
- }
- Label {
- caption: "horizontalOffset"
- text: effect.horizontalOffset.toFixed(1)
- }
- Label {
- caption: "verticalOffset"
- text: effect.verticalOffset.toFixed(1)
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- CheckBox {
- id: updateCheckBox
- caption: "animated"
- selected: false
- }
- BGColorPicker {
- id: bgColorPicker
- }
- }
- ]
-}
diff --git a/tests/manual/testbed/TestRecursiveBlur.qml b/tests/manual/testbed/TestRecursiveBlur.qml
deleted file mode 100644
index 5e33ea3..0000000
--- a/tests/manual/testbed/TestRecursiveBlur.qml
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
-
- ImageSource {
- id: imageSource
- forcedUpdateAnimationRunning: false
- }
-
- RecursiveBlur {
- id: effect
- loops: iterationSlider.value
- anchors.fill: imageSource
- radius: radiusSlider.value
- transparentBorder: transparentBorderCheckBox.selected
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- source: imageSource
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
- Slider {
- id: iterationSlider
- minimum: 0
- maximum: 20
- value: 0
- integer: true
- caption: "loops"
- }
- Slider {
- id: radiusSlider
- minimum: 0.0
- maximum: 16.0
- value: 7.5
- caption: "radius"
- }
- CheckBox {
- id: transparentBorderCheckBox
- caption: "transparentBorder"
- selected: false
- }
- ProgressBar {
- id: progressSlider
- minimum: 0
- maximum: 1.0
- value: effect.progress
- caption: "progress"
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- BGColorPicker {
- id: bgColorPicker
- }
- }
- ]
-}
diff --git a/tests/manual/testbed/TestZoomBlur.qml b/tests/manual/testbed/TestZoomBlur.qml
deleted file mode 100644
index 3045e15..0000000
--- a/tests/manual/testbed/TestZoomBlur.qml
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Graphical Effects module.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.12
-import QtGraphicalEffects 1.12
-
-TestCaseTemplate {
- ImageSource {
- id: imageSource
- source: "images/butterfly.png"
- }
-
- ZoomBlur {
- id: effect
- anchors.fill: imageSource
- transparentBorder: transparentBorderCheckBox.selected
- length: lengthSlider.value
- samples: samplesSlider.value
- horizontalOffset: (offsetPicker.xValue - 0.5) * width
- verticalOffset: (offsetPicker.yValue - 0.5) * height
- visible: enabledCheckBox.selected
- cached: cachedCheckBox.selected
- source: imageSource
- }
-
- PositionPicker {
- id: offsetPicker
- xValue: 0.5
- yValue: 0.5
- }
-
- bgColor: bgColorPicker.color
- controls: [
- Control {
- caption: "general"
- Slider {
- id: lengthSlider
- minimum: 0.0
- maximum: 64.0
- value: 32.0
- caption: "length"
- }
- Slider {
- id: samplesSlider
- minimum: 0
- maximum: 32
- value: 32
- caption: "samples"
- integer: true
- }
- CheckBox {
- id: transparentBorderCheckBox
- caption: "transparentBorder"
- selected: false
- }
- Label {
- caption: "horizontalOffset"
- text: effect.horizontalOffset.toFixed(1)
- }
- Label {
- caption: "verticalOffset"
- text: effect.verticalOffset.toFixed(1)
- }
- },
-
- Control {
- caption: "advanced"
- last: true
- Label {
- caption: "Effect size"
- text: effect.width + "x" + effect.height
- }
- Label {
- caption: "FPS"
- text: fps
- }
- CheckBox {
- id: cachedCheckBox
- caption: "cached"
- }
- CheckBox {
- id: enabledCheckBox
- caption: "enabled"
- }
- CheckBox {
- id: updateCheckBox
- caption: "animated"
- selected: false
- }
- BGColorPicker {
- id: bgColorPicker
- }
- }
- ]
-}