+
+const char* VERTEX_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ uniform highp mat4 uMvpMatrix;\n
+ uniform highp vec3 uSize;\n
+ varying mediump vec2 vPosition;\n
+ varying mediump vec2 vRectSize;\n
+ varying mediump float vCornerRadius;\n
+ \n
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform highp vec2 size;\n
+ uniform mediump vec2 extraSize;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+ uniform mediump float cornerRadius;\n
+ uniform mediump float cornerRadiusPolicy;\n
+ \n
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ mediump float minSize = min( visualSize.x, visualSize.y );\n
+ vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);\n
+ vCornerRadius = min( vCornerRadius, minSize * 0.5 );\n
+ vRectSize = visualSize / 2.0 - vCornerRadius;\n
+ vPosition = aPosition* visualSize;\n
+ return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+ \n
+ void main()\n
+ {\n
+ gl_Position = uMvpMatrix * ComputeVertexPosition();\n
+ }\n
+);
+
+//float distance = length( max( abs( position - center ), size ) - size ) - radius;
+const char* FRAGMENT_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vPosition;\n
+ varying mediump vec2 vRectSize;\n
+ varying mediump float vCornerRadius;\n
+ uniform lowp vec4 uColor;\n
+ uniform lowp vec3 mixColor;\n
+ \n
+ void main()\n
+ {\n
+ mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;\n
+ gl_FragColor = uColor * vec4( mixColor, 1.0 );\n
+ gl_FragColor.a *= 1.0 - smoothstep( -1.0, 1.0, dist );\n
+ }\n
+);
+
+const char* VERTEX_SHADER_BLUR_EDGE = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ uniform highp mat4 uMvpMatrix;\n
+ uniform highp vec3 uSize;\n
+ varying mediump vec2 vPosition;\n
+ varying mediump vec2 vRectSize;\n
+ \n
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform highp vec2 size;\n
+ uniform mediump vec2 extraSize;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+ uniform mediump float blurRadius;\n
+ \n
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize + blurRadius * 2.0;\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ vRectSize = visualSize / 2.0;\n
+ vPosition = aPosition* visualSize;\n
+ return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+ \n
+ void main()\n
+ {\n
+ gl_Position = uMvpMatrix * ComputeVertexPosition();\n
+ }\n
+);
+
+const char* FRAGMENT_SHADER_BLUR_EDGE = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vPosition;\n
+ varying mediump vec2 vRectSize;\n
+ uniform lowp vec4 uColor;\n
+ uniform lowp vec3 mixColor;\n
+ uniform mediump float blurRadius;\n
+ \n
+ void main()\n
+ {\n
+ mediump vec2 blur = 1.0 - smoothstep( vRectSize - blurRadius * 2.0, vRectSize, abs( vPosition ) );\n
+ gl_FragColor = uColor * vec4( mixColor, 1.0 );\n
+ gl_FragColor.a *= blur.x * blur.y;\n
+ }\n
+);
+