1 #ifndef __DALI_TOOLKIT_SUPER_BLUR_VIEW_H__
2 #define __DALI_TOOLKIT_SUPER_BLUR_VIEW_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
21 * @addtogroup CAPI_DALI_FRAMEWORK
28 #include <dali-toolkit/public-api/controls/control.h>
30 namespace Dali DALI_IMPORT_API
36 namespace Internal DALI_INTERNAL
42 * SuperBlurView accepts an image as input, and displays/animates it with various blur strength.
46 * SuperBlurView blurView = SuperBlurView::New( blurLevels );\n
47 * blurView.SetSize(); // it is important to set the display size before set the input image!!
48 * Stage::GetCurrent().Add(blurView);\n
50 * // Set the input image
51 * Image image = Image::New(...);\n
52 * blurView.SetImage(image);\n
54 * // animate the strength of the blur - this can fade between no blur and full blur. .\n
55 * Animation blurAnimation = Animation::New( ... );\n
56 * blurAnimation.AnimateTo( Property( blurView, blurView.GetBlurStrengthPropertyIndex() ), ... );\n
57 * blurAnimation.Play();\n
59 class SuperBlurView : public Control
63 * Signal type for notifications
65 typedef SignalV2< void (SuperBlurView source) > SuperBlurViewSignal;
68 * Creates an empty SuperBlurView handle
73 * Create an initialized SuperBlurView
74 * @param[in] blurLevels The final blur strength level. It decides how many filtering passes are used to create the group of blurred images.
75 * @return A handle to a newly allocated Dali resource
77 static SuperBlurView New( unsigned int blurLevels );
80 * Copy constructor. Creates another handle that points to the same real object
82 SuperBlurView( const SuperBlurView& handle );
85 * Assignment operator. Changes this handle to point to another real object
87 SuperBlurView& operator=( const SuperBlurView& rhs );
92 virtual ~SuperBlurView();
95 * Downcast an Object handle to SuperBlurView.
96 * If handle points to a SuperBlurView, the downcast produces valid handle.
97 * If not, the returned handle is left uninitialized.
98 * @param[in] handle Handle to an object
99 * @return handle to a SuperBlurView or an uninitialized handle
101 static SuperBlurView DownCast( BaseHandle handle );
104 * Sets a custom image to be blurred
105 * @param[in] inputImage The image that the user wishes to blur
107 void SetImage(Image inputImage);
110 * Get the index of the property that can be used to fade the blur in / out. This is the overall strength of the blur.
111 * 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.
112 * @return Index of the property that can be used to fade the blur in / out
114 Property::Index GetBlurStrengthPropertyIndex() const;
117 * Set the blur strength to display the image
118 * @param[in] blurStrength The blur strength used to display the image.
120 void SetBlurStrength( float blurStrength );
123 * Get the current blur strength
124 * @return The current blur strength
126 float GetCurrentBlurStrength() const;
129 * Connect to this signal to be notified when the all the blurs have completed.
130 * @return The BlurFinished signal
132 SuperBlurViewSignal& BlurFinishedSignal();
135 * Get the blurred image. Should wait for the BlurFinishedSignal before calling this method
136 * @param[in] level Indicate which blurred image to get, must be a value between 1 and blurLevels
137 * @return The level-th blurred image
139 Image GetBlurredImage( unsigned int level );
141 public: // Not intended for application developers
144 * Creates a handle using the Toolkit::Internal implementation.
145 * @param[in] implementation The Control implementation.
147 DALI_INTERNAL SuperBlurView(Internal::SuperBlurView& implementation);
150 * Allows the creation of this Control from an Internal::CustomActor pointer.
151 * @param[in] internal A pointer to the internal CustomActor.
153 DALI_INTERNAL SuperBlurView(Dali::Internal::CustomActor* internal);
157 } // namespace Toolkit
165 #endif /* __DALI_TOOLKIT_SUPER_BLUR_VIEW_H__ */