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