diff options
Diffstat (limited to 'prototype_2016/third_party/fluid/controls/NoiseBackground.qml')
-rw-r--r-- | prototype_2016/third_party/fluid/controls/NoiseBackground.qml | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/prototype_2016/third_party/fluid/controls/NoiseBackground.qml b/prototype_2016/third_party/fluid/controls/NoiseBackground.qml deleted file mode 100644 index 0e48503..0000000 --- a/prototype_2016/third_party/fluid/controls/NoiseBackground.qml +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | /* | ||
2 | * This file is part of Fluid. | ||
3 | * | ||
4 | * Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | ||
5 | * | ||
6 | * $BEGIN_LICENSE:MPL2$ | ||
7 | * | ||
8 | * This Source Code Form is subject to the terms of the Mozilla Public | ||
9 | * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
10 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
11 | * | ||
12 | * $END_LICENSE$ | ||
13 | */ | ||
14 | |||
15 | /**************************************************************************** | ||
16 | ** | ||
17 | ** Copyright (C) 2016 The Qt Company Ltd. | ||
18 | ** Contact: https://www.qt.io/licensing/ | ||
19 | ** | ||
20 | ** This file is part of Fluid and is derived from NoisyGradient.qml | ||
21 | ** from the Qt 5 launch demo. | ||
22 | ** | ||
23 | ** $QT_BEGIN_LICENSE:BSD$ | ||
24 | ** You may use this file under the terms of the BSD license as follows: | ||
25 | ** | ||
26 | ** "Redistribution and use in source and binary forms, with or without | ||
27 | ** modification, are permitted provided that the following conditions are | ||
28 | ** met: | ||
29 | ** * Redistributions of source code must retain the above copyright | ||
30 | ** notice, this list of conditions and the following disclaimer. | ||
31 | ** * Redistributions in binary form must reproduce the above copyright | ||
32 | ** notice, this list of conditions and the following disclaimer in | ||
33 | ** the documentation and/or other materials provided with the | ||
34 | ** distribution. | ||
35 | ** * Neither the name of The Qt Company nor the names | ||
36 | ** of its contributors may be used to endorse or promote products derived | ||
37 | ** from this software without specific prior written permission. | ||
38 | ** | ||
39 | ** | ||
40 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
41 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
42 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
43 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
44 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
45 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
46 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
47 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
48 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
49 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
50 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | ||
51 | ** | ||
52 | ** $QT_END_LICENSE$ | ||
53 | ** | ||
54 | ****************************************************************************/ | ||
55 | |||
56 | import QtQuick 2.0 | ||
57 | |||
58 | /*! | ||
59 | \qmltype NoiseBackground | ||
60 | \inqmlmodule Fluid.Controls | ||
61 | \ingroup fluidcontrols | ||
62 | |||
63 | \brief Background with noise. | ||
64 | */ | ||
65 | ShaderEffect { | ||
66 | property alias gradient: rect.gradient | ||
67 | property alias color: rect.color | ||
68 | |||
69 | Rectangle { | ||
70 | id: rect | ||
71 | anchors.fill: parent | ||
72 | layer.enabled: true | ||
73 | layer.smooth: true | ||
74 | visible: false | ||
75 | } | ||
76 | |||
77 | readonly property variant source: rect | ||
78 | |||
79 | blending: false | ||
80 | fragmentShader: " | ||
81 | #ifdef GL_ES | ||
82 | precision lowp float; | ||
83 | #endif | ||
84 | |||
85 | uniform sampler2D source; | ||
86 | varying highp vec2 qt_TexCoord0; | ||
87 | uniform lowp float qt_Opacity; | ||
88 | |||
89 | // Noise function from: http://stackoverflow.com/questions/4200224/random-noise-functions-for-glsl | ||
90 | float rand(vec2 n) { | ||
91 | return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233))) * 43758.5453); | ||
92 | } | ||
93 | |||
94 | void main() { | ||
95 | lowp float len = clamp(length(vec2(0.5, 0.0) - qt_TexCoord0), 0.0, 1.0); | ||
96 | gl_FragColor = texture2D(source, vec2(0, len)) * qt_Opacity + rand(qt_TexCoord0) * 0.05; | ||
97 | } | ||
98 | " | ||
99 | } | ||