[dali_1.4.20] Merge branch 'devel/master'
[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 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
25 // INTERNAL INCLUDES
26 #include "image-filter.h"
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 namespace Internal
35 {
36
37 /**
38  * A spread/thicken filter. Expands an image into transparent areas.
39  */
40 class SpreadFilter : public ImageFilter
41 {
42 public:
43   /**
44    * Default constructor
45    */
46   SpreadFilter();
47
48   /**
49    * Destructor
50    */
51   virtual ~SpreadFilter();
52
53   /**
54    * Set the amount of spread in pixels.
55    * @param[in] spread The amount of spread
56    */
57   void SetSpread( float spread );
58
59 public: // From ImageFilter
60   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Enable
61   virtual void Enable();
62
63   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Disable
64   virtual void Disable();
65
66   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Refresh
67   virtual void Refresh();
68
69   /// @copydoc Dali::Toolkit::Internal::ImageFilter::SetSize
70   virtual void SetSize( const Vector2& size );
71
72 private:
73
74   /**
75    * Setup render tasks for blur
76    */
77   void CreateRenderTasks();
78
79 private:
80   SpreadFilter( const SpreadFilter& );
81   SpreadFilter& operator=( const SpreadFilter& );
82
83 private: // Attributes
84
85   // To perform horizontal spread from mInputImage to mImageForHorz
86   RenderTask         mRenderTaskForHorz;
87   Toolkit::ImageView mActorForInput;
88   FrameBufferImage   mImageForHorz;
89
90   // To perform vertical spread from mImageForHorz to mOutputImage
91   RenderTask         mRenderTaskForVert;
92   Toolkit::ImageView mActorForHorz;
93
94   int                mSpread;
95 }; // class SpreadFilter
96
97 } // namespace Internal
98
99 } // namespace Toolkit
100
101 } // namespace Dali
102
103 #endif // __DALI_TOOLKIT_INTERNAL_SPREAD_FILTER_H__
104