Conversion to Apache 2.0 license
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / public-api / shader-effects / carousel-effect.h
1 #ifndef __DALI_TOOLKIT_CAROUSEL_EFFECT_H__
2 #define __DALI_TOOLKIT_CAROUSEL_EFFECT_H__
3
4 /*
5  * Copyright (c) 2014 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 // INTERNAL INCLUDES
22 #include <dali/dali.h>
23
24 namespace Dali DALI_IMPORT_API
25 {
26
27 namespace Toolkit
28 {
29
30 /**
31  * CarouselEffect is a custom shader effect to achieve Carousel effects in actors
32  *
33  * A Carousel has a Radius property which can be +ve (appear as if viewing from the outside of
34  * a cylinder/sphere)
35  * or -ve (appear as if viewing from the inside of a cylinder/sphere).
36  *
37  * It can be a horizontal or vertical (cylindrical) or both (spherical). The AnglePerUnit
38  * property provides this functionality as a Vector2.
39  *
40  * Finally, the carousel's center position can be specified as a Screen coordinate (top-left being
41  * the origin).
42  */
43 class CarouselEffect : public ShaderEffect
44 {
45 public:
46
47   /**
48    * Create an uninitialized CarouselEffect; this can be initialized with CarouselEffect::New()
49    * Calling member functions with an uninitialized Dali::Object is not allowed.
50    */
51   CarouselEffect();
52
53   /**
54    * Virtual destructor.
55    */
56   virtual ~CarouselEffect();
57
58   /**
59    * Create an initialized CarouselEffect.
60    * @return A handle to a newly allocated Dali resource.
61    */
62   static CarouselEffect New();
63
64   /**
65    * Set the radius of the Carousel effect.
66    * A positive Radius will bend toward the camera,
67    * while a negative Radius will bend away from the camera.
68    * @param[in] radius The new radius.
69    */
70   void SetRadius( float radius);
71
72   /**
73    * Sets the center point of the carousel (in screen coordinates)
74    * this is where the peek of the carousel should appear.
75    * this defaults to top-left corner (0.0f, 0.0f).
76    *
77    * @param[in] center The center point.
78    */
79   void SetCenter( const Vector2& center );
80
81   /**
82    * Set the angle deviation of Carousel in degrees per
83    * geometric unit for each axis. For example if you
84    * wish for the horizontal angle deviation to vary from +/- 10
85    * degrees, then a Value of 20.0f / stageWidth for the X
86    * component should be specified.
87    *
88    * @param[in] angle the Angle Spread in X and Y axes.
89    */
90   void SetAnglePerUnit( const Vector2& angle );
91
92   /**
93    * Get the name for the radius property
94    * @return A std::string containing the property name
95    */
96   const std::string& GetRadiusPropertyName() const;
97
98   /**
99    * Get the name for the center property
100    * @return A std::string containing the property name
101    */
102   const std::string& GetCenterPropertyName() const;
103
104   /**
105    * Get the name for the angle spread property
106    * @return A std::string containing the property name
107    */
108   const std::string& GetAnglePerUnitPropertyName() const;
109
110
111 private: // Not intended for application developers
112   CarouselEffect(ShaderEffect handle);
113 };
114
115 } // namespace Toolkit
116
117 } // namespace Dali
118
119 #endif // __DALI_TOOLKIT_CAROUSEL_EFFECT_H__