-
-namespace
-{
-
-const std::string TOP_LEFT_PROPERTY_NAME( "uTopLeft" );
-const std::string BOTTOM_RIGHT_PROPERTY_NAME( "uBottomRight" );
-
-} // namespace
-
-ImageRegionEffect::ImageRegionEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-ImageRegionEffect::ImageRegionEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-ImageRegionEffect::~ImageRegionEffect()
-{
-}
-
-
-ImageRegionEffect ImageRegionEffect::New()
-{
- std::string vertexShader(
- "uniform mediump vec2 uTopLeft;\n"
- "uniform mediump vec2 uBottomRight;\n"
- "void main()\n"
- "{\n"
- " mediump vec4 position = vec4(aPosition,1.0);\n"
- " gl_Position = uMvpMatrix * position;\n"
- // The line below is doing the same as the following commented lines:
- //" vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n"
- //" vec2 topLeft = sTextureRect.xy + uTopLeft * imageSize;\n"
- //" vec2 bottomRight = sTextureRect.xy + uBottomRight * imageSize;\n"
- //" vec2 texCoord = (aTexCoord - sTextureRect.xy) / imageSize;\n"
- //" vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n"
- " vTexCoord = sTextureRect.xy + uTopLeft * ( sTextureRect.zw - sTextureRect.xy ) + ( aTexCoord - sTextureRect.xy ) * ( uBottomRight - uTopLeft );\n"
- "}\n"
- );
-
- Dali::ShaderEffect shaderEffectCustom = Dali::ShaderEffect::New( vertexShader, "" );
-
- Dali::Toolkit::ImageRegionEffect handle( shaderEffectCustom );
-
- handle.SetUniform( TOP_LEFT_PROPERTY_NAME, Vector2( 0.f, 0.f ) );
- handle.SetUniform( BOTTOM_RIGHT_PROPERTY_NAME, Vector2( 1.f, 1.f ) );
-
- return handle;
-}
-
-void ImageRegionEffect::SetTopLeft(const Vector2& point)
-{
- SetUniform( TOP_LEFT_PROPERTY_NAME, point );
-}
-
-void ImageRegionEffect::SetBottomRight(const Vector2& point)