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