Merge "Add a callback for navigation policy in web view." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / graphics / shaders / text-visual-single-color-text-with-style-and-emoji-shader.frag
1 varying mediump vec2 vTexCoord;
2 uniform sampler2D sTexture;
3 uniform sampler2D sStyle;
4 uniform sampler2D sOverlayStyle;
5 uniform sampler2D sMask;
6 uniform lowp float uHasMultipleTextColors;
7 uniform lowp vec4 uTextColorAnimatable;
8 uniform lowp vec4 uColor;
9 uniform lowp vec3 mixColor;
10
11 void main()
12 {
13   mediump vec4 textTexture = texture2D( sTexture, vTexCoord );
14   mediump vec4 styleTexture = texture2D( sStyle, vTexCoord );
15   mediump vec4 overlayStyleTexture = texture2D( sOverlayStyle, vTexCoord );
16   mediump float maskTexture = texture2D( sMask, vTexCoord ).r;
17
18   // Set the color of non-transparent pixel in text to what it is animated to.
19   // Markup text with multiple text colors are not animated (but can be supported later on if required).
20   // Emoji color are not animated.
21   mediump float vstep = step( 0.0001, textTexture.a );
22   textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );
23
24   // Draw the text as overlay above the style
25   gl_FragColor = ( overlayStyleTexture + textTexture * (1.0 - overlayStyleTexture.a) + styleTexture * ( 1.0 - textTexture.a ) * (1.0 - overlayStyleTexture.a) ) * uColor * vec4( mixColor, 1.0 );
26 }