Merge "Change RegisterGlCallback function name of GlView" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / color / color-visual.h
1 #ifndef DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
2 #define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_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/common/intrusive-ptr.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
26
27 namespace Dali
28 {
29 namespace Toolkit
30 {
31 namespace Internal
32 {
33 class ColorVisual;
34 typedef IntrusivePtr<ColorVisual> ColorVisualPtr;
35
36 /**
37  * The visual which renders a solid color to the control's quad
38  *
39  * The following properties are required for create a ColorRender
40  *
41  * | %Property Name  | Type        |
42  * |-----------------|-------------|
43  * | mixColor        | VECTOR4     |
44  */
45 class ColorVisual : public Visual::Base
46 {
47 public:
48   /**
49    * @brief Create a new color visual.
50    *
51    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
52    * @param[in] properties A Property::Map containing settings for this visual
53    * @return A smart-pointer to the newly allocated visual.
54    */
55   static ColorVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
56
57 public: // from Visual
58   /**
59    * @copydoc Visual::Base::CreatePropertyMap
60    */
61   void DoCreatePropertyMap(Property::Map& map) const override;
62
63   /**
64    * @copydoc Visual::Base::CreateInstancePropertyMap
65    */
66   void DoCreateInstancePropertyMap(Property::Map& map) const override;
67
68 protected:
69   /**
70    * @brief Constructor.
71    *
72    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
73    */
74   ColorVisual(VisualFactoryCache& factoryCache);
75
76   /**
77    * @brief A reference counted object may only be deleted by calling Unreference().
78    */
79   virtual ~ColorVisual();
80
81   /**
82    * @copydoc Visual::Base::OnInitialize
83    */
84   void OnInitialize() override;
85
86   /**
87    * @copydoc Visual::Base::DoSetProperties
88    */
89   void DoSetProperties(const Property::Map& propertyMap) override;
90
91   /**
92    * @copydoc Visual::Base::DoSetOnScene
93    */
94   void DoSetOnScene(Actor& actor) override;
95
96   /**
97    * @copydoc Visual::Base::DoSetOffScene
98    */
99   void DoSetOffScene(Actor& actor) override;
100
101   /**
102    * @copydoc Visual::Base::OnSetTransform
103    */
104   void OnSetTransform() override;
105
106   /**
107    * @copydoc Visual::Base::UpdateShader
108    */
109   void UpdateShader() override;
110
111   /**
112    * @copydoc Visual::Base::GenerateShader
113    */
114   Shader GenerateShader() const override;
115
116   /**
117    * @copydoc Visual::Base::OnGetPropertyObject
118    */
119   Dali::Property OnGetPropertyObject(Dali::Property::Key key) override;
120
121 private:
122   // Undefined
123   ColorVisual(const ColorVisual& colorRenderer);
124
125   // Undefined
126   ColorVisual& operator=(const ColorVisual& colorRenderer);
127
128 private:
129   float           mBlurRadius;                ///< The blur radius
130   Property::Index mBlurRadiusIndex;           ///< The blur radius property index
131   bool            mAlwaysUsingBlurRadius : 1; ///< Whether we need the blur radius in shader always.
132 };
133
134 } // namespace Internal
135
136 } // namespace Toolkit
137
138 } // namespace Dali
139
140 #endif /* DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H */