X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fshader-effects%2Falpha-discard-effect.h;h=e782f78b388fe09c9e71b416ec7578215ec0f70e;hp=4d1e40a0915ea90a7e1daef9925faab658a1af31;hb=HEAD;hpb=31df2b9472ccbe0ae460a958535be8ef790c96f2 diff --git a/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h b/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h index 4d1e40a..e782f78 100644 --- a/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h +++ b/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H__ -#define __DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H__ +#ifndef DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H +#define DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,14 +19,15 @@ */ // EXTERNAL INCLUDES -#include +#include + +// INTERNAL INCLUDES +#include namespace Dali { - namespace Toolkit { - /** * @brief Creates a new Alpha discard effect * @@ -35,31 +36,16 @@ namespace Toolkit * * 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() -{ - const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE = - "void main() \n" - "{ \n" - " mediump vec4 color = texture2D( sTexture, vTexCoord ); \n" - " if(color.a <= 0.0001) \n" - " { \n" - " discard; \n" - " } \n" - " gl_FragColor = color * uColor; \n" - "} \n"; - - return ShaderEffect::New( "", // Use default - ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE ); -} +DALI_TOOLKIT_API Property::Map CreateAlphaDiscardEffect(); } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H__ +#endif // DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H