PageTurnView cleanup
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / page-turn-view / page-turn-effect.h
1 #ifndef __DALI_PAGE_TURN_EFFECT_H_
2 #define __DALI_PAGE_TURN_EFFECT_H_
3
4 /*
5  * Copyright (c) 2015 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/animation/constraint.h>
23 #include <dali/public-api/common/stage.h>
24 #include <dali/public-api/object/property-input.h>
25 #include <dali/public-api/shader-effects/shader-effect.h>
26 #include <sstream>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 namespace Internal
35 {
36
37
38 /**
39  * @brief Re-applies PageTurnEffect internal constraints
40  * The internal constraint uses the OriginalCenter property and the CurrentCenter Property
41  * to update the variety of common parameters which are with the same value for all the vertices.
42  * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
43  * So if there are other contraints applied to the OriginalCenter or CurrentCenter while when using this effect,
44  * call this method to get the internal constraints and re-apply it afterwards.
45  *
46  * @param[in] shaderEffect The page turn effect to which internal constraints should be re-applied
47  */
48 void PageTurnApplyInternalConstraint( ShaderEffect& shaderEffect);
49
50 /**
51  * @brief Create a new PageTurnEffect
52  * PageTurnEffect is a custom shader effect to achieve page turn effect for Image actors.
53  *
54  * Usage example:-
55  *
56  * // create shader used for doing page-turn effect\n
57  * ShaderEffect pageTurnEffect = CreatePageTurnEffect();
58  *
59  * // set image actor shader to the page-turn one\n
60  * // for portrait view, one image actor for each page\n
61  * // for landscape view, the page turned over is still visible, so back image is needed \n
62  * //     in this case, create another image Actor using the back image and added to the page actor \n
63  * ImageActor pageActor = ImageActor::New(....); \n
64  * ImageActor backImageActor = ImageActor::New(....); \n
65  * pageActor.Add(backPageActor);\n
66  * pageActor.SetShaderEffect ( pageTurnEffect ); \n
67  *
68  * //set initial values
69  * pageTurnEffect.SetUniform("uPageSize", Vector2);\n
70  * pageTurnEffect.SetUniform("uOriginalCenter", Vector2);\n
71  * pageTurnEffect.SetUniform("uIsTurningBack", bool);\n
72  * pageTurnEffect.SetUniform("uCurrentCenter",Vector2);\n
73  *
74  * //Animate it with the current center property\n
75  * Animation animation[mAnimationIndex] = Animation::New( ... );\n
76  * animation.AnimateTo(Property( pageTurnEffect, "uCurrentCenter" ),
77  *                            currentCenter,
78  *                            AlphaFunction::...);\n
79  * animation[mAnimationIndex].Play(); \n
80  *
81  * Animatable/Constrainable uniforms:
82  */
83 ShaderEffect CreatePageTurnEffect();
84
85 } // namespace Internal
86
87 } // namespace Toolkit
88
89 } // namespace Dali
90
91 #endif /* __DALI_TOOLKIT_SC_CURVE_EFFECT_H_ */