Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / renderer / engine-model / FUiEffects_RendererEngineModelAlphaBlendProperty.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FUiEffects_RendererEngineModelAlphaBlendProperty.cpp
20  * @brief               This file contains implementation of AlphaBlendProperty class
21  *
22  */
23
24 #include <renderer/engine-model/FUiEffects_RendererEngineModelPropertyVisitor.h>
25 #include <renderer/engine-model/FUiEffects_RendererEngineModelAlphaBlendProperty.h>
26
27
28 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer { namespace EngineModel
29 {
30
31 AlphaBlendProperty::AlphaBlendProperty(void):
32         __source(BlendFactor::SRC_ALPHA),
33         __destination(BlendFactor::ONE_MINUS_SRC_ALPHA),
34         __isEnabled(true)
35 {
36
37 }
38
39 AlphaBlendProperty::~AlphaBlendProperty(void)
40 {
41         if (__cache)
42         {
43                 __cache->Die();
44         }
45 }
46
47 void
48 AlphaBlendProperty::Visit(PropertyVisitor& v)
49 {
50         v.OnAlphaBlendProperty(*this);
51         return;
52 }
53
54 bool
55 AlphaBlendProperty::IsEnable(void)
56 {
57         return __isEnabled;
58 }
59
60 AlphaBlendProperty::BlendFactor::Value
61 AlphaBlendProperty::GetSourceFactor(void)
62 {
63         return __source;
64 }
65
66 AlphaBlendProperty::BlendFactor::Value
67 AlphaBlendProperty::GetDestinationFactor(void)
68 {
69         return __destination;
70 }
71
72 void
73 AlphaBlendProperty::SetFactors(BlendFactor::Value source, BlendFactor::Value destination)
74 {
75         __source = source;
76         __destination = destination;
77         TouchCache();
78         return;
79 }
80 void
81 AlphaBlendProperty::Enable(bool isEnabled)
82 {
83         __isEnabled = isEnabled;
84         TouchCache();
85         return;
86 }
87
88 CachePtr
89 AlphaBlendProperty::GetCache(void)
90 {
91         return __cache;
92 }
93
94 void
95 AlphaBlendProperty::SetCache(CachePtr cache)
96 {
97         if (__cache)
98         {
99                 __cache->Die();
100         }
101         __cache = cache;
102         return;
103 }
104
105 void
106 AlphaBlendProperty::TouchCache(void)
107 {
108         if (__cache)
109         {
110                 __cache->Invalidate();
111         }
112         return;
113 }
114
115 }}}}} //Tizen::Ui::Effects::_Renderer::EngineModel