1 #ifndef __DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H__
2 #define __DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_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/public-api/actors/camera-actor.h>
23 #include <dali/public-api/actors/image-actor.h>
24 #include <dali/public-api/render-tasks/render-task.h>
25 #include <dali/public-api/shader-effects/shader-effect.h>
28 #include "image-filter.h"
40 * A two pass blur filter, pass one performs a horizontal blur and pass two performs a
41 * vertical blur on the result of pass one.
43 class BlurTwoPassFilter : public ImageFilter
54 virtual ~BlurTwoPassFilter();
56 public: // From ImageFilter
57 /// @copydoc Dali::Toolkit::Internal::ImageFilter::Enable
58 virtual void Enable();
60 /// @copydoc Dali::Toolkit::Internal::ImageFilter::Disable
61 virtual void Disable();
63 /// @copydoc Dali::Toolkit::Internal::ImageFilter::Refresh
64 virtual void Refresh();
67 * Get the property index that controls the strength of the blur applied to the image. Useful for animating this property.
68 * This property represents a value in the range [0.0 - 1.0] where 0.0 is no blur and 1.0 is full blur.
70 Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;}
73 * Retrieve the constrainable object to animate or constrain the blur strength property
74 * @return the constrainable object which blend the output image according to the blur strength
76 Constrainable GetHandleForAnimateBlurStrength();
80 * Setup position and parameters for camera
85 * Setup render tasks for blur
87 void CreateRenderTasks();
90 BlurTwoPassFilter( const BlurTwoPassFilter& );
91 BlurTwoPassFilter& operator=( const BlurTwoPassFilter& );
93 private: // Attributes
95 CameraActor mCameraForBlur;
97 // To perform horizontal blur from mInputImage to mImageForHorz
98 RenderTask mRenderTaskForHorz;
99 ImageActor mActorForInput;
100 FrameBufferImage mImageForHorz;
101 ShaderEffect mShaderForHorz;
103 // To perform vertical blur from mImageForHorz to mOutputImage
104 RenderTask mRenderTaskForVert;
105 ImageActor mActorForHorz;
106 ShaderEffect mShaderForVert;
107 FrameBufferImage mBlurredImage;
109 // To blend the blurred image and input image according to the blur strength
110 RenderTask mRenderTaskForBlending;
111 ImageActor mActorForBlending;
112 Actor mRootActorForBlending;
113 ShaderEffect mShaderForBlending;
114 Property::Index mBlurStrengthPropertyIndex;
116 }; // class BlurTwoPassFilter
118 } // namespace Internal
120 } // namespace Toolkit
124 #endif // __DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H__