X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fshader-effects%2Fblind-effect.h;h=a75180b418adc24c73aeea2568bb16f3946df3c5;hp=4c7405a7425ccf984273fbc3865f58a4ec49e972;hb=4eb683ee97fc0d8a7278b50252a467b843f869df;hpb=b1794535bb9e63b0706dcbd92af82a13962b51c4 diff --git a/dali-toolkit/public-api/shader-effects/blind-effect.h b/dali-toolkit/public-api/shader-effects/blind-effect.h index 4c7405a..a75180b 100644 --- a/dali-toolkit/public-api/shader-effects/blind-effect.h +++ b/dali-toolkit/public-api/shader-effects/blind-effect.h @@ -28,48 +28,48 @@ namespace Toolkit { /** - * BlindEffect is a custom shader effect to achieve blind effects in Image actors + * @brief BlindEffect is a custom shader effect to achieve blind effects in Image actors + * + * Animatable/Constrainable uniforms: + * "uStep" - The step of the blind effect. + * + * @return A handle to a newly allocated ShaderEffect */ -class DALI_IMPORT_API BlindEffect : public ShaderEffect -{ -public: - - /** - * Create an uninitialized BlindEffect; this can be initialized with BlindEffect::New() - * Calling member functions with an uninitialized Dali::Object is not allowed. - */ - BlindEffect(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~BlindEffect(); - - /** - * Create an initialized ~BlindEffect. - * @return A handle to a newly allocated Dali resource. - */ - static BlindEffect New(); +inline ShaderEffect CreateBlindEffect() +{ + std::string fragmentShader( + "uniform mediump float uStep; \n" + "void main() \n" + "{ \n" + " mediump vec4 alphaColor; \n" + " mediump vec4 baseColor; \n" + " baseColor = texture2D( sTexture, vTexCoord); \n" + " alphaColor = vec4(0.1,0.1,0.1,1.0); \n" + " lowp float index = 0.0; \n" + " index = floor(vTexCoord.y/0.1); \n" + " if((vTexCoord.y < (index * 0.1 + uStep * 0.005)) && (vTexCoord.y > index * 0.1))\n" + " { \n" + " gl_FragColor = alphaColor; \n" + " } \n" + " else \n" + " { \n" + " gl_FragColor = baseColor; \n" + " } \n" + " gl_FragColor*=uColor; \n" + "} \n" + ); - /** - * Set the step of the blind effect. - * @param [in] step The step - */ - void SetStep(float step); + Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( + "", + fragmentShader, + GeometryType( GEOMETRY_TYPE_IMAGE ), + ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID )); - /** - * Get the name for the step property - * which can be used in Animation API's - * @return A std::string containing the property name - */ - const std::string& GetStepPropertyName() const; + shaderEffect.SetUniform( "uStep", 0.0f ); -private: // Not intended for application developers - DALI_INTERNAL BlindEffect(ShaderEffect handle); -}; + return shaderEffect; +} } // namespace Toolkit