2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #include <dali-toolkit/public-api/shader-effects/blind-effect.h>
28 const std::string STEP_PROPERTY_NAME( "uStep" );
32 BlindEffect::BlindEffect()
36 //Call the Parent copy constructor to add reference to the implementation for this object
37 BlindEffect::BlindEffect(ShaderEffect handle)
42 BlindEffect::~BlindEffect()
47 BlindEffect BlindEffect::New()
49 std::string fragmentShader(
50 "uniform float uStep; \n"
53 " vec4 alphaColor; \n"
55 " baseColor = texture2D( sTexture, vTexCoord); \n"
56 " alphaColor = vec4(0.1,0.1,0.1,1.0); \n"
57 " float index = 0.0; \n"
58 " index = floor(vTexCoord.y/0.1); \n"
59 " if((vTexCoord.y < (index * 0.1 + uStep * 0.005)) && (vTexCoord.y > index * 0.1))\n"
61 " gl_FragColor = alphaColor; \n"
65 " gl_FragColor = baseColor; \n"
67 " gl_FragColor*=uColor; \n"
71 Dali::ShaderEffect shaderEffectCustom = Dali::ShaderEffect::New(
74 Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
75 ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
77 Dali::Toolkit::BlindEffect handle( shaderEffectCustom );
79 handle.SetUniform( STEP_PROPERTY_NAME, 0.0f );
84 void BlindEffect::SetStep(float step)
86 SetUniform( STEP_PROPERTY_NAME, step );
89 const std::string& BlindEffect::GetStepPropertyName() const
91 return STEP_PROPERTY_NAME;
94 } // namespace Toolkit