[Tizen] Add temporaty log to node
[platform/core/uifw/dali-core.git] / dali / internal / common / blending-options.h
1 #ifndef DALI_BLENDING_OPTIONS_H
2 #define DALI_BLENDING_OPTIONS_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 // INTERNAL INCLUDES
22 #include <dali/devel-api/rendering/renderer-devel.h>
23 #include <dali/internal/common/owner-pointer.h>
24 #include <dali/public-api/math/vector4.h>
25 #include <dali/public-api/rendering/renderer.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 // This is an optimization to avoid storing 6 separate blending values
32 struct BlendingOptions
33 {
34   /**
35    * Create some default blending options.
36    */
37   BlendingOptions();
38
39   /**
40    * Non-virtual destructor.
41    */
42   ~BlendingOptions();
43
44   /**
45    * Set the blending options.
46    * @param[in] A bitmask of blending options.
47    */
48   void SetBitmask(unsigned int bitmask);
49
50   /**
51    * Retrieve the blending options as a bitmask.
52    * @return A bitmask of blending options.
53    */
54   unsigned int GetBitmask() const;
55
56   /**
57    * @copydoc Dali::RenderableActor::SetBlendFunc()
58    */
59   void SetBlendFunc(BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb, BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha);
60
61   /**
62    * @copydoc Dali::RenderableActor::GetBlendFunc()
63    */
64   BlendFactor::Type GetBlendSrcFactorRgb() const;
65
66   /**
67    * @copydoc Dali::RenderableActor::GetBlendFunc()
68    */
69   BlendFactor::Type GetBlendDestFactorRgb() const;
70
71   /**
72    * @copydoc Dali::RenderableActor::GetBlendFunc()
73    */
74   BlendFactor::Type GetBlendSrcFactorAlpha() const;
75
76   /**
77    * @copydoc Dali::RenderableActor::GetBlendFunc()
78    */
79   BlendFactor::Type GetBlendDestFactorAlpha() const;
80
81   /**
82    * @copydoc Dali::RenderableActor::SetBlendEquation()
83    */
84   void SetBlendEquation(DevelBlendEquation::Type equationRgb, DevelBlendEquation::Type equationAlpha);
85
86   /**
87    * @copydoc Dali::RenderableActor::GetBlendEquation()
88    */
89   DevelBlendEquation::Type GetBlendEquationRgb() const;
90
91   /**
92    * @copydoc Dali::RenderableActor::GetBlendEquation()
93    */
94   DevelBlendEquation::Type GetBlendEquationAlpha() const;
95
96   /**
97    * Set the blend color.
98    * @param[in] color The blend color.
99    * @return True if the blend color changed, otherwise it was already the same color.
100    */
101   void SetBlendColor(const Vector4& color);
102
103   /**
104    * Query the blend color.
105    * The blend color, or NULL if no blend color was set.
106    */
107   const Vector4* GetBlendColor() const;
108
109   /**
110    * Query whether current blend equation is advanced option.
111    * @return True if current blend equation is advanced.
112    */
113   bool IsAdvancedBlendEquationApplied();
114
115   /**
116    * Query whether input bit mask include advanced blend equation.
117    * @return True if the bit mask include advanced blend equation.
118    */
119   static bool IsAdvancedBlendEquationIncluded(unsigned int bitmask);
120
121   /**
122    * Query whether input blend equation is advanced option.
123    * @return True if input blend equation is advanced.
124    */
125   static bool IsAdvancedBlendEquation(DevelBlendEquation::Type equation);
126
127 private:
128   // Undefined copy constructor.
129   BlendingOptions(const BlendingOptions& typePath);
130
131   // Undefined copy constructor.
132   BlendingOptions& operator=(const BlendingOptions& rhs);
133
134 private:
135   unsigned int mBitmask; ///< A bitmask of blending options
136
137   OwnerPointer<Vector4> mBlendColor; ///< A heap-allocated color (owned)
138 };
139
140 } // namespace Internal
141
142 } // namespace Dali
143
144 #endif // DALI_BLENDING_OPTIONS_H