1 #ifndef __DALI_TOOLKIT_INTERNAL_SUPER_BLUR_VIEW_H__
2 #define __DALI_TOOLKIT_INTERNAL_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 #include <dali/dali.h>
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23 #include <dali-toolkit/public-api/controls/super-blur-view/super-blur-view.h>
24 #include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
38 * SuperBlurView implementation class
40 class SuperBlurView : public ControlImpl
45 * @copydoc Dali::Toolkit::SuperBlurView::New
47 static Toolkit::SuperBlurView New( unsigned int blurLevels );
50 * @copydoc Dali::Toolkit::SuperBlurView::SetImage
52 void SetImage(Image inputImage);
55 * @copydoc Dali::Toolkit::SuperBlurView::GetBlurStrengthPropertyIndex
57 Property::Index GetBlurStrengthPropertyIndex() const;
60 * @copydoc Dali::Toolkit::SuperBlurView::SetBlurStrength
62 void SetBlurStrength( float blurStrength );
65 * @copydoc Dali::Toolkit::SuperBlurView::GetCurrentBlurStrength
67 float GetCurrentBlurStrength() const;
70 * @copydoc Dali::Toolkit::SuperBlurView::BlurFinishedSignal
72 Dali::Toolkit::SuperBlurView::SuperBlurViewSignal& BlurFinishedSignal();
75 * @copydoc Dali::Toolkit::SuperBlurView::GetBlurredImage
77 Image GetBlurredImage( unsigned int level );
82 * Constructor. It initializes the SuperBlurView members
84 SuperBlurView( unsigned int blurLevels );
87 * A reference counted object may only be deleted by calling Unreference()
89 virtual ~SuperBlurView();
91 private: // from ControlImpl
94 * @copydoc Toolkit::Control::OnInitialize
96 virtual void OnInitialize();
99 * @copydoc Toolkit::Control::OnControlSizeSet
101 virtual void OnControlSizeSet(const Vector3& targetSize);
104 * @copydoc Toolkit::ControlImpl::OnRelaidOut()
106 virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
111 * Carry out the idx-th pass of blurring
112 * @param[in] idx The blur pass index
113 * @param[in] image The input image for the current blurring, it is either the original image or the blurred image from the previous pass
115 void BlurImage( unsigned int idx, Image image );
118 * Signal handler to tell when the last blur view completes
119 * @param[in] blurView The blur view that just completed
121 void OnBlurViewFinished( Toolkit::GaussianBlurView blurView );
124 * Clear the resources used to create the blurred image
126 void ClearBlurResource();
130 unsigned int mBlurLevels;
132 Property::Index mBlurStrengthPropertyIndex;
134 std::vector<Toolkit::GaussianBlurView> mGaussianBlurView;
135 std::vector<FrameBufferImage> mBlurredImage;
136 std::vector<ImageActor> mImageActors;
137 bool mResourcesCleared;
140 Toolkit::SuperBlurView::SuperBlurViewSignal mBlurFinishedSignal; ///< Signal emitted when blur has completed.
145 // Helpers for public-api forwarding methods
146 inline Toolkit::Internal::SuperBlurView& GetImpl( Toolkit::SuperBlurView& obj )
148 DALI_ASSERT_ALWAYS(obj);
149 Dali::RefObject& handle = obj.GetImplementation();
150 return static_cast<Toolkit::Internal::SuperBlurView&>(handle);
153 inline const Toolkit::Internal::SuperBlurView& GetImpl( const Toolkit::SuperBlurView& obj )
155 DALI_ASSERT_ALWAYS(obj);
156 const Dali::RefObject& handle = obj.GetImplementation();
157 return static_cast<const Toolkit::Internal::SuperBlurView&>(handle);
164 #endif /* __DALI_TOOLKIT_INTERNALSUPER_BLUR_VIEW_H__ */