1 #ifndef DALI_BLENDING_OPTIONS_H
2 #define DALI_BLENDING_OPTIONS_H
5 * Copyright (c) 2020 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/public-api/rendering/renderer.h>
23 #include <dali/devel-api/rendering/renderer-devel.h>
24 #include <dali/public-api/math/vector4.h>
25 #include <dali/internal/common/owner-pointer.h>
33 // This is an optimization to avoid storing 6 separate blending values
34 struct BlendingOptions
37 * Create some default blending options.
42 * Non-virtual destructor.
47 * Set the blending options.
48 * @param[in] A bitmask of blending options.
50 void SetBitmask( unsigned int bitmask );
53 * Retrieve the blending options as a bitmask.
54 * @return A bitmask of blending options.
56 unsigned int GetBitmask() const;
59 * @copydoc Dali::RenderableActor::SetBlendFunc()
61 void SetBlendFunc( BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb,
62 BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha );
65 * @copydoc Dali::RenderableActor::GetBlendFunc()
67 BlendFactor::Type GetBlendSrcFactorRgb() const;
70 * @copydoc Dali::RenderableActor::GetBlendFunc()
72 BlendFactor::Type GetBlendDestFactorRgb() const;
75 * @copydoc Dali::RenderableActor::GetBlendFunc()
77 BlendFactor::Type GetBlendSrcFactorAlpha() const;
80 * @copydoc Dali::RenderableActor::GetBlendFunc()
82 BlendFactor::Type GetBlendDestFactorAlpha() const;
85 * @copydoc Dali::RenderableActor::SetBlendEquation()
87 void SetBlendEquation( DevelBlendEquation::Type equationRgb, DevelBlendEquation::Type equationAlpha );
90 * @copydoc Dali::RenderableActor::GetBlendEquation()
92 DevelBlendEquation::Type GetBlendEquationRgb() const;
95 * @copydoc Dali::RenderableActor::GetBlendEquation()
97 DevelBlendEquation::Type GetBlendEquationAlpha() const;
100 * Set the blend color.
101 * @param[in] color The blend color.
102 * @return True if the blend color changed, otherwise it was already the same color.
104 void SetBlendColor( const Vector4& color );
107 * Query the blend color.
108 * The blend color, or NULL if no blend color was set.
110 const Vector4* GetBlendColor() const;
113 * Query whether current blend equation is advanced option.
114 * @return True if current blend equation is advanced.
116 bool IsAdvancedBlendEquationApplied();
119 * Query whether input blend equation is advanced option.
120 * @return True if input blend equation is advanced.
122 static bool IsAdvancedBlendEquation( DevelBlendEquation::Type equation );
126 // Undefined copy constructor.
127 BlendingOptions(const BlendingOptions& typePath);
129 // Undefined copy constructor.
130 BlendingOptions& operator=(const BlendingOptions& rhs);
134 unsigned int mBitmask; ///< A bitmask of blending options
136 OwnerPointer< Vector4> mBlendColor; ///< A heap-allocated color (owned)
140 } // namespace Internal
144 #endif // DALI_BLENDING_OPTIONS_H