(Vector) Support dynamic properties
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-base-impl.cpp
1 /*
2  * Copyright (c) 2022 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 "visual-base-impl.h"
20
21 // EXTERNAL HEADER
22 #include <dali-toolkit/public-api/dali-toolkit-common.h>
23 #include <dali/devel-api/rendering/renderer-devel.h>
24 #include <dali/devel-api/scripting/enum-helper.h>
25 #include <dali/integration-api/debug.h>
26 #include <dali/public-api/rendering/decorated-visual-renderer.h>
27 #include <dali/public-api/rendering/visual-renderer.h>
28
29 //INTERNAL HEARDER
30 #include <dali-toolkit/devel-api/visuals/color-visual-properties-devel.h>
31 #include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
32 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
33 #include <dali-toolkit/internal/helpers/property-helper.h>
34 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
35 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
36 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
37 #include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
38 #include <dali-toolkit/public-api/visuals/visual-properties.h>
39
40 namespace
41 {
42 #if defined(DEBUG_ENABLED)
43 Debug::Filter* gVisualBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_VISUAL_BASE");
44 #endif
45
46 // visual string constants contains OFFSET_SIZE_MODE instead
47 const char* const OFFSET_POLICY("offsetPolicy");
48 const char* const SIZE_POLICY("sizePolicy");
49
50 } // namespace
51
52 namespace Dali
53 {
54 namespace Toolkit
55 {
56 namespace Internal
57 {
58 namespace
59 {
60 DALI_ENUM_TO_STRING_TABLE_BEGIN(VISUAL_FITTING_MODE)
61   DALI_ENUM_TO_STRING_WITH_SCOPE(Visual::FittingMode, FIT_KEEP_ASPECT_RATIO)
62   DALI_ENUM_TO_STRING_WITH_SCOPE(Visual::FittingMode, FILL)
63   DALI_ENUM_TO_STRING_WITH_SCOPE(Visual::FittingMode, OVER_FIT_KEEP_ASPECT_RATIO)
64   DALI_ENUM_TO_STRING_WITH_SCOPE(Visual::FittingMode, CENTER)
65   DALI_ENUM_TO_STRING_WITH_SCOPE(Visual::FittingMode, FIT_WIDTH)
66   DALI_ENUM_TO_STRING_WITH_SCOPE(Visual::FittingMode, FIT_HEIGHT)
67 DALI_ENUM_TO_STRING_TABLE_END(VISUAL_FITTING_MODE)
68
69 /**
70  * @brief Check whether this visual type can use corner radius feature or not.
71  * @param type VisualType that want to checkup
72  * @return true if type can use corner radius feature.
73  */
74 static bool IsTypeAvailableForCornerRadius(Toolkit::Visual::Type type)
75 {
76   switch(static_cast<Toolkit::DevelVisual::Type>(type))
77   {
78     case Toolkit::Visual::Type::COLOR:
79     case Toolkit::Visual::Type::GRADIENT:
80     case Toolkit::Visual::Type::IMAGE:
81     case Toolkit::Visual::Type::SVG:
82     case Toolkit::Visual::Type::ANIMATED_IMAGE:
83     case Toolkit::DevelVisual::Type::ANIMATED_VECTOR_IMAGE:
84     {
85       return true;
86     }
87     default:
88     {
89       return false;
90     }
91   }
92 }
93
94 /**
95  * @brief Check whether this visual type can use borderline feature or not.
96  * @param type VisualType that want to checkup
97  * @return true if type can use borderline feature.
98  */
99 static bool IsTypeAvailableForBorderline(Toolkit::Visual::Type type)
100 {
101   switch(static_cast<Toolkit::DevelVisual::Type>(type))
102   {
103     case Toolkit::Visual::Type::COLOR:
104     case Toolkit::Visual::Type::GRADIENT:
105     case Toolkit::Visual::Type::IMAGE:
106     case Toolkit::Visual::Type::SVG:
107     case Toolkit::Visual::Type::ANIMATED_IMAGE:
108     case Toolkit::DevelVisual::Type::ANIMATED_VECTOR_IMAGE:
109     {
110       return true;
111     }
112     default:
113     {
114       return false;
115     }
116   }
117 }
118
119 } // namespace
120
121 Visual::Base::Base(VisualFactoryCache& factoryCache, FittingMode fittingMode, Toolkit::Visual::Type type)
122 : mImpl(new Impl(fittingMode, type)),
123   mFactoryCache(factoryCache)
124 {
125 }
126
127 Visual::Base::~Base()
128 {
129   delete mImpl;
130 }
131
132 void Visual::Base::Initialize()
133 {
134   // The Renderer should be created inside derived class here.
135   OnInitialize();
136
137   if(mImpl->mRenderer)
138   {
139     RegisterMixColor();
140     RegisterDecoration();
141
142     if(IsBorderlineRequired())
143     {
144       mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
145     }
146     else if(IsRoundedCornerRequired())
147     {
148       mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
149     }
150   }
151 }
152
153 void Visual::Base::SetCustomShader(const Property::Map& shaderMap)
154 {
155   if(mImpl->mCustomShader)
156   {
157     mImpl->mCustomShader->SetPropertyMap(shaderMap);
158   }
159   else
160   {
161     mImpl->mCustomShader = new Impl::CustomShader(shaderMap);
162   }
163
164   // Let derived class know
165   UpdateShader();
166 }
167
168 void Visual::Base::SetProperties(const Property::Map& propertyMap)
169 {
170   bool needUpdateShader = false;
171   for(size_t i = 0; i < propertyMap.Count(); ++i)
172   {
173     const KeyValuePair&    pair  = propertyMap.GetKeyValue(i);
174     const Property::Key&   key   = pair.first;
175     const Property::Value& value = pair.second;
176
177     Property::Key matchKey = key;
178     if(matchKey.type == Property::Key::STRING)
179     {
180       if(matchKey == CUSTOM_SHADER)
181       {
182         matchKey = Property::Key(Toolkit::Visual::Property::SHADER);
183       }
184       else if(matchKey == TRANSFORM)
185       {
186         matchKey = Property::Key(Toolkit::Visual::Property::TRANSFORM);
187       }
188       else if(matchKey == PREMULTIPLIED_ALPHA)
189       {
190         matchKey = Property::Key(Toolkit::Visual::Property::PREMULTIPLIED_ALPHA);
191       }
192       else if(matchKey == MIX_COLOR)
193       {
194         matchKey = Property::Key(Toolkit::Visual::Property::MIX_COLOR);
195       }
196       else if(matchKey == OPACITY)
197       {
198         matchKey = Property::Key(Toolkit::Visual::Property::OPACITY);
199       }
200       else if(matchKey == VISUAL_FITTING_MODE)
201       {
202         matchKey = Property::Key(Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE);
203       }
204       else if(matchKey == BORDERLINE_WIDTH)
205       {
206         matchKey = Property::Key(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH);
207       }
208       else if(matchKey == BORDERLINE_COLOR)
209       {
210         matchKey = Property::Key(Toolkit::DevelVisual::Property::BORDERLINE_COLOR);
211       }
212       else if(matchKey == BORDERLINE_OFFSET)
213       {
214         matchKey = Property::Key(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET);
215       }
216       else if(matchKey == CORNER_RADIUS)
217       {
218         matchKey = Property::Key(Toolkit::DevelVisual::Property::CORNER_RADIUS);
219       }
220       else if(matchKey == CORNER_RADIUS_POLICY)
221       {
222         matchKey = Property::Key(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY);
223       }
224     }
225
226     switch(matchKey.indexKey)
227     {
228       case Toolkit::Visual::Property::SHADER:
229       {
230         Property::Map shaderMap;
231         if(value.Get(shaderMap))
232         {
233           SetCustomShader(shaderMap);
234         }
235         break;
236       }
237
238       case Toolkit::Visual::Property::TRANSFORM:
239       {
240         Property::Map map;
241         if(value.Get(map))
242         {
243           mImpl->mTransform.SetPropertyMap(map);
244         }
245         break;
246       }
247
248       case Toolkit::Visual::Property::PREMULTIPLIED_ALPHA:
249       {
250         bool premultipliedAlpha = false;
251         if(value.Get(premultipliedAlpha))
252         {
253           EnablePreMultipliedAlpha(premultipliedAlpha);
254         }
255         break;
256       }
257
258       case Toolkit::Visual::Property::MIX_COLOR:
259       {
260         Vector4 mixColor;
261         if(value.Get(mixColor))
262         {
263           if(value.GetType() == Property::VECTOR4)
264           {
265             SetMixColor(mixColor);
266           }
267           else
268           {
269             Vector3 mixColor3(mixColor);
270             SetMixColor(mixColor3);
271           }
272         }
273         break;
274       }
275       case Toolkit::Visual::Property::OPACITY:
276       {
277         float opacity;
278         if(value.Get(opacity))
279         {
280           mImpl->mMixColor.a = opacity;
281           SetMixColor(mImpl->mMixColor);
282         }
283         break;
284       }
285       case Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE:
286       {
287         Scripting::GetEnumerationProperty<Visual::FittingMode>(
288           value, VISUAL_FITTING_MODE_TABLE, VISUAL_FITTING_MODE_TABLE_COUNT, mImpl->mFittingMode);
289         break;
290       }
291       case Toolkit::DevelVisual::Property::BORDERLINE_WIDTH:
292       {
293         float width;
294         if(value.Get(width))
295         {
296           mImpl->mBorderlineWidth = width;
297         }
298
299         if(DALI_UNLIKELY(mImpl->mRenderer && IsTypeAvailableForBorderline(mImpl->mType)))
300         {
301           // Unusual case. SetProperty called after OnInitialize().
302           // Assume that DoAction call UPDATE_PROPERTY.
303           DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
304           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
305
306           // Check whether we must update shader.
307           if(!mImpl->mAlwaysUsingBorderline && IsBorderlineRequired())
308           {
309             // Make Blend mode ON_WITHOUT_CULL for transparent mix color.
310             mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
311
312             // Change the shader must not be occured many times. we always have to use borderline feature.
313             mImpl->mAlwaysUsingBorderline = true;
314
315             // Change shader
316             if(!mImpl->mCustomShader)
317             {
318               needUpdateShader = true;
319             }
320           }
321         }
322         break;
323       }
324       case Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
325       {
326         Vector4 color;
327         if(value.Get(color))
328         {
329           mImpl->mBorderlineColor = color;
330         }
331
332         if(DALI_UNLIKELY(mImpl->mRenderer && IsTypeAvailableForBorderline(mImpl->mType)))
333         {
334           // Unusual case. SetProperty called after OnInitialize().
335           // Assume that DoAction call UPDATE_PROPERTY.
336           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
337         }
338         break;
339       }
340       case Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
341       {
342         float offset;
343         if(value.Get(offset))
344         {
345           mImpl->mBorderlineOffset = offset;
346         }
347
348         if(DALI_UNLIKELY(mImpl->mRenderer && IsTypeAvailableForBorderline(mImpl->mType)))
349         {
350           // Unusual case. SetProperty called after OnInitialize().
351           // Assume that DoAction call UPDATE_PROPERTY.
352           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
353         }
354         break;
355       }
356       case Toolkit::DevelVisual::Property::CORNER_RADIUS:
357       {
358         if(value.GetType() == Property::VECTOR4)
359         {
360           // If CORNER_RADIUS Property is Vector4,
361           // Each values mean the radius of
362           // (top-left, top-right, bottom-right, bottom-left)
363           Vector4 radius;
364           if(value.Get(radius))
365           {
366             mImpl->mCornerRadius = radius;
367           }
368         }
369         else
370         {
371           // If CORNER_RADIUS Property is float,
372           // Every corner radius have same value
373           float radius;
374           if(value.Get(radius))
375           {
376             mImpl->mCornerRadius = Vector4(radius, radius, radius, radius);
377           }
378         }
379
380         if(DALI_UNLIKELY(mImpl->mRenderer && IsTypeAvailableForCornerRadius(mImpl->mType)))
381         {
382           // Unusual case. SetProperty called after OnInitialize().
383           // Assume that DoAction call UPDATE_PROPERTY.
384           DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
385           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
386
387           // Check whether we must update shader.
388           if(!mImpl->mAlwaysUsingCornerRadius && IsRoundedCornerRequired())
389           {
390             // Change the shader must not be occured many times. we always have to use corner radius feature.
391             mImpl->mAlwaysUsingCornerRadius = true;
392
393             if(!IsBorderlineRequired())
394             {
395               // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
396               mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
397             }
398
399             // Change shader
400             if(!mImpl->mCustomShader)
401             {
402               needUpdateShader = true;
403             }
404           }
405         }
406
407         break;
408       }
409       case Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY:
410       {
411         int policy;
412         if(value.Get(policy))
413         {
414           switch(policy)
415           {
416             case Toolkit::Visual::Transform::Policy::RELATIVE:
417             case Toolkit::Visual::Transform::Policy::ABSOLUTE:
418             {
419               mImpl->mCornerRadiusPolicy = policy;
420               if(DALI_UNLIKELY(mImpl->mRenderer))
421               {
422                 // Unusual case. SetProperty called after OnInitialize().
423                 // Assume that DoAction call UPDATE_PROPERTY.
424                 mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
425               }
426               break;
427             }
428             default:
429             {
430               DALI_LOG_ERROR("Unsupported policy: %d\n", policy);
431               break;
432             }
433           }
434         }
435         break;
436       }
437     }
438   }
439
440   DoSetProperties(propertyMap);
441
442   if(DALI_UNLIKELY(needUpdateShader))
443   {
444     UpdateShader();
445   }
446 }
447
448 void Visual::Base::SetTransformAndSize(const Property::Map& transform, Size controlSize)
449 {
450   mImpl->mControlSize = controlSize;
451   mImpl->mTransform.UpdatePropertyMap(transform);
452
453 #if defined(DEBUG_ENABLED)
454   std::ostringstream oss;
455   oss << transform;
456   DALI_LOG_INFO(gVisualBaseLogFilter, Debug::General, "Visual::Base::SetTransformAndSize(%s) - [\e[1;32mtransform: %s  controlSize: (%3.1f, %3.1f)]\e[0m\n", GetName().c_str(), oss.str().c_str(), controlSize.x, controlSize.y);
457 #endif
458
459   OnSetTransform();
460 }
461
462 void Visual::Base::SetName(const std::string& name)
463 {
464   mImpl->mName = name;
465 }
466
467 const std::string& Visual::Base::GetName() const
468 {
469   return mImpl->mName;
470 }
471
472 float Visual::Base::GetHeightForWidth(float width)
473 {
474   float   aspectCorrectedHeight = 0.f;
475   Vector2 naturalSize;
476   GetNaturalSize(naturalSize);
477   if(naturalSize.width)
478   {
479     aspectCorrectedHeight = naturalSize.height * width / naturalSize.width;
480   }
481   return aspectCorrectedHeight;
482 }
483
484 float Visual::Base::GetWidthForHeight(float height)
485 {
486   float   aspectCorrectedWidth = 0.f;
487   Vector2 naturalSize;
488   GetNaturalSize(naturalSize);
489   if(naturalSize.height > 0.0f)
490   {
491     aspectCorrectedWidth = naturalSize.width * height / naturalSize.height;
492   }
493   return aspectCorrectedWidth;
494 }
495
496 void Visual::Base::GetNaturalSize(Vector2& naturalSize)
497 {
498   naturalSize = Vector2::ZERO;
499 }
500
501 void Visual::Base::DoAction(const Property::Index actionId, const Property::Value attributes)
502 {
503   OnDoAction(actionId, attributes);
504
505   // Check if action is valid for this visual type and perform action if possible
506   switch(actionId)
507   {
508     case DevelVisual::Action::UPDATE_PROPERTY:
509     {
510       const Property::Map* map = attributes.GetMap();
511       if(map)
512       {
513         SetProperties(*map);
514       }
515       break;
516     }
517   }
518 }
519
520 void Visual::Base::DoActionExtension(const Dali::Property::Index actionId, const Dali::Any attributes)
521 {
522   OnDoActionExtension(actionId, attributes);
523 }
524
525 void Visual::Base::SetDepthIndex(int index)
526 {
527   mImpl->mDepthIndex = index;
528   if(mImpl->mRenderer)
529   {
530     mImpl->mRenderer.SetProperty(Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex);
531   }
532 }
533
534 int Visual::Base::GetDepthIndex() const
535 {
536   return mImpl->mDepthIndex;
537 }
538
539 void Visual::Base::SetOnScene(Actor& actor)
540 {
541   if(!IsOnScene())
542   {
543     // To display the actor correctly, renderer should not be added to actor until all required resources are ready.
544     // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing.
545     DoSetOnScene(actor);
546
547     if(mImpl->mRenderer)
548     {
549       mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
550       mImpl->mRenderer.SetProperty(Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex);
551     }
552
553     mImpl->mFlags |= Impl::IS_ON_SCENE;
554   }
555 }
556
557 void Visual::Base::SetOffScene(Actor& actor)
558 {
559   if(IsOnScene())
560   {
561     DoSetOffScene(actor);
562     mImpl->mFlags &= ~Impl::IS_ON_SCENE;
563   }
564 }
565
566 void Visual::Base::CreatePropertyMap(Property::Map& map) const
567 {
568   if(mImpl->mRenderer)
569   {
570     // Update values from Renderer
571     mImpl->mMixColor   = mImpl->mRenderer.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR);
572     mImpl->mMixColor.a = mImpl->mRenderer.GetProperty<float>(DevelRenderer::Property::OPACITY);
573
574     mImpl->mTransform.mOffset = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_OFFSET);
575     mImpl->mTransform.mSize   = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_SIZE);
576
577     if(IsTypeAvailableForCornerRadius(mImpl->mType))
578     {
579       mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
580     }
581     if(IsTypeAvailableForBorderline(mImpl->mType))
582     {
583       mImpl->mBorderlineWidth  = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
584       mImpl->mBorderlineColor  = mImpl->mRenderer.GetProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
585       mImpl->mBorderlineOffset = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
586     }
587   }
588
589   DoCreatePropertyMap(map);
590
591   if(mImpl->mCustomShader)
592   {
593     mImpl->mCustomShader->CreatePropertyMap(map);
594   }
595
596   Property::Map transform;
597   mImpl->mTransform.GetPropertyMap(transform);
598   map.Insert(Toolkit::Visual::Property::TRANSFORM, transform);
599
600   bool premultipliedAlpha(IsPreMultipliedAlphaEnabled());
601   map.Insert(Toolkit::Visual::Property::PREMULTIPLIED_ALPHA, premultipliedAlpha);
602
603   // Note, Color and Primitive will also insert their own mix color into the map
604   // which is ok, because they have a different key value range, but uses same cached value anyway.
605   map.Insert(Toolkit::Visual::Property::MIX_COLOR, mImpl->mMixColor); // vec4
606   map.Insert(Toolkit::Visual::Property::OPACITY, mImpl->mMixColor.a);
607
608   auto fittingModeString = Scripting::GetLinearEnumerationName<FittingMode>(
609     mImpl->mFittingMode, VISUAL_FITTING_MODE_TABLE, VISUAL_FITTING_MODE_TABLE_COUNT);
610   map.Insert(Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE, fittingModeString);
611
612   if(IsTypeAvailableForBorderline(mImpl->mType))
613   {
614     map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
615     map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
616     map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
617   }
618
619   if(IsTypeAvailableForCornerRadius(mImpl->mType))
620   {
621     map.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mImpl->mCornerRadius);
622     map.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, static_cast<int>(mImpl->mCornerRadiusPolicy));
623   }
624 }
625
626 void Visual::Base::CreateInstancePropertyMap(Property::Map& map) const
627 {
628   DoCreateInstancePropertyMap(map);
629
630   if(mImpl->mCustomShader)
631   {
632     mImpl->mCustomShader->CreatePropertyMap(map);
633   }
634 }
635
636 void Visual::Base::EnablePreMultipliedAlpha(bool preMultiplied)
637 {
638   if(preMultiplied)
639   {
640     mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
641   }
642   else
643   {
644     mImpl->mFlags &= ~Impl::IS_PREMULTIPLIED_ALPHA;
645   }
646
647   if(mImpl->mRenderer)
648   {
649     mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, preMultiplied);
650     mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, preMultiplied);
651   }
652 }
653
654 bool Visual::Base::IsPreMultipliedAlphaEnabled() const
655 {
656   return mImpl->mFlags & Impl::IS_PREMULTIPLIED_ALPHA;
657 }
658
659 void Visual::Base::DoSetOffScene(Actor& actor)
660 {
661   actor.RemoveRenderer(mImpl->mRenderer);
662 }
663
664 bool Visual::Base::IsOnScene() const
665 {
666   return mImpl->mFlags & Impl::IS_ON_SCENE;
667 }
668
669 bool Visual::Base::IsRoundedCornerRequired() const
670 {
671   // If VisualType doesn't support rounded corner, always return false.
672   if(IsTypeAvailableForCornerRadius(mImpl->mType))
673   {
674     if(mImpl->mRenderer)
675     {
676       // Update values from Renderer
677       Property::Value value = mImpl->mRenderer.GetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS);
678       value.Get(mImpl->mCornerRadius);
679     }
680     return mImpl->mAlwaysUsingCornerRadius || !(mImpl->mCornerRadius == Vector4::ZERO);
681   }
682   return false;
683 }
684
685 bool Visual::Base::IsBorderlineRequired() const
686 {
687   // If VisualType doesn't support borderline, always return false.
688   if(IsTypeAvailableForBorderline(mImpl->mType))
689   {
690     if(mImpl->mRenderer)
691     {
692       // Update values from Renderer
693       Property::Value value = mImpl->mRenderer.GetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
694       value.Get(mImpl->mBorderlineWidth);
695     }
696     return mImpl->mAlwaysUsingBorderline || !EqualsZero(mImpl->mBorderlineWidth);
697   }
698   return false;
699 }
700
701 void Visual::Base::OnDoAction(const Property::Index actionId, const Property::Value& attributes)
702 {
703   // May be overriden by derived class
704 }
705
706 void Visual::Base::OnDoActionExtension(const Property::Index actionId, const Dali::Any attributes)
707 {
708   // May be overriden by derived class
709 }
710
711 void Visual::Base::RegisterMixColor()
712 {
713   if(mImpl->mRenderer)
714   {
715     // All visual renderers now use same mix color / opacity properties.
716     mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, Vector3(mImpl->mMixColor));
717     mImpl->mRenderer.SetProperty(DevelRenderer::Property::OPACITY, mImpl->mMixColor.a);
718
719     float preMultipliedAlpha = 0.0f;
720     if(IsPreMultipliedAlphaEnabled())
721     {
722       preMultipliedAlpha = 1.0f;
723     }
724     mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, preMultipliedAlpha);
725   }
726 }
727
728 void Visual::Base::RegisterDecoration()
729 {
730   if(mImpl->mRenderer)
731   {
732     if(IsTypeAvailableForCornerRadius(mImpl->mType))
733     {
734       if(mImpl->mAlwaysUsingCornerRadius || !(mImpl->mCornerRadius == Vector4::ZERO))
735       {
736         DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
737         mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
738         mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
739       }
740     }
741     if(IsTypeAvailableForBorderline(mImpl->mType))
742     {
743       if(mImpl->mAlwaysUsingBorderline || !EqualsZero(mImpl->mBorderlineWidth))
744       {
745         DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
746         mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
747         mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
748         mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
749       }
750     }
751   }
752 }
753
754 void Visual::Base::SetMixColor(const Vector4& color)
755 {
756   mImpl->mMixColor = color;
757
758   if(mImpl->mRenderer)
759   {
760     mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, Vector3(color));
761     mImpl->mRenderer.SetProperty(DevelRenderer::Property::OPACITY, color.a);
762   }
763 }
764
765 void Visual::Base::SetMixColor(const Vector3& color)
766 {
767   mImpl->mMixColor.r = color.r;
768   mImpl->mMixColor.g = color.g;
769   mImpl->mMixColor.b = color.b;
770
771   if(mImpl->mRenderer)
772   {
773     mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, color);
774   }
775 }
776
777 void Visual::Base::AddEventObserver(Visual::EventObserver& observer)
778 {
779   mImpl->mEventObserver = &observer;
780 }
781
782 void Visual::Base::RemoveEventObserver(Visual::EventObserver& observer)
783 {
784   mImpl->mEventObserver = NULL;
785 }
786
787 void Visual::Base::ResourceReady(Toolkit::Visual::ResourceStatus resourceStatus)
788 {
789   if(mImpl->mResourceStatus != resourceStatus)
790   {
791     mImpl->mResourceStatus = resourceStatus;
792
793     if(mImpl->mEventObserver)
794     {
795       // observer is currently a control impl
796       mImpl->mEventObserver->ResourceReady(*this);
797     }
798   }
799 }
800
801 bool Visual::Base::IsResourceReady() const
802 {
803   return (mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::READY ||
804           mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::FAILED);
805 }
806
807 bool Visual::Base::IsSynchronousLoadingRequired() const
808 {
809   return (mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING);
810 }
811
812 Toolkit::Visual::Type Visual::Base::GetType() const
813 {
814   return mImpl->mType;
815 }
816
817 Toolkit::Visual::ResourceStatus Visual::Base::GetResourceStatus() const
818 {
819   return mImpl->mResourceStatus;
820 }
821
822 Visual::FittingMode Visual::Base::GetFittingMode() const
823 {
824   return mImpl->mFittingMode;
825 }
826
827 Visual::Base& Visual::Base::GetVisualObject()
828 {
829   return *this;
830 }
831
832 Renderer Visual::Base::GetRenderer()
833 {
834   return mImpl->mRenderer;
835 }
836
837 Property::Index Visual::Base::GetIntKey(Property::Key key)
838 {
839   if(key.type == Property::Key::INDEX)
840   {
841     return key.indexKey;
842   }
843
844   if(key.stringKey == ANCHOR_POINT)
845   {
846     return Toolkit::Visual::Transform::Property::ANCHOR_POINT;
847   }
848   else if(key.stringKey == EXTRA_SIZE)
849   {
850     return Toolkit::DevelVisual::Transform::Property::EXTRA_SIZE;
851   }
852   else if(key.stringKey == MIX_COLOR)
853   {
854     return Toolkit::Visual::Property::MIX_COLOR;
855   }
856   else if(key.stringKey == OPACITY)
857   {
858     return Toolkit::Visual::Property::OPACITY;
859   }
860   else if(key.stringKey == OFFSET)
861   {
862     return Toolkit::Visual::Transform::Property::OFFSET;
863   }
864   else if(key.stringKey == OFFSET_POLICY)
865   {
866     return Toolkit::Visual::Transform::Property::OFFSET_POLICY;
867   }
868   else if(key.stringKey == ORIGIN)
869   {
870     return Toolkit::Visual::Transform::Property::ORIGIN;
871   }
872   else if(key.stringKey == PREMULTIPLIED_ALPHA)
873   {
874     return Toolkit::Visual::Property::PREMULTIPLIED_ALPHA;
875   }
876   else if(key.stringKey == CUSTOM_SHADER)
877   {
878     return Toolkit::Visual::Property::SHADER;
879   }
880   else if(key.stringKey == SIZE)
881   {
882     return Toolkit::Visual::Transform::Property::SIZE;
883   }
884   else if(key.stringKey == SIZE_POLICY)
885   {
886     return Toolkit::Visual::Transform::Property::SIZE_POLICY;
887   }
888   else if(key.stringKey == TRANSFORM)
889   {
890     return Toolkit::Visual::Property::TRANSFORM;
891   }
892   else if(key.stringKey == VISUAL_FITTING_MODE)
893   {
894     return Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE;
895   }
896   else if(key.stringKey == CORNER_RADIUS)
897   {
898     return Toolkit::DevelVisual::Property::CORNER_RADIUS;
899   }
900   else if(key.stringKey == CORNER_RADIUS_POLICY)
901   {
902     return Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY;
903   }
904   else if(key.stringKey == BORDERLINE_WIDTH)
905   {
906     return Toolkit::DevelVisual::Property::BORDERLINE_WIDTH;
907   }
908   else if(key.stringKey == BORDERLINE_COLOR)
909   {
910     return Toolkit::DevelVisual::Property::BORDERLINE_COLOR;
911   }
912   else if(key.stringKey == BORDERLINE_OFFSET)
913   {
914     return Toolkit::DevelVisual::Property::BORDERLINE_OFFSET;
915   }
916
917   return Property::INVALID_INDEX;
918 }
919
920 Property::Index Visual::Base::GetPropertyIndex(Property::Key key)
921 {
922   switch(GetIntKey(key))
923   {
924     case Dali::Toolkit::Visual::Transform::Property::OFFSET:
925     {
926       return VisualRenderer::Property::TRANSFORM_OFFSET;
927     }
928     case Dali::Toolkit::Visual::Transform::Property::SIZE:
929     {
930       return VisualRenderer::Property::TRANSFORM_SIZE;
931     }
932     case Dali::Toolkit::Visual::Transform::Property::ORIGIN:
933     {
934       return VisualRenderer::Property::TRANSFORM_ORIGIN;
935     }
936     case Dali::Toolkit::Visual::Transform::Property::ANCHOR_POINT:
937     {
938       return VisualRenderer::Property::TRANSFORM_ANCHOR_POINT;
939     }
940     case Dali::Toolkit::Visual::Property::MIX_COLOR:
941     {
942       return VisualRenderer::Property::VISUAL_MIX_COLOR;
943     }
944     case Dali::Toolkit::Visual::Property::OPACITY:
945     {
946       return DevelRenderer::Property::OPACITY;
947     }
948     case Dali::Toolkit::Visual::Property::PREMULTIPLIED_ALPHA:
949     {
950       return VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA;
951     }
952     case Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS:
953     {
954       return DecoratedVisualRenderer::Property::CORNER_RADIUS;
955     }
956     case Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH:
957     {
958       return DecoratedVisualRenderer::Property::BORDERLINE_WIDTH;
959     }
960     case Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
961     {
962       return DecoratedVisualRenderer::Property::BORDERLINE_COLOR;
963     }
964     case Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
965     {
966       return DecoratedVisualRenderer::Property::BORDERLINE_OFFSET;
967     }
968   }
969
970   Property::Index index = mImpl->mRenderer.GetPropertyIndex(key);
971
972   if(index == Property::INVALID_INDEX)
973   {
974     // Is it a shader property?
975     Shader shader = mImpl->mRenderer.GetShader();
976     index         = shader.GetPropertyIndex(key);
977     if(index != Property::INVALID_INDEX)
978     {
979       // Yes - we should register it in the Renderer so it can be set / animated
980       // independently, as shaders are shared across multiple renderers.
981       std::string     keyName;
982       Property::Index keyIndex(Property::INVALID_KEY);
983       if(key.type == Property::Key::INDEX)
984       {
985         keyName  = shader.GetPropertyName(index);
986         keyIndex = key.indexKey;
987       }
988       else
989       {
990         keyName = key.stringKey;
991         // Leave keyIndex as INVALID_KEY - it can still be registered against the string key.
992       }
993       Property::Value value = shader.GetProperty(index);
994
995       // We already know that mRenderer didn't have property. So we can assume that it is unique.
996       index = mImpl->mRenderer.RegisterUniqueProperty(keyIndex, keyName, value);
997     }
998   }
999   return index;
1000 }
1001
1002 void Visual::Base::SetupTransition(
1003   Dali::Animation&                    transition,
1004   Internal::TransitionData::Animator& animator,
1005   Property::Index                     index,
1006   Property::Value&                    initialValue,
1007   Property::Value&                    targetValue)
1008 {
1009   if(index != Property::INVALID_INDEX)
1010   {
1011     if(mImpl->mRenderer)
1012     {
1013       if(animator.animate == false)
1014       {
1015         mImpl->mRenderer.SetProperty(index, targetValue);
1016       }
1017       else
1018       {
1019         if(animator.initialValue.GetType() != Property::NONE)
1020         {
1021           mImpl->mRenderer.SetProperty(index, initialValue);
1022         }
1023
1024         if(!transition)
1025         {
1026           transition = Dali::Animation::New(0.1f);
1027         }
1028
1029         transition.AnimateTo(Property(mImpl->mRenderer, index),
1030                              targetValue,
1031                              animator.alphaFunction,
1032                              TimePeriod(animator.timePeriodDelay,
1033                                         animator.timePeriodDuration));
1034       }
1035     }
1036   }
1037 }
1038
1039 void Visual::Base::AnimateProperty(
1040   Dali::Animation&                    transition,
1041   Internal::TransitionData::Animator& animator)
1042 {
1043 #if defined(DEBUG_ENABLED)
1044   if(gVisualBaseLogFilter->IsEnabledFor(Debug::General))
1045   {
1046     std::ostringstream oss;
1047     oss << "Visual::Base::AnimateProperty(Visual:" << mImpl->mName << " Property:" << animator.propertyKey << " Target: " << animator.targetValue << std::endl;
1048     DALI_LOG_INFO(gVisualBaseLogFilter, Debug::General, oss.str().c_str());
1049   }
1050 #endif
1051
1052   if(animator.propertyKey == Toolkit::Visual::Property::MIX_COLOR ||
1053      animator.propertyKey == MIX_COLOR ||
1054      (mImpl->mType == Toolkit::Visual::COLOR &&
1055       animator.propertyKey == ColorVisual::Property::MIX_COLOR) ||
1056      (mImpl->mType == Toolkit::Visual::PRIMITIVE &&
1057       animator.propertyKey == PrimitiveVisual::Property::MIX_COLOR))
1058   {
1059     AnimateMixColorProperty(transition, animator);
1060   }
1061   else if(animator.propertyKey == Toolkit::Visual::Property::OPACITY ||
1062           animator.propertyKey == OPACITY)
1063   {
1064     AnimateOpacityProperty(transition, animator);
1065   }
1066   else if(mImpl->mRenderer)
1067   {
1068     AnimateRendererProperty(transition, animator);
1069   }
1070 }
1071
1072 void Visual::Base::AnimateOpacityProperty(
1073   Dali::Animation&                    transition,
1074   Internal::TransitionData::Animator& animator)
1075 {
1076   float targetOpacity;
1077   if(animator.targetValue.Get(targetOpacity))
1078   {
1079     mImpl->mMixColor.a = targetOpacity;
1080   }
1081
1082   SetupTransition(transition, animator, DevelRenderer::Property::OPACITY, animator.initialValue, animator.targetValue);
1083 }
1084
1085 void Visual::Base::AnimateRendererProperty(
1086   Dali::Animation&                    transition,
1087   Internal::TransitionData::Animator& animator)
1088 {
1089   // Get actual renderer index (will convert transform keys into visualproperty indices)
1090   Property::Index index = GetPropertyIndex(animator.propertyKey);
1091
1092   if(index != Property::INVALID_INDEX)
1093   {
1094     if(animator.targetValue.GetType() != Property::NONE)
1095     {
1096       // Try writing target value into transform property map
1097       // if it's not a valid key, then it won't alter mTransform
1098       Property::Map map;
1099       if(animator.propertyKey.type == Property::Key::INDEX)
1100       {
1101         map.Add(animator.propertyKey.indexKey, animator.targetValue);
1102       }
1103       else
1104       {
1105         map.Add(animator.propertyKey.stringKey, animator.targetValue);
1106       }
1107
1108       mImpl->mTransform.UpdatePropertyMap(map);
1109     }
1110     SetupTransition(transition, animator, index, animator.initialValue, animator.targetValue);
1111   }
1112 }
1113
1114 void Visual::Base::AnimateMixColorProperty(
1115   Dali::Animation&                    transition,
1116   Internal::TransitionData::Animator& animator)
1117 {
1118   bool animateOpacity = false;
1119
1120   Property::Value initialOpacity;
1121   Property::Value targetOpacity;
1122   Property::Value initialMixColor;
1123   Property::Value targetMixColor;
1124
1125   Vector4 initialColor;
1126   if(animator.initialValue.Get(initialColor))
1127   {
1128     if(animator.initialValue.GetType() == Property::VECTOR4)
1129     {
1130       // if there is an initial color specifying alpha, test it
1131       initialOpacity = initialColor.a;
1132     }
1133     initialMixColor = Vector3(initialColor);
1134   }
1135
1136   // Set target value into data store
1137   if(animator.targetValue.GetType() != Property::NONE)
1138   {
1139     Vector4 mixColor;
1140     animator.targetValue.Get(mixColor);
1141     if(animator.targetValue.GetType() == Property::VECTOR4)
1142     {
1143       mImpl->mMixColor.a = mixColor.a;
1144       targetOpacity      = mixColor.a;
1145       animateOpacity     = true;
1146     }
1147
1148     mImpl->mMixColor.r = mixColor.r;
1149     mImpl->mMixColor.g = mixColor.g;
1150     mImpl->mMixColor.b = mixColor.b;
1151     targetMixColor     = Vector3(mixColor);
1152   }
1153
1154   SetupTransition(transition, animator, VisualRenderer::Property::VISUAL_MIX_COLOR, initialMixColor, targetMixColor);
1155
1156   if(animateOpacity)
1157   {
1158     SetupTransition(transition, animator, DevelRenderer::Property::OPACITY, initialOpacity, targetOpacity);
1159   }
1160 }
1161
1162 Dali::Property Visual::Base::GetPropertyObject(Dali::Property::Key key)
1163 {
1164   if(!mImpl->mRenderer)
1165   {
1166     Handle handle;
1167     return Dali::Property(handle, Property::INVALID_INDEX);
1168   }
1169
1170   switch(GetIntKey(key))
1171   {
1172     // Default animatable properties from VisualRenderer
1173     case Toolkit::Visual::Property::MIX_COLOR:
1174     {
1175       return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
1176     }
1177     case Toolkit::Visual::Property::OPACITY:
1178     {
1179       return Dali::Property(mImpl->mRenderer, DevelRenderer::Property::OPACITY);
1180     }
1181     case Toolkit::Visual::Transform::Property::OFFSET:
1182     {
1183       return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::TRANSFORM_OFFSET);
1184     }
1185     case Toolkit::Visual::Transform::Property::SIZE:
1186     {
1187       return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::TRANSFORM_SIZE);
1188     }
1189
1190     // Default animatable properties from DecoratedVisualRenderer
1191     case Toolkit::DevelVisual::Property::CORNER_RADIUS:
1192     {
1193       if(IsTypeAvailableForCornerRadius(mImpl->mType))
1194       {
1195         const bool updateShader = !mImpl->mCustomShader && !IsRoundedCornerRequired();
1196
1197         // CornerRadius is animated now. we always have to use corner radius feature.
1198         mImpl->mAlwaysUsingCornerRadius = true;
1199
1200         if(updateShader)
1201         {
1202           // Update each values to renderer
1203           DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
1204           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
1205           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
1206
1207           // Change shader
1208           UpdateShader();
1209         }
1210         if(!IsBorderlineRequired())
1211         {
1212           // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
1213           mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
1214         }
1215         return Dali::Property(mImpl->mRenderer, DecoratedVisualRenderer::Property::CORNER_RADIUS);
1216       }
1217       break;
1218     }
1219     case Toolkit::DevelVisual::Property::BORDERLINE_WIDTH:
1220     case Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
1221     case Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
1222     {
1223       if(IsTypeAvailableForBorderline(mImpl->mType))
1224       {
1225         const bool updateShader = !mImpl->mCustomShader && !IsBorderlineRequired();
1226
1227         // Borderline is animated now. we always have to use borderline feature.
1228         mImpl->mAlwaysUsingBorderline = true;
1229
1230         if(updateShader)
1231         {
1232           // Update each values to renderer
1233           DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
1234           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
1235           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
1236           mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
1237
1238           // Change shader
1239           UpdateShader();
1240         }
1241         mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
1242
1243         return Dali::Property(mImpl->mRenderer, GetPropertyIndex(key));
1244       }
1245       break;
1246     }
1247     default:
1248     {
1249       // Special case for MIX_COLOR
1250       if(key.type == Property::Key::INDEX &&
1251          ((mImpl->mType == Toolkit::Visual::COLOR && key.indexKey == ColorVisual::Property::MIX_COLOR) ||
1252           (mImpl->mType == Toolkit::Visual::PRIMITIVE && key.indexKey == PrimitiveVisual::Property::MIX_COLOR)))
1253       {
1254         return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
1255       }
1256
1257       // Special case for BLUR_RADIUS
1258       if(mImpl->mType == Toolkit::Visual::COLOR &&
1259          ((key.type == Property::Key::INDEX && key.indexKey == DevelColorVisual::Property::BLUR_RADIUS) ||
1260           (key.type == Property::Key::STRING && key.stringKey == BLUR_RADIUS_NAME)))
1261       {
1262         // Request to color-visual class
1263         return OnGetPropertyObject(key);
1264       }
1265     }
1266   }
1267
1268   // If it is not VisualRenderer property, check registered Renderer and Shader property.
1269   Property::Index index = GetPropertyIndex(key);
1270   if(index != Property::INVALID_INDEX)
1271   {
1272     return Dali::Property(mImpl->mRenderer, index);
1273   }
1274
1275   // We can't find the property in the base class.
1276   // Request to child class
1277   return OnGetPropertyObject(key);
1278 }
1279
1280 } // namespace Internal
1281
1282 } // namespace Toolkit
1283
1284 } // namespace Dali