Updated all header files to new format
[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) 2021 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
23 namespace Dali
24 {
25 namespace Toolkit
26 {
27 namespace Internal
28 {
29 /**
30  * @brief Re-applies PageTurnEffect internal constraints
31  * The internal constraint uses the OriginalCenter property and the CURRENT_CENTER Property
32  * to update the variety of common parameters which are with the same value for all the vertices.
33  * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
34  * So if there are other contraints applied to the ORIGINAL_CENTER or CURRENT_CENTER while when using this effect,
35  * call this method to get the internal constraints and re-apply it afterwards.
36  *
37  * @param[in] actor The page turn actor to which internal constraints should be re-applied
38  * @param[in] pageHeight The page height.
39  */
40 void PageTurnApplyInternalConstraint(Actor& actor, float pageHeight);
41
42 /**
43  * @brief Create a new PageTurnEffect
44  * PageTurnEffect is a custom shader to achieve page turn effect for image views.
45  *
46  * Usage example:-
47  *
48  * // create shader used for doing page-turn effect\n
49  * Property::Map pageTurnEffect = CreatePageTurnEffect();
50  *
51  * // set image view custom shader to the page-turn one\n
52  * // for portrait view, the image is rendered as the front side of  page\n
53  * // for landscape view, the back side becomes visible when the page is turned over. \n
54  * //     in this case, the left and right half of the image are renderer as the front and back side separately. \n
55  * ImageView page = ImageView::New(....); \n
56  * page.SetProperty ( ImageView::Property::IMAGE, pageTurnEffect ); \n
57  *
58  * //set initial values
59  * page.SetProperty( page.GetPropertyIndex("uIsTurningBack",) bool );\n
60  * page.SetProperty( page.GetPropertyIndex("uSpineShadowParameter",) Vector2 );\n
61  * page.SetProperty( page.GetPropertyIndex("ORIGINAL_CENTER"), Vector2 );\n
62  * page.SetProperty( page.GetPropertyIndex("CURRENT_CENTER"), Vector2 );\n
63  * page.SetProperty( page.GetPropertyIndex("uCommonParameters"), Matrix );\n
64  * page.SetProperty( page.GetPropertyIndex("uTextureWidth"), float ); // Set to 1.0 for single-sided or 2.0 for double-sided \n
65  * PageTurnApplyInternalConstraint( page );\n
66  *
67  * //Animate it with the current center property\n
68  * Animation animation = Animation::New( ... );\n
69  * animation.AnimateTo(Property( page, "CURRENT_CENTER" ),
70  *                               currentCenter,
71  *                               AlphaFunction::...);\n
72  * animation.Play(); \n
73  *
74  */
75 Property::Map CreatePageTurnEffect();
76
77 } // namespace Internal
78
79 } // namespace Toolkit
80
81 } // namespace Dali
82
83 #endif // DALI_PAGE_TURN_EFFECT_H