+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();\n
+ }\n
+);
+
+const char* FRAGMENT_MASK_SHADER = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vTexCoord;\n
+ varying mediump vec2 vMaskTexCoord;\n
+ uniform sampler2D sTexture;\n
+ uniform sampler2D sMask;\n
+ uniform lowp vec4 uColor;\n
+ uniform lowp vec3 mixColor;\n
+ uniform lowp float opacity;\n
+ uniform lowp float preMultipliedAlpha;\n
+ uniform mediump float auxiliaryImageAlpha;\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
+ }\n
+ void main()\n
+ {\n
+ // Where mask image is transparent, all of background image must show through.
+ // where mask image is opaque, only mask should be shown
+ // where mask is translucent, less of background should be shown.
+ // auxiliaryImageAlpha controls how much of mask is visible
+
+ mediump vec4 color = texture2D( sTexture, vTexCoord );\n
+ mediump vec4 mask = texture2D( sMask, vMaskTexCoord );\n
+
+ mediump vec3 mixedColor = color.rgb * mix( 1.0-mask.a, 1.0, 1.0-auxiliaryImageAlpha)
+ + mask.rgb*mask.a * auxiliaryImageAlpha;\n
+ gl_FragColor = vec4(mixedColor,1.0) * uColor * visualMixColor();\n