Toolkit - Fixes TC build issues and compile warnings.
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / controls / super-blur-view / super-blur-view.h
1 #ifndef __DALI_TOOLKIT_SUPER_BLUR_VIEW_H__
2 #define __DALI_TOOLKIT_SUPER_BLUR_VIEW_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 /**
22  * @addtogroup CAPI_DALI_TOOLKIT_SUPER_BLUR_VIEW_MODULE
23  * @{
24  */
25
26 // EXTERNAL INCLUDES
27
28 // INTERNAL INCLUDES
29 #include <dali-toolkit/public-api/controls/control.h>
30
31 namespace Dali DALI_IMPORT_API
32 {
33
34 namespace Toolkit
35 {
36
37 namespace Internal DALI_INTERNAL
38 {
39 class SuperBlurView;
40 }
41
42 /**
43  * @brief SuperBlurView accepts an image as input, and displays/animates it with various blur strength.
44  * Usage example:-
45  *
46  *  // initialise\n
47  *  SuperBlurView blurView = SuperBlurView::New( blurLevels );\n
48  *  blurView.SetSize();  // it is important to set the display size before set the input image!!
49  *  Stage::GetCurrent().Add(blurView);\n
50  *
51  *  // Set the input image
52  *  Image image = Image::New(...);\n
53  *  blurView.SetImage(image);\n
54  *
55  *  // animate the strength of the blur - this can fade between no blur and full blur. .\n
56  *  Animation blurAnimation = Animation::New( ... );\n
57  *  blurAnimation.AnimateTo( Property( blurView, blurView.GetBlurStrengthPropertyIndex() ), ... );\n
58  *  blurAnimation.Play();\n
59  */
60 class SuperBlurView : public Control
61 {
62 public:
63
64   // Properties
65   static const Property::Index PROPERTY_IMAGE;     ///< name "image",    @see SetImage,    type MAP
66
67   /**
68    * @brief Signal type for notifications.
69    */
70   typedef SignalV2< void (SuperBlurView source) > SuperBlurViewSignal;
71
72   /**
73    * @brief Creates an empty SuperBlurView handle.
74    */
75   SuperBlurView();
76
77   /**
78    * @brief Create an initialized SuperBlurView.
79    *
80    * @param[in] blurLevels The final blur strength level. It decides how many filtering passes are used to create the group of blurred images.
81    * @return A handle to a newly allocated Dali resource
82    */
83   static SuperBlurView New( unsigned int blurLevels );
84
85   /**
86    * @brief Copy constructor.
87    *
88    * Creates another handle that points to the same real object.
89    * @param[in] handle the handle to copy from
90    */
91   SuperBlurView( const SuperBlurView& handle );
92
93   /**
94    * @brief Assignment operator.
95    *
96    * Changes this handle to point to another real object.
97    * @param[in] rhs the handle to copy from
98    * @return a reference to this
99    */
100   SuperBlurView& operator=( const SuperBlurView& rhs );
101
102   /**
103    * @brief Destructor
104    *
105    * This is non-virtual since derived Handle types must not contain data or virtual methods.
106    */
107   ~SuperBlurView();
108
109   /**
110    * @brief Downcast an Object handle to SuperBlurView.
111    *
112    * If handle points to a SuperBlurView, the downcast produces valid handle.
113    * If not, the returned handle is left uninitialized.
114    * @param[in] handle Handle to an object
115    * @return handle to a SuperBlurView or an uninitialized handle
116    */
117   static SuperBlurView DownCast( BaseHandle handle );
118
119   /**
120    * @brief Sets a custom image to be blurred.
121    *
122    * @param[in] inputImage The image that the user wishes to blur
123    */
124   void SetImage(Image inputImage);
125
126   /**
127    * @brief Get the index of the property that can be used to fade the blur in / out.
128    *
129    * This is the overall strength of the blur.
130    * User can use this to animate the blur. A value of 0.0 is zero blur and 1.0 is full blur. Default is 0.0.
131    * @return Index of the property that can be used to fade the blur in / out
132    */
133   Property::Index GetBlurStrengthPropertyIndex() const;
134
135   /**
136    * @brief Set the blur strength to display the image.
137    *
138    * @param[in] blurStrength The blur strength used to display the image.
139    */
140   void SetBlurStrength( float blurStrength );
141
142   /**
143    * @brief Get the current blur strength.
144    *
145    * @return The current blur strength
146    */
147   float GetCurrentBlurStrength() const;
148
149   /**
150    * @brief Connect to this signal to be notified when the all the blurs have completed.
151    *
152    * @return The BlurFinished signal
153    */
154   SuperBlurViewSignal& BlurFinishedSignal();
155
156   /**
157    * @brief Get the blurred image.
158    *
159    * Should wait for the BlurFinishedSignal before calling this method.
160    * @param[in] level Indicate which blurred image to get, must be a value between 1 and  blurLevels
161    * @return The level-th blurred image
162    */
163   Image GetBlurredImage( unsigned int level );
164
165 public: // Not intended for application developers
166
167   /**
168    * @brief Creates a handle using the Toolkit::Internal implementation.
169    *
170    * @param[in]  implementation  The Control implementation.
171    */
172   DALI_INTERNAL SuperBlurView(Internal::SuperBlurView& implementation);
173
174   /**
175    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
176    *
177    * @param[in]  internal  A pointer to the internal CustomActor.
178    */
179   DALI_INTERNAL SuperBlurView(Dali::Internal::CustomActor* internal);
180
181 };
182
183 } // namespace Toolkit
184
185 } // namespace Dali
186
187
188 /**
189  * @}
190  */
191 #endif /* __DALI_TOOLKIT_SUPER_BLUR_VIEW_H__ */