Merge "Ensured text mesh is centered in text actor." into tizen
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / renderable-actor-impl.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/actors/renderable-actor-impl.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/internal/event/actor-attachments/renderable-attachment-impl.h>
24
25 namespace // unnamed namespace
26 {
27
28 using namespace Dali;
29
30 /*
31  * This may look like a no-op but maintains TypeRegistry chain of classes.
32  * ie if a child actor declares its base as RenderableActor, RenderableActor must exist
33  * in TypeRegistry otherwise it doesnt know that child is related to Actor.
34  */
35 BaseHandle Create()
36 {
37   return BaseHandle();
38 }
39
40 TypeRegistration mType( typeid(Dali::RenderableActor), typeid(Dali::Actor), Create );
41
42 } // unnamed namespace
43
44 namespace Dali
45 {
46
47 namespace Internal
48 {
49
50 void RenderableActor::SetSortModifier(float modifier)
51 {
52   GetRenderableAttachment().SetSortModifier(modifier);
53 }
54
55 float RenderableActor::GetSortModifier() const
56 {
57   return GetRenderableAttachment().GetSortModifier();
58 }
59
60 void RenderableActor::SetCullFace(CullFaceMode mode)
61 {
62   GetRenderableAttachment().SetCullFace( mode );
63 }
64
65 CullFaceMode RenderableActor::GetCullFace() const
66 {
67   return GetRenderableAttachment().GetCullFace();
68 }
69
70 void RenderableActor::SetBlendMode( BlendingMode::Type mode )
71 {
72   GetRenderableAttachment().SetBlendMode( mode );
73 }
74
75 BlendingMode::Type RenderableActor::GetBlendMode() const
76 {
77   return GetRenderableAttachment().GetBlendMode();
78 }
79
80 void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba,   BlendingFactor::Type destFactorRgba )
81 {
82   GetRenderableAttachment().SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
83 }
84
85 void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
86                                     BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha )
87 {
88   GetRenderableAttachment().SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
89 }
90
91 void RenderableActor::GetBlendFunc( BlendingFactor::Type& srcFactorRgb,   BlendingFactor::Type& destFactorRgb,
92                                     BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const
93 {
94   GetRenderableAttachment().GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
95 }
96
97 void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgba )
98 {
99   GetRenderableAttachment().SetBlendEquation( equationRgba, equationRgba );
100 }
101
102 void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha )
103 {
104   GetRenderableAttachment().SetBlendEquation( equationRgb, equationAlpha );
105 }
106
107 void RenderableActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const
108 {
109   GetRenderableAttachment().GetBlendEquation( equationRgb, equationAlpha );
110 }
111
112 void RenderableActor::SetBlendColor( const Vector4& color )
113 {
114   GetRenderableAttachment().SetBlendColor( color );
115 }
116
117 const Vector4& RenderableActor::GetBlendColor() const
118 {
119   return GetRenderableAttachment().GetBlendColor();
120 }
121
122 void RenderableActor::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter )
123 {
124   GetRenderableAttachment().SetFilterMode( minFilter, magFilter );
125 }
126
127 void RenderableActor::GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const
128 {
129   return GetRenderableAttachment().GetFilterMode( minFilter, magFilter );
130 }
131
132 RenderableActor::RenderableActor()
133 : Actor( Actor::RENDERABLE )
134 {
135 }
136
137 RenderableActor::~RenderableActor()
138 {
139 }
140
141 } // namespace Internal
142
143 } // namespace Dali