Merge "Follow the include-order coding conventions" into tizen
[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 #include <dali/internal/event/effects/shader-declarations.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 class RenderableAttachment;
34
35 /**
36  * An abstract base class for renderable actors
37  */
38 class RenderableActor : public Actor
39 {
40 public:
41
42   /**
43    * @copydoc Dali::RenderableActor::SetSortModifier()
44    */
45   void SetSortModifier(float modifier);
46
47   /**
48    * @copydoc Dali::RenderableActor::GetSortModifier()
49    */
50   float GetSortModifier() const;
51
52   /**
53    * @copydoc Dali::RenderableActor::SetCullFace()
54    */
55   void SetCullFace(CullFaceMode mode);
56
57   /**
58    * @copydoc Dali::RenderableActor::GetCullFace()
59    */
60   CullFaceMode GetCullFace() const;
61
62   /**
63    * @copydoc Dali::RenderableActor::SetBlendMode()
64    */
65   void SetBlendMode( BlendingMode::Type mode );
66
67   /**
68    * @copydoc Dali::RenderableActor::GetBlendMode()
69    */
70   BlendingMode::Type GetBlendMode() const;
71
72   /**
73    * @copydoc Dali::RenderableActor::SetBlendFunc()
74    */
75   void SetBlendFunc( BlendingFactor::Type srcFactorRgba,   BlendingFactor::Type destFactorRgba );
76
77   /**
78    * @copydoc Dali::RenderableActor::SetBlendFunc()
79    */
80   void SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
81                      BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
82
83   /**
84    * @copydoc Dali::RenderableActor::GetBlendFunc()
85    */
86   void GetBlendFunc( BlendingFactor::Type& srcFactorRgb,   BlendingFactor::Type& destFactorRgb,
87                      BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
88
89   /**
90    * @copydoc Dali::RenderableActor::SetBlendEquation()
91    */
92   void SetBlendEquation( BlendingEquation::Type equationRgba );
93
94   /**
95    * @copydoc Dali::RenderableActor::SetBlendEquation()
96    */
97   void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
98
99   /**
100    * @copydoc Dali::RenderableActor::GetBlendEquation()
101    */
102   void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
103
104   /**
105    * @copydoc Dali::RenderableActor::SetBlendColor()
106    */
107   void SetBlendColor( const Vector4& color );
108
109   /**
110    * @copydoc Dali::RenderableActor::GetBlendColor()
111    */
112   const Vector4& GetBlendColor() const;
113
114   /**
115    * @copydoc Dali::RenderableActor::SetFilterMode()
116    */
117   void SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter );
118
119   /**
120    * @copydoc Dali::RenderableActor::GetFilterMode()
121    */
122   void GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const;
123
124 protected:
125
126   /**
127    * Protected constructor; only derived classes are instantiatable.
128    */
129   RenderableActor();
130
131   /**
132    * A reference counted object may only be deleted by calling Unreference()
133    */
134   virtual ~RenderableActor();
135
136 public: // from Actor, in future not virtual. Accessible also from RenderableActor
137
138   /**
139    * @copydoc Actor::SetShaderEffect
140    */
141   virtual void SetShaderEffect(ShaderEffect& effect);
142
143   /**
144    * @copydoc Actor::GetShaderEffect
145    */
146   virtual ShaderEffectPtr GetShaderEffect() const;
147
148   /**
149    * @copydoc Actor::RemoveShaderEffect
150    */
151   virtual void RemoveShaderEffect();
152
153 private:
154
155   /**
156    * @return a reference to the renderable attachment
157    */
158   virtual RenderableAttachment& GetRenderableAttachment() const = 0;
159
160   // Undefined
161   RenderableActor(const RenderableActor&);
162   // Undefined
163   RenderableActor& operator=(const RenderableActor& rhs);
164
165 };
166
167 } // namespace Internal
168
169 // Helpers for public-api forwarding methods
170
171 inline Internal::RenderableActor& GetImplementation(Dali::RenderableActor& renderable)
172 {
173   DALI_ASSERT_ALWAYS( renderable && "RenderableActor handle is empty" );
174
175   BaseObject& handle = renderable.GetBaseObject();
176
177   return static_cast<Internal::RenderableActor&>(handle);
178 }
179
180 inline const Internal::RenderableActor& GetImplementation(const Dali::RenderableActor& renderable)
181 {
182   DALI_ASSERT_ALWAYS(renderable && "RenderableActor handle is empty" );
183
184   const BaseObject& handle = renderable.GetBaseObject();
185
186   return static_cast<const Internal::RenderableActor&>(handle);
187 }
188
189 } // namespace Dali
190
191 #endif // __DALI_INTERNAL_RENDERABLE_ACTOR_H__