Merge "TextController - Update the text model." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / filters / blur-two-pass-filter.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H__
2 #define __DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/render-tasks/render-task.h>
23 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
24 #include <dali/public-api/actors/image-actor.h>
25
26 // INTERNAL INCLUDES
27 #include "image-filter.h"
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace Internal
36 {
37
38 /**
39  * A two pass blur filter, pass one performs a horizontal blur and pass two performs a
40  * vertical blur on the result of pass one.
41  */
42 class BlurTwoPassFilter : public ImageFilter
43 {
44 public:
45   /**
46    * Default constructor
47    */
48   BlurTwoPassFilter();
49
50   /**
51    * Destructor
52    */
53   virtual ~BlurTwoPassFilter();
54
55 public: // From ImageFilter
56   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Enable
57   virtual void Enable();
58
59   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Disable
60   virtual void Disable();
61
62   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Refresh
63   virtual void Refresh();
64
65   /// @copydoc Dali::Toolkit::Internal::ImageFilter::SetSize
66   virtual void SetSize( const Vector2& size );
67
68   /**
69    * Get the property index that controls the strength of the blur applied to the image. Useful for animating this property.
70    * This property represents a value in the range [0.0 - 1.0] where 0.0 is no blur and 1.0 is full blur.
71    */
72   Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;}
73
74   /**
75    * Retrieve the handle to the object in order to animate or constrain the blur strength property
76    * @return The hadnle to the object which blends the output image according to the blur strength
77    */
78   Handle GetHandleForAnimateBlurStrength();
79
80 private:
81
82   /**
83    * Setup render tasks for blur
84    */
85   void CreateRenderTasks();
86
87 private:
88   BlurTwoPassFilter( const BlurTwoPassFilter& );
89   BlurTwoPassFilter& operator=( const BlurTwoPassFilter& );
90
91 private: // Attributes
92
93   // To perform horizontal blur from mInputImage to mImageForHorz
94   RenderTask         mRenderTaskForHorz;
95   Toolkit::ImageView mActorForInput;
96   FrameBufferImage   mImageForHorz;
97
98   // To perform vertical blur from mImageForHorz to mOutputImage
99   RenderTask         mRenderTaskForVert;
100   Toolkit::ImageView mActorForHorz;
101   FrameBufferImage   mBlurredImage;
102
103   // To blend the blurred image and input image according to the blur strength
104   RenderTask         mRenderTaskForBlending;
105   Toolkit::ImageView mActorForBlending;
106   Actor              mRootActorForBlending;
107   Property::Index    mBlurStrengthPropertyIndex;
108
109 }; // class BlurTwoPassFilter
110
111 } // namespace Internal
112
113 } // namespace Toolkit
114
115 } // namespace Dali
116
117 #endif // __DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H__
118