a4c02b217f6be7ad530229b1cfa9d19f1a0b0b51
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / filters / spread-filter.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_SPREAD_FILTER_H__
2 #define __DALI_TOOLKIT_INTERNAL_SPREAD_FILTER_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
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
10 //
11 //     http://floralicense.org/license/
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 // EXTERNAL INCLUDES
21
22 // INTERNAL INCLUDES
23 #include <dali/dali.h>
24 #include "image-filter.h"
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 namespace Internal
33 {
34
35 /**
36  * A spread/thicken filter. Expands an image into transparent areas.
37  */
38 class SpreadFilter : public ImageFilter
39 {
40 public:
41   /**
42    * Default constructor
43    */
44   SpreadFilter();
45
46   /**
47    * Destructor
48    */
49   virtual ~SpreadFilter();
50
51   /**
52    * Set the amount of spread in pixels.
53    * @param[in] spread The amount of spread
54    */
55   void SetSpread( float spread );
56
57 public: // From ImageFilter
58   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Enable
59   virtual void Enable();
60
61   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Disable
62   virtual void Disable();
63
64   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Refresh
65   virtual void Refresh();
66
67 private:
68   /**
69    * Setup position and parameters for camera
70    */
71   void SetupCamera();
72
73   /**
74    * Setup render tasks for blur
75    */
76   void CreateRenderTasks();
77
78 private:
79   SpreadFilter( const SpreadFilter& );
80   SpreadFilter& operator=( const SpreadFilter& );
81
82 private: // Attributes
83   int              mSpread;
84   CameraActor      mCameraActor;
85
86   // To perform horizontal spread from mInputImage to mImageForHorz
87   RenderTask       mRenderTaskForHorz;
88   ImageActor       mActorForInput;
89   FrameBufferImage mImageForHorz;
90   ShaderEffect     mShaderForHorz;
91
92   // To perform vertical spread from mImageForHorz to mOutputImage
93   RenderTask       mRenderTaskForVert;
94   ImageActor       mActorForHorz;
95   ShaderEffect     mShaderForVert;
96 }; // class SpreadFilter
97
98 } // namespace Internal
99
100 } // namespace Toolkit
101
102 } // namespace Dali
103
104 #endif // __DALI_TOOLKIT_INTERNAL_SPREAD_FILTER_H__
105