Revert "License conversion from Flora to Apache 2.0"
[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) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali/public-api/actors/blending.h>
22 #include <dali/public-api/math/vector4.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 // This is an optimization to avoid storing 6 separate blending values
31 struct BlendingOptions
32 {
33   /**
34    * Create some default blending options.
35    */
36   BlendingOptions();
37
38   /**
39    * Non-virtual destructor.
40    */
41   ~BlendingOptions();
42
43   /**
44    * Set the blending options.
45    * @param[in] A bitmask of blending options.
46    */
47   void SetBitmask( unsigned int bitmask );
48
49   /**
50    * Retrieve the blending options as a bitmask.
51    * @return A bitmask of blending options.
52    */
53   unsigned int GetBitmask() const;
54
55   /**
56    * @copydoc Dali::RenderableActor::SetBlendFunc()
57    */
58   void SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
59                      BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
60
61   /**
62    * @copydoc Dali::RenderableActor::GetBlendFunc()
63    */
64   BlendingFactor::Type GetBlendSrcFactorRgb() const;
65
66   /**
67    * @copydoc Dali::RenderableActor::GetBlendFunc()
68    */
69   BlendingFactor::Type GetBlendDestFactorRgb() const;
70
71   /**
72    * @copydoc Dali::RenderableActor::GetBlendFunc()
73    */
74   BlendingFactor::Type GetBlendSrcFactorAlpha() const;
75
76   /**
77    * @copydoc Dali::RenderableActor::GetBlendFunc()
78    */
79   BlendingFactor::Type GetBlendDestFactorAlpha() const;
80
81   /**
82    * @copydoc Dali::RenderableActor::SetBlendEquation()
83    */
84   void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
85
86   /**
87    * @copydoc Dali::RenderableActor::GetBlendEquation()
88    */
89   BlendingEquation::Type GetBlendEquationRgb() const;
90
91   /**
92    * @copydoc Dali::RenderableActor::GetBlendEquation()
93    */
94   BlendingEquation::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   bool 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 private:
110
111   // Undefined copy constructor.
112   BlendingOptions(const BlendingOptions& typePath);
113
114   // Undefined copy constructor.
115   BlendingOptions& operator=(const BlendingOptions& rhs);
116
117 private:
118
119   unsigned int mBitmask; ///< A bitmask of blending options
120
121   Vector4* mOptionalColor; ///< A heap-allocated color (owned)
122 };
123
124 } // namespace Internal
125
126 } // namespace Dali
127
128 #endif // __DALI_BLENDING_OPTIONS_H__