License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-toolkit.git] / optional / 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
23 // INTERNAL INCLUDES
24 #include <dali/dali.h>
25 #include "image-filter.h"
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35
36 /**
37  * A spread/thicken filter. Expands an image into transparent areas.
38  */
39 class SpreadFilter : public ImageFilter
40 {
41 public:
42   /**
43    * Default constructor
44    */
45   SpreadFilter();
46
47   /**
48    * Destructor
49    */
50   virtual ~SpreadFilter();
51
52   /**
53    * Set the amount of spread in pixels.
54    * @param[in] spread The amount of spread
55    */
56   void SetSpread( float spread );
57
58 public: // From ImageFilter
59   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Enable
60   virtual void Enable();
61
62   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Disable
63   virtual void Disable();
64
65   /// @copydoc Dali::Toolkit::Internal::ImageFilter::Refresh
66   virtual void Refresh();
67
68 private:
69   /**
70    * Setup position and parameters for camera
71    */
72   void SetupCamera();
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   int              mSpread;
85   CameraActor      mCameraActor;
86
87   // To perform horizontal spread from mInputImage to mImageForHorz
88   RenderTask       mRenderTaskForHorz;
89   ImageActor       mActorForInput;
90   FrameBufferImage mImageForHorz;
91   ShaderEffect     mShaderForHorz;
92
93   // To perform vertical spread from mImageForHorz to mOutputImage
94   RenderTask       mRenderTaskForVert;
95   ImageActor       mActorForHorz;
96   ShaderEffect     mShaderForVert;
97 }; // class SpreadFilter
98
99 } // namespace Internal
100
101 } // namespace Toolkit
102
103 } // namespace Dali
104
105 #endif // __DALI_TOOLKIT_INTERNAL_SPREAD_FILTER_H__
106