aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/shaders/outlinedtext.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/shaders/outlinedtext.frag')
-rw-r--r--src/quick/scenegraph/shaders/outlinedtext.frag21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/quick/scenegraph/shaders/outlinedtext.frag b/src/quick/scenegraph/shaders/outlinedtext.frag
new file mode 100644
index 0000000000..b3e5475d5d
--- /dev/null
+++ b/src/quick/scenegraph/shaders/outlinedtext.frag
@@ -0,0 +1,21 @@
+varying highp vec2 sampleCoord;
+varying highp vec2 sCoordUp;
+varying highp vec2 sCoordDown;
+varying highp vec2 sCoordLeft;
+varying highp vec2 sCoordRight;
+
+uniform sampler2D _qt_texture;
+uniform lowp vec4 color;
+uniform lowp vec4 styleColor;
+
+void main()
+{
+ lowp float glyph = texture2D(_qt_texture, sampleCoord).a;
+ lowp float outline = clamp(clamp(texture2D(_qt_texture, sCoordUp).a +
+ texture2D(_qt_texture, sCoordDown).a +
+ texture2D(_qt_texture, sCoordLeft).a +
+ texture2D(_qt_texture, sCoordRight).a,
+ 0.0, 1.0) - glyph,
+ 0.0, 1.0);
+ gl_FragColor = outline * styleColor + glyph * color;
+} \ No newline at end of file