1 #ifndef __DALI_TOOLKIT_SHADER_EFFECT_BLIND_H__
2 #define __DALI_TOOLKIT_SHADER_EFFECT_BLIND_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/shader-effects/shader-effect.h>
31 * @brief BlindEffect is a custom shader effect to achieve blind effects in Image actors
33 * Animatable/Constrainable uniforms:
34 * "uStep" - The step of the blind effect.
36 * @return A handle to a newly allocated ShaderEffect
39 inline ShaderEffect CreateBlindEffect()
41 std::string fragmentShader(
42 "uniform mediump float uStep; \n"
45 " mediump vec4 alphaColor; \n"
46 " mediump vec4 baseColor; \n"
47 " baseColor = texture2D( sTexture, vTexCoord); \n"
48 " alphaColor = vec4(0.1,0.1,0.1,1.0); \n"
49 " lowp float index = 0.0; \n"
50 " index = floor(vTexCoord.y/0.1); \n"
51 " if((vTexCoord.y < (index * 0.1 + uStep * 0.005)) && (vTexCoord.y > index * 0.1))\n"
53 " gl_FragColor = alphaColor; \n"
57 " gl_FragColor = baseColor; \n"
59 " gl_FragColor*=uColor; \n"
63 Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New(
66 ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
68 shaderEffect.SetUniform( "uStep", 0.0f );
73 } // namespace Toolkit
77 #endif // __DALI_TOOLKIT_SHADER_EFFECT_BLIND_H__