Warning, /plasma/plasma-workspace/lookandfeel/components/UserDelegate.frag is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org>
0003     SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0004     SPDX-FileCopyrightText: 2023 David Redondo <kde@david-redondo.de>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 //draw a circle with an antialiased border
0009 //innerRadius = size of the inner circle with contents
0010 //outerRadius = size of the border
0011 //blend = area to blend between two colours
0012 //all sizes are normalised so 0.5 == half the width of the texture
0013 
0014 //if copying into another project don't forget to connect themeChanged to update()
0015 //but in SDDM that's a bit pointless
0016 
0017 #version 440
0018 layout(location = 0) in vec2 qt_TexCoord0;
0019 layout(std140, binding = 0) uniform buf {
0020     mat4 qt_Matrix;
0021     float qt_Opacity;
0022     vec4 colorBorder;
0023 };
0024 layout(binding = 1) uniform sampler2D source;
0025 layout(location = 0) out vec4 fragColor;
0026 
0027 
0028 const highp float blend = 0.01;
0029 const highp float innerRadius = 0.47;
0030 const highp float outerRadius = 0.49;
0031 const lowp vec4 colorEmpty = vec4(0.0, 0.0, 0.0, 0.0);
0032 
0033 void main() {
0034     lowp vec4 colorSource = texture(source, qt_TexCoord0);
0035 
0036     highp vec2 m = qt_TexCoord0 - vec2(0.5, 0.5);
0037     highp float dist = sqrt(m.x * m.x + m.y * m.y);
0038 
0039     if (dist < innerRadius)
0040         fragColor = colorSource;
0041     else if (dist < innerRadius + blend)
0042         fragColor = mix(colorSource, colorBorder, ((dist - innerRadius) / blend));
0043     else if (dist < outerRadius)
0044         fragColor = colorBorder;
0045     else if (dist < outerRadius + blend)
0046         fragColor = mix(colorBorder, colorEmpty, ((dist - outerRadius) / blend));
0047     else
0048         fragColor = colorEmpty;
0049 
0050     fragColor = fragColor * qt_Opacity;
0051 }