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 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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 Control
46 * @copydoc Dali::Toolkit::SuperBlurView::New
48 static Toolkit::SuperBlurView New( unsigned int blurLevels );
51 * @copydoc Dali::Toolkit::SuperBlurView::SetImage
53 void SetImage(Image inputImage);
56 * @copydoc Dali::Toolkit::SuperBlurView::GetBlurStrengthPropertyIndex
58 Property::Index GetBlurStrengthPropertyIndex() const;
61 * @copydoc Dali::Toolkit::SuperBlurView::SetBlurStrength
63 void SetBlurStrength( float blurStrength );
66 * @copydoc Dali::Toolkit::SuperBlurView::GetCurrentBlurStrength
68 float GetCurrentBlurStrength() const;
71 * @copydoc Dali::Toolkit::SuperBlurView::BlurFinishedSignal
73 Dali::Toolkit::SuperBlurView::SuperBlurViewSignal& BlurFinishedSignal();
76 * @copydoc Dali::Toolkit::SuperBlurView::GetBlurredImage
78 Image GetBlurredImage( unsigned int level );
83 * Called when a property of an object of this type is set.
84 * @param[in] object The object whose property is set.
85 * @param[in] index The property index.
86 * @param[in] value The new property value.
88 static void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value );
91 * Called to retrieve a property of an object of this type.
92 * @param[in] object The object whose property is to be retrieved.
93 * @param[in] index The property index.
94 * @return The current value of the property.
96 static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
101 * Constructor. It initializes the SuperBlurView members
103 SuperBlurView( unsigned int blurLevels );
106 * A reference counted object may only be deleted by calling Unreference()
108 virtual ~SuperBlurView();
110 private: // from Control
113 * @copydoc Toolkit::Control::OnInitialize
115 virtual void OnInitialize();
118 * @copydoc Toolkit::Control::OnControlSizeSet
120 virtual void OnControlSizeSet(const Vector3& targetSize);
123 * @copydoc Control::OnRelayout()
125 virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
130 * Carry out the idx-th pass of blurring
131 * @param[in] idx The blur pass index
132 * @param[in] image The input image for the current blurring, it is either the original image or the blurred image from the previous pass
134 void BlurImage( unsigned int idx, Image image );
137 * Signal handler to tell when the last blur view completes
138 * @param[in] blurView The blur view that just completed
140 void OnBlurViewFinished( Toolkit::GaussianBlurView blurView );
143 * Clear the resources used to create the blurred image
145 void ClearBlurResource();
149 unsigned int mBlurLevels;
151 Property::Index mBlurStrengthPropertyIndex;
153 std::vector<Toolkit::GaussianBlurView> mGaussianBlurView;
154 std::vector<FrameBufferImage> mBlurredImage;
155 std::vector<ImageActor> mImageActors;
156 bool mResourcesCleared;
159 Toolkit::SuperBlurView::SuperBlurViewSignal mBlurFinishedSignal; ///< Signal emitted when blur has completed.
164 // Helpers for public-api forwarding methods
165 inline Toolkit::Internal::SuperBlurView& GetImpl( Toolkit::SuperBlurView& obj )
167 DALI_ASSERT_ALWAYS(obj);
168 Dali::RefObject& handle = obj.GetImplementation();
169 return static_cast<Toolkit::Internal::SuperBlurView&>(handle);
172 inline const Toolkit::Internal::SuperBlurView& GetImpl( const Toolkit::SuperBlurView& obj )
174 DALI_ASSERT_ALWAYS(obj);
175 const Dali::RefObject& handle = obj.GetImplementation();
176 return static_cast<const Toolkit::Internal::SuperBlurView&>(handle);
183 #endif /* __DALI_TOOLKIT_INTERNALSUPER_BLUR_VIEW_H__ */