License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / renderable-actor-impl.h
1 #ifndef __DALI_INTERNAL_RENDERABLE_ACTOR_H__
2 #define __DALI_INTERNAL_RENDERABLE_ACTOR_H__
3
4 /*
5  * Copyright (c) 2014 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/public-api/actors/renderable-actor.h>
23 #include <dali/public-api/common/dali-common.h>
24 #include <dali/internal/event/actors/actor-impl.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class RenderableAttachment;
33
34 /**
35  * An abstract base class for renderable actors
36  */
37 class RenderableActor : public Actor
38 {
39 public:
40
41   /**
42    * @copydoc Dali::RenderableActor::SetSortModifier()
43    */
44   void SetSortModifier(float modifier);
45
46   /**
47    * @copydoc Dali::RenderableActor::GetSortModifier()
48    */
49   float GetSortModifier() const;
50
51   /**
52    * @copydoc Dali::RenderableActor::SetCullFace()
53    */
54   void SetCullFace(CullFaceMode mode);
55
56   /**
57    * @copydoc Dali::RenderableActor::GetCullFace()
58    */
59   CullFaceMode GetCullFace() const;
60
61   /**
62    * @copydoc Dali::RenderableActor::SetBlendMode()
63    */
64   void SetBlendMode( BlendingMode::Type mode );
65
66   /**
67    * @copydoc Dali::RenderableActor::GetBlendMode()
68    */
69   BlendingMode::Type GetBlendMode() const;
70
71   /**
72    * @copydoc Dali::RenderableActor::SetBlendFunc()
73    */
74   void SetBlendFunc( BlendingFactor::Type srcFactorRgba,   BlendingFactor::Type destFactorRgba );
75
76   /**
77    * @copydoc Dali::RenderableActor::SetBlendFunc()
78    */
79   void SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
80                      BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
81
82   /**
83    * @copydoc Dali::RenderableActor::GetBlendFunc()
84    */
85   void GetBlendFunc( BlendingFactor::Type& srcFactorRgb,   BlendingFactor::Type& destFactorRgb,
86                      BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
87
88   /**
89    * @copydoc Dali::RenderableActor::SetBlendEquation()
90    */
91   void SetBlendEquation( BlendingEquation::Type equationRgba );
92
93   /**
94    * @copydoc Dali::RenderableActor::SetBlendEquation()
95    */
96   void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
97
98   /**
99    * @copydoc Dali::RenderableActor::GetBlendEquation()
100    */
101   void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
102
103   /**
104    * @copydoc Dali::RenderableActor::SetBlendColor()
105    */
106   void SetBlendColor( const Vector4& color );
107
108   /**
109    * @copydoc Dali::RenderableActor::GetBlendColor()
110    */
111   const Vector4& GetBlendColor() const;
112
113 protected:
114
115   /**
116    * Protected constructor; only derived classes are instantiatable.
117    */
118   RenderableActor();
119
120   /**
121    * A reference counted object may only be deleted by calling Unreference()
122    */
123   virtual ~RenderableActor();
124
125 private:
126
127   /**
128    * @return a reference to the renderable attachment
129    */
130   virtual RenderableAttachment& GetRenderableAttachment() const = 0;
131
132   // Undefined
133   RenderableActor(const RenderableActor&);
134   // Undefined
135   RenderableActor& operator=(const RenderableActor& rhs);
136 };
137
138 } // namespace Internal
139
140 // Helpers for public-api forwarding methods
141
142 inline Internal::RenderableActor& GetImplementation(Dali::RenderableActor& renderable)
143 {
144   DALI_ASSERT_ALWAYS( renderable && "RenderableActor handle is empty" );
145
146   BaseObject& handle = renderable.GetBaseObject();
147
148   return static_cast<Internal::RenderableActor&>(handle);
149 }
150
151 inline const Internal::RenderableActor& GetImplementation(const Dali::RenderableActor& renderable)
152 {
153   DALI_ASSERT_ALWAYS(renderable && "RenderableActor handle is empty" );
154
155   const BaseObject& handle = renderable.GetBaseObject();
156
157   return static_cast<const Internal::RenderableActor&>(handle);
158 }
159
160 } // namespace Dali
161
162 #endif // __DALI_INTERNAL_RENDERABLE_ACTOR_H__