1 #ifndef DALI_BLENDING_OPTIONS_H
2 #define DALI_BLENDING_OPTIONS_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
31 // This is an optimization to avoid storing 6 separate blending values
32 struct BlendingOptions
35 * Create some default blending options.
40 * Non-virtual destructor.
45 * Set the blending options.
46 * @param[in] A bitmask of blending options.
48 void SetBitmask(unsigned int bitmask);
51 * Retrieve the blending options as a bitmask.
52 * @return A bitmask of blending options.
54 unsigned int GetBitmask() const;
57 * @copydoc Dali::RenderableActor::SetBlendFunc()
59 void SetBlendFunc(BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb, BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha);
62 * @copydoc Dali::RenderableActor::GetBlendFunc()
64 BlendFactor::Type GetBlendSrcFactorRgb() const;
67 * @copydoc Dali::RenderableActor::GetBlendFunc()
69 BlendFactor::Type GetBlendDestFactorRgb() const;
72 * @copydoc Dali::RenderableActor::GetBlendFunc()
74 BlendFactor::Type GetBlendSrcFactorAlpha() const;
77 * @copydoc Dali::RenderableActor::GetBlendFunc()
79 BlendFactor::Type GetBlendDestFactorAlpha() const;
82 * @copydoc Dali::RenderableActor::SetBlendEquation()
84 void SetBlendEquation(DevelBlendEquation::Type equationRgb, DevelBlendEquation::Type equationAlpha);
87 * @copydoc Dali::RenderableActor::GetBlendEquation()
89 DevelBlendEquation::Type GetBlendEquationRgb() const;
92 * @copydoc Dali::RenderableActor::GetBlendEquation()
94 DevelBlendEquation::Type GetBlendEquationAlpha() const;
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.
101 void SetBlendColor(const Vector4& color);
104 * Query the blend color.
105 * The blend color, or NULL if no blend color was set.
107 const Vector4* GetBlendColor() const;
110 * Query whether current blend equation is advanced option.
111 * @return True if current blend equation is advanced.
113 bool IsAdvancedBlendEquationApplied();
116 * Query whether input bit mask include advanced blend equation.
117 * @return True if the bit mask include advanced blend equation.
119 static bool IsAdvancedBlendEquationIncluded(unsigned int bitmask);
122 * Query whether input blend equation is advanced option.
123 * @return True if input blend equation is advanced.
125 static bool IsAdvancedBlendEquation(DevelBlendEquation::Type equation);
128 // Undefined copy constructor.
129 BlendingOptions(const BlendingOptions& typePath);
131 // Undefined copy constructor.
132 BlendingOptions& operator=(const BlendingOptions& rhs);
135 unsigned int mBitmask; ///< A bitmask of blending options
137 OwnerPointer<Vector4> mBlendColor; ///< A heap-allocated color (owned)
140 } // namespace Internal
144 #endif // DALI_BLENDING_OPTIONS_H