#define __DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/object/property-map.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
*
* Usage example:
*
- * ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) );
- * ShaderEffect alphaDiscardEffect = CreateAlphaDiscardEffect();
- * actor.SetShaderEffect( alphaDiscardEffect );
+ * ImageView actor = ImageView::New( EXAMPLE_IMAGE_PATH );
+ * Property::Map alphaDiscardEffect = CreateAlphaDiscardEffect();
+ * actor.SetProperty( ImageView::Property::IMAGE, alphaDiscardEffect );
*
- * @return A handle to a newly allocated ShaderEffect.
+ * @return A property map of the required shaders.
*/
-inline ShaderEffect CreateAlphaDiscardEffect()
+inline Property::Map CreateAlphaDiscardEffect()
{
const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE =
+ "varying mediump vec2 vTexCoord; \n"
+ " \n"
+ "uniform sampler2D sTexture; \n"
+ "uniform lowp vec4 uColor; \n"
"void main() \n"
"{ \n"
" mediump vec4 color = texture2D( sTexture, vTexCoord ); \n"
" gl_FragColor = color * uColor; \n"
"} \n";
- return ShaderEffect::New( "", // Use default
- ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE );
+ Property::Map map;
+
+ Property::Map customShader;
+ customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE;
+
+ map[ Visual::Property::SHADER ] = customShader;
+ return map;
}
} // namespace Toolkit