1 /* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
12 property real radius: 100
13 property real border: 20
16 uniform lowp float radius;
17 uniform lowp float border;
18 uniform lowp float height;
19 uniform lowp float width;
20 uniform lowp float qt_Opacity;
21 uniform lowp vec4 color;
22 varying highp vec2 qt_TexCoord0;
25 lowp vec2 dist = min(qt_TexCoord0, vec2(1.0) - qt_TexCoord0);
27 lowp float xval = smoothstep(0.0, border, dist.x * width);
28 lowp float yval = smoothstep(0.0, border, dist.y * height);
29 lowp float borderVal = sqrt(yval * xval) * 0.5 + 0.5;
31 xval = smoothstep(0.0, radius, dist.x * width);
32 yval = smoothstep(0.0, radius, dist.y * width);
33 lowp float innerVal = sqrt(yval * xval) * 0.5 + 0.5;
35 lowp vec4 innerColor = mix(vec4(0.0, 0.0, 0.0, 0.5), color, innerVal);
36 lowp vec4 borderColor = mix(vec4(0.0, 0.0, 0.0, 1.0), innerColor, borderVal);
37 gl_FragColor = borderColor * qt_Opacity;