X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbubble-effect%2Fcolor-adjuster.h;h=27df32e76f1c97494f90f77550f43b2630689f53;hb=ae59f2ed1fd067050fb57465b9623160d995e02e;hp=8e24326368978934ad0ab573bd9bc94aa53100f5;hpb=d9c164e4530e354cd14dc4a1a658070ba55e99b8;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/bubble-effect/color-adjuster.h b/dali-toolkit/internal/controls/bubble-effect/color-adjuster.h index 8e24326..27df32e 100644 --- a/dali-toolkit/internal/controls/bubble-effect/color-adjuster.h +++ b/dali-toolkit/internal/controls/bubble-effect/color-adjuster.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_ -#define __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_ +#ifndef DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H +#define DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_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. @@ -17,8 +17,15 @@ * limitations under the License. * */ + +// EXTERNAL INCLUDES #include -#include +#include + +// INTERNAL INCLUDES +#include + +#define DALI_COMPOSE_SHADER(STR) #STR namespace Dali { @@ -29,6 +36,12 @@ namespace Toolkit namespace Internal { +inline void SetColorAdjusterProperties( Actor& actor, const Vector3& hsvDelta, bool ignoreAlpha = false ) +{ + actor.RegisterProperty( "uHSVDelta", hsvDelta ); + actor.RegisterProperty( "uIgnoreAlpha", ignoreAlpha ? 1.f : 0.f ); +} + /** * Creates a new ColorAdjuster effect. * ColorAdjuster is a custom shader effect to adjust the image color in HSV space. @@ -36,12 +49,14 @@ namespace Internal * @param[in] ignoreAlpha If true, the result color will be opaque even though source has alpha value * @return A handle to a newly allocated Dali resource. */ -inline ShaderEffect CreateColorAdjuster( const Vector3& hsvDelta, bool ignoreAlpha = false ) +inline Property::Map CreateColorAdjuster() { std::string fragmentShader = DALI_COMPOSE_SHADER( precision highp float;\n uniform vec3 uHSVDelta;\n uniform float uIgnoreAlpha;\n + varying mediump vec2 vTexCoord;\n + uniform sampler2D sTexture;\n float rand(vec2 co) \n {\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n} @@ -78,11 +93,13 @@ inline ShaderEffect CreateColorAdjuster( const Vector3& hsvDelta, bool ignoreAlp }\n ); - ShaderEffect shaderEffect = ShaderEffect::New("", fragmentShader); - shaderEffect.SetUniform( "uHSVDelta", hsvDelta ); - shaderEffect.SetUniform( "uIgnoreAlpha", ignoreAlpha?1.0f:0.0f ); + Property::Map customShader; + customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentShader; + + Property::Map map; + map[ Toolkit::DevelVisual::Property::SHADER ] = customShader; - return shaderEffect; + return map; } } // namespace Internal @@ -91,4 +108,4 @@ inline ShaderEffect CreateColorAdjuster( const Vector3& hsvDelta, bool ignoreAlp } // namespace Dali -#endif /* __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_ */ +#endif // DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H