-public:
-
- /**
- * @brief Create an uninitialized ImageRegionEffect; this can be initialized with ImageRegionEffect::New().
- *
- * Calling member functions with an uninitialized Dali::Object is not allowed.
- */
- ImageRegionEffect();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~ImageRegionEffect();
-
- /**
- * @brief Create an initialized ImageRegionEffect.
- *
- * @return A handle to a newly allocated Dali resource.
- */
- static ImageRegionEffect New();
-
- /**
- * @brief Set the top-left corner of the image region.
- *
- * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
- * @param [in] point The top-left corner of the region.
- */
- void SetTopLeft(const Vector2& point);
-
- /**
- * @brief Set the bottom-right corner of the image region.
- *
- * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
- * @param [in] point The bottom-right corner of the region.
- */
- void SetBottomRight(const Vector2& point);
-
- /**
- * @brief Get the name for the top-left point property.
- *
- * which can be used in Animation API's
- * @return A std::string containing the property name
- */
- const std::string& GetTopLeftPropertyName() const;
-
- /**
- * @brief Get the name for the bottom-right point property which can be used in Animation APIs.
- *
- * @return A std::string containing the property name
- */
- const std::string& GetBottomRightPropertyName() const;
-
-private: // Not intended for application developers
- DALI_INTERNAL ImageRegionEffect(ShaderEffect handle);
-};
+ std::string vertexShader(
+ "attribute mediump vec2 aPosition;\n"
+ "\n"
+ "uniform mediump mat4 uMvpMatrix;\n"
+ "uniform vec3 uSize;\n"
+ "uniform vec4 uTextureRect;"
+ "\n"
+ "varying vec2 vTexCoord;\n"
+
+ "uniform mediump vec2 uTopLeft;\n"
+ "uniform mediump vec2 uBottomRight;\n"
+ "void main()\n"
+ "{\n"
+ " mediump vec4 position = vec4(aPosition, 0.0, 1.0);\n"
+ " position.xyz *= uSize;\n"
+ " gl_Position = uMvpMatrix * position;\n"
+ // The line below is doing the same as the following commented lines:
+ //" vec2 imageSize = uTextureRect.zw - uTextureRect.xy;\n"
+ //" vec2 topLeft = uTextureRect.xy + uTopLeft * imageSize;\n"
+ //" vec2 bottomRight = uTextureRect.xy + uBottomRight * imageSize;\n"
+ //" vec2 texCoord = (aTexCoord - uTextureRect.xy) / imageSize;\n"
+ //" vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n"
+
+ " vec2 texCoord = aPosition + vec2(0.5);\n"
+ " vTexCoord = uTextureRect.xy + uTopLeft * ( uTextureRect.zw - uTextureRect.xy ) + ( texCoord - uTextureRect.xy ) * ( uBottomRight - uTopLeft );\n"
+ "}\n"
+ );
+
+ Property::Map map;
+
+ Property::Map customShader;
+ customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexShader;
+
+ map[ DevelVisual::Property::SHADER ] = customShader;
+ return map;
+}