Change BuildRequires of dali2-toolkit to Requires
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / bubble-effect / color-adjuster.h
1 #ifndef DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H
2 #define DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H
3
4 /*
5  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/math/vector3.h>
23 #include <dali/public-api/object/property-map.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/visuals/visual-properties.h>
27 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace Internal
36 {
37
38 inline void SetColorAdjusterProperties( Actor& actor, const Vector3& hsvDelta, bool ignoreAlpha = false )
39 {
40   actor.RegisterProperty( "uHSVDelta", hsvDelta );
41   actor.RegisterProperty( "uIgnoreAlpha", ignoreAlpha ? 1.f : 0.f );
42 }
43
44 /**
45 * Creates a new ColorAdjuster effect.
46 * ColorAdjuster is a custom shader effect to adjust the image color in HSV space.
47 * @param[in] hsvDelta The color difference to apply to the HSV channel.
48 * @param[in] ignoreAlpha If true, the result color will be opaque even though source has alpha value
49 * @return A handle to a newly allocated Dali resource.
50 */
51 inline Property::Map CreateColorAdjuster()
52 {
53   Property::Map customShader;
54   customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = SHADER_BUBBLE_EFFECT_COLOR_ADJUSTER_FRAG.data();
55
56   Property::Map map;
57   map[ Toolkit::Visual::Property::SHADER ] = customShader;
58
59   return map;
60 }
61
62 } // namespace Internal
63
64 } // namespace Toolkit
65
66 } // namespace Dali
67
68 #endif // DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H