1 #ifndef DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H
2 #define DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H
5 * Copyright (c) 2021 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/public-api/render-tasks/render-task.h>
25 #include "image-filter.h"
34 * A two pass blur filter, pass one performs a horizontal blur and pass two performs a
35 * vertical blur on the result of pass one.
37 class BlurTwoPassFilter : public ImageFilter
48 virtual ~BlurTwoPassFilter();
50 public: // From ImageFilter
51 /// @copydoc Dali::Toolkit::Internal::ImageFilter::Enable
52 void Enable() override;
54 /// @copydoc Dali::Toolkit::Internal::ImageFilter::Disable
55 void Disable() override;
57 /// @copydoc Dali::Toolkit::Internal::ImageFilter::Refresh
58 void Refresh() override;
60 /// @copydoc Dali::Toolkit::Internal::ImageFilter::SetSize
61 void SetSize(const Vector2& size) override;
64 * Get the property index that controls the strength of the blur applied to the image. Useful for animating this property.
65 * This property represents a value in the range [0.0 - 1.0] where 0.0 is no blur and 1.0 is full blur.
67 Property::Index GetBlurStrengthPropertyIndex() const
69 return mBlurStrengthPropertyIndex;
73 * Retrieve the handle to the object in order to animate or constrain the blur strength property
74 * @return The hadnle to the object which blends the output image according to the blur strength
76 Handle GetHandleForAnimateBlurStrength();
80 * Setup render tasks for blur
82 void CreateRenderTasks();
85 BlurTwoPassFilter(const BlurTwoPassFilter&);
86 BlurTwoPassFilter& operator=(const BlurTwoPassFilter&);
88 private: // Attributes
89 // To perform horizontal blur from mInputTexture to mFrameBufferForHorz
90 RenderTask mRenderTaskForHorz;
92 FrameBuffer mFrameBufferForHorz;
94 // To perform vertical blur from mFrameBufferForHorz to mOutputFrameBuffer
95 RenderTask mRenderTaskForVert;
97 FrameBuffer mBlurredFrameBuffer;
99 // To blend the blurred image and input image according to the blur strength
100 RenderTask mRenderTaskForBlending;
101 Actor mActorForBlending;
102 Actor mRootActorForBlending;
103 Property::Index mBlurStrengthPropertyIndex;
105 }; // class BlurTwoPassFilter
107 } // namespace Internal
109 } // namespace Toolkit
113 #endif // DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H