Visuals call SetProperties internally for 2-stage initialization 78/100578/7
authorTom Robinson <tom.robinson@samsung.com>
Mon, 28 Nov 2016 12:01:01 +0000 (12:01 +0000)
committerTom Robinson <tom.robinson@samsung.com>
Mon, 12 Dec 2016 10:54:12 +0000 (02:54 -0800)
Change-Id: I7da559f150e09d51e88a0c94ee651f572da0d190

21 files changed:
dali-toolkit/internal/visuals/border/border-visual.cpp
dali-toolkit/internal/visuals/border/border-visual.h
dali-toolkit/internal/visuals/color/color-visual.cpp
dali-toolkit/internal/visuals/color/color-visual.h
dali-toolkit/internal/visuals/gradient/gradient-visual.cpp
dali-toolkit/internal/visuals/gradient/gradient-visual.h
dali-toolkit/internal/visuals/image/batch-image-visual.cpp
dali-toolkit/internal/visuals/image/batch-image-visual.h
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/image/image-visual.h
dali-toolkit/internal/visuals/mesh/mesh-visual.cpp
dali-toolkit/internal/visuals/mesh/mesh-visual.h
dali-toolkit/internal/visuals/npatch/npatch-visual.cpp
dali-toolkit/internal/visuals/npatch/npatch-visual.h
dali-toolkit/internal/visuals/primitive/primitive-visual.cpp
dali-toolkit/internal/visuals/primitive/primitive-visual.h
dali-toolkit/internal/visuals/svg/svg-visual.cpp
dali-toolkit/internal/visuals/svg/svg-visual.h
dali-toolkit/internal/visuals/text/text-visual.cpp
dali-toolkit/internal/visuals/text/text-visual.h
dali-toolkit/internal/visuals/visual-factory-impl.cpp

index ac5cf01..3811a64 100644 (file)
@@ -119,9 +119,11 @@ const char* FRAGMENT_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
 );
 }
 
 );
 }
 
-BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache )
+BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
 {
 {
-  return new BorderVisual( factoryCache );
+  BorderVisualPtr borderVisualPtr( new BorderVisual( factoryCache ) );
+  borderVisualPtr->SetProperties( properties );
+  return borderVisualPtr;
 }
 
 BorderVisual::BorderVisual( VisualFactoryCache& factoryCache )
 }
 
 BorderVisual::BorderVisual( VisualFactoryCache& factoryCache )
index 4016fd8..c9d6465 100644 (file)
@@ -56,9 +56,10 @@ public:
    * @brief Create a new border visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @brief Create a new border visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] properties A Property::Map containing settings for this visual
    * @return A smart-pointer to the newly allocated visual.
    */
    * @return A smart-pointer to the newly allocated visual.
    */
-  static BorderVisualPtr New( VisualFactoryCache& factoryCache );
+  static BorderVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
 
 protected:
 
 
 protected:
 
index 781fdf7..08dfd20 100644 (file)
@@ -80,9 +80,11 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
 );
 }
 
 );
 }
 
-ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache )
+ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
 {
 {
-  return new ColorVisual( factoryCache );
+  ColorVisualPtr colorVisualPtr( new ColorVisual( factoryCache ) );
+  colorVisualPtr->SetProperties( properties );
+  return colorVisualPtr;
 }
 
 ColorVisual::ColorVisual( VisualFactoryCache& factoryCache )
 }
 
 ColorVisual::ColorVisual( VisualFactoryCache& factoryCache )
index ebe2768..99758d1 100644 (file)
@@ -53,9 +53,10 @@ public:
    * @brief Create a new color visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @brief Create a new color visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] properties A Property::Map containing settings for this visual
    * @return A smart-pointer to the newly allocated visual.
    */
    * @return A smart-pointer to the newly allocated visual.
    */
-  static ColorVisualPtr New( VisualFactoryCache& factoryCache );
+  static ColorVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
 
 public:  // from Visual
 
 
 public:  // from Visual
 
index f573c1c..80c899f 100644 (file)
@@ -215,9 +215,11 @@ Dali::WrapMode::Type GetWrapMode( Toolkit::GradientVisual::SpreadMethod::Type sp
 
 } // unnamed namespace
 
 
 } // unnamed namespace
 
-GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache )
+GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
 {
 {
-  return new GradientVisual( factoryCache );
+  GradientVisualPtr gradientVisualPtr( new GradientVisual( factoryCache ) );
+  gradientVisualPtr->SetProperties( properties );
+  return gradientVisualPtr;
 }
 
 GradientVisual::GradientVisual( VisualFactoryCache& factoryCache )
 }
 
 GradientVisual::GradientVisual( VisualFactoryCache& factoryCache )
index 6248f0f..c64b588 100644 (file)
@@ -88,9 +88,10 @@ public:
    * @brief Create a new gradient visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @brief Create a new gradient visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] properties A Property::Map containing settings for this visual
    * @return A smart-pointer to the newly allocated visual.
    */
    * @return A smart-pointer to the newly allocated visual.
    */
-  static GradientVisualPtr New( VisualFactoryCache& factoryCache );
+  static GradientVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
 
 public:  // from Visual
 
 
 public:  // from Visual
 
index 18ca0c7..f5b4392 100644 (file)
@@ -89,10 +89,12 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
 
 } // unnamed namespace
 
 
 } // unnamed namespace
 
-BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url )
+BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties )
 {
   BatchImageVisualPtr visual = new BatchImageVisual( factoryCache );
   visual->mImageUrl = url;
 {
   BatchImageVisualPtr visual = new BatchImageVisual( factoryCache );
   visual->mImageUrl = url;
+  visual->SetProperties( properties );
+
   return visual;
 }
 
   return visual;
 }
 
index 4e8614f..84953f5 100644 (file)
@@ -43,9 +43,11 @@ public:
    * @brief Create a new batch-image visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @brief Create a new batch-image visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] url The URL of the image to use
+   * @param[in] properties A Property::Map containing settings for this visual
    * @return A smart-pointer to the newly allocated visual.
    */
    * @return A smart-pointer to the newly allocated visual.
    */
-  static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url );
+  static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties = Property::Map() );
 
 public:  // from Visual
 
 
 public:  // from Visual
 
index 4f2fb6e..69a1094 100644 (file)
@@ -203,6 +203,18 @@ Geometry CreateGeometry( VisualFactoryCache& factoryCache, ImageDimensions gridS
 
 ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
                                  const std::string& imageUrl,
 
 ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
                                  const std::string& imageUrl,
+                                 const Property::Map& properties,
+                                 ImageDimensions size,
+                                 FittingMode::Type fittingMode,
+                                 Dali::SamplingMode::Type samplingMode )
+{
+  ImageVisualPtr imageVisualPtr( new ImageVisual( factoryCache, imageUrl, size, fittingMode, samplingMode ) );
+  imageVisualPtr->SetProperties( properties );
+  return imageVisualPtr;
+}
+
+ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
+                                 const std::string& imageUrl,
                                  ImageDimensions size,
                                  FittingMode::Type fittingMode,
                                  Dali::SamplingMode::Type samplingMode )
                                  ImageDimensions size,
                                  FittingMode::Type fittingMode,
                                  Dali::SamplingMode::Type samplingMode )
@@ -272,11 +284,14 @@ void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
     mSamplingMode = Dali::SamplingMode::Type( value );
   }
 
     mSamplingMode = Dali::SamplingMode::Type( value );
   }
 
+  // Use a variable to detect if the width or height have been modified by the property map.
+  bool desiredSizeSpecified = false;
   int desiredWidth = 0;
   Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
   if( desiredWidthValue )
   {
     desiredWidthValue->Get( desiredWidth );
   int desiredWidth = 0;
   Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
   if( desiredWidthValue )
   {
     desiredWidthValue->Get( desiredWidth );
+    desiredSizeSpecified = true;
   }
 
   int desiredHeight = 0;
   }
 
   int desiredHeight = 0;
@@ -284,9 +299,14 @@ void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
   if( desiredHeightValue )
   {
     desiredHeightValue->Get( desiredHeight );
   if( desiredHeightValue )
   {
     desiredHeightValue->Get( desiredHeight );
+    desiredSizeSpecified = true;
   }
 
   }
 
-  mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+  // Only update the desired size if specified in the property map.
+  if( desiredSizeSpecified )
+  {
+    mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+  }
 
   Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
   if( pixelAreaValue )
 
   Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
   if( pixelAreaValue )
index e34d011..56c45fb 100644 (file)
@@ -86,9 +86,30 @@ public:
    *
    * @param[in] factoryCache The VisualFactoryCache object
    * @param[in] imageUrl The URL of the image resource to use
    *
    * @param[in] factoryCache The VisualFactoryCache object
    * @param[in] imageUrl The URL of the image resource to use
+   * @param[in] properties A Property::Map containing settings for this visual
    * @param[in] size The width and height to fit the loaded image to.
    * @param[in] fittingMode The FittingMode of the resource to load
    * @param[in] samplingMode The SamplingMode of the resource to load
    * @param[in] size The width and height to fit the loaded image to.
    * @param[in] fittingMode The FittingMode of the resource to load
    * @param[in] samplingMode The SamplingMode of the resource to load
+   * @return A smart-pointer to the newly allocated visual.
+   */
+  static ImageVisualPtr New( VisualFactoryCache& factoryCache,
+                             const std::string& imageUrl,
+                             const Property::Map& properties,
+                             ImageDimensions size = ImageDimensions(),
+                             FittingMode::Type fittingMode = FittingMode::DEFAULT,
+                             Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
+
+  /**
+   * @brief Create a new image visual with a URL.
+   *
+   * The visual will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage
+   *
+   * @param[in] factoryCache The VisualFactoryCache object
+   * @param[in] imageUrl The URL of the image resource to use
+   * @param[in] size The width and height to fit the loaded image to.
+   * @param[in] fittingMode The FittingMode of the resource to load
+   * @param[in] samplingMode The SamplingMode of the resource to load
+   * @return A smart-pointer to the newly allocated visual.
    */
   static ImageVisualPtr New( VisualFactoryCache& factoryCache,
                              const std::string& imageUrl,
    */
   static ImageVisualPtr New( VisualFactoryCache& factoryCache,
                              const std::string& imageUrl,
index 9e503f6..41b99ad 100644 (file)
@@ -344,9 +344,11 @@ const char* NORMAL_MAP_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
 
 } // unnamed namespace
 
 
 } // unnamed namespace
 
-MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache )
+MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
 {
 {
-  return new MeshVisual( factoryCache );
+  MeshVisualPtr meshVisualPtr( new MeshVisual( factoryCache ) );
+  meshVisualPtr->SetProperties( properties );
+  return meshVisualPtr;
 }
 
 MeshVisual::MeshVisual( VisualFactoryCache& factoryCache )
 }
 
 MeshVisual::MeshVisual( VisualFactoryCache& factoryCache )
index 8a9010c..c28b1b2 100644 (file)
@@ -63,9 +63,10 @@ public:
    * @brief Create a new mesh visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @brief Create a new mesh visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] properties A Property::Map containing settings for this visual
    * @return A smart-pointer to the newly allocated visual.
    */
    * @return A smart-pointer to the newly allocated visual.
    */
-  static MeshVisualPtr New( VisualFactoryCache& factoryCache );
+  static MeshVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
 
 public:  // from Visual
 
 
 public:  // from Visual
 
index 8751c3e..3af7b72 100644 (file)
@@ -226,9 +226,18 @@ void RegisterStretchProperties( Renderer& renderer, const char * uniformName, co
 
 /////////////////NPatchVisual////////////////
 
 
 /////////////////NPatchVisual////////////////
 
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties )
+{
+  NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
+  nPatchVisual->mImageUrl = imageUrl;
+  nPatchVisual->SetProperties( properties );
+
+  return nPatchVisual;
+}
+
 NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
 {
 NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
 {
-  NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
+  NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
   nPatchVisual->mImageUrl = imageUrl;
 
   return nPatchVisual;
   nPatchVisual->mImageUrl = imageUrl;
 
   return nPatchVisual;
@@ -236,7 +245,7 @@ NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::
 
 NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image )
 {
 
 NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image )
 {
-  NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
+  NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
   nPatchVisual->mImageUrl = image.GetUrl();
 
   return nPatchVisual;
   nPatchVisual->mImageUrl = image.GetUrl();
 
   return nPatchVisual;
index 91972aa..0a0465f 100644 (file)
@@ -64,6 +64,19 @@ public:
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @param[in] imageUrl The URL to 9 patch image resource to use
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @param[in] imageUrl The URL to 9 patch image resource to use
+   * @param[in] properties A Property::Map containing settings for this visual
+   * @return A smart-pointer to the newly allocated visual.
+   */
+  static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties );
+
+  /**
+   * @brief Create an N-patch visual using an image URL.
+   *
+   * The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage
+   *
+   * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] imageUrl The URL to 9 patch image resource to use
+   * @return A smart-pointer to the newly allocated visual.
    */
   static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
 
    */
   static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
 
index 43c69cc..e949728 100644 (file)
@@ -178,9 +178,11 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
 
 } // unnamed namespace
 
 
 } // unnamed namespace
 
-PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache )
+PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
 {
 {
-  return new PrimitiveVisual( factoryCache );
+  PrimitiveVisualPtr primitiveVisualPtr( new PrimitiveVisual( factoryCache ) );
+  primitiveVisualPtr->SetProperties( properties );
+  return primitiveVisualPtr;
 }
 
 PrimitiveVisual::PrimitiveVisual( VisualFactoryCache& factoryCache )
 }
 
 PrimitiveVisual::PrimitiveVisual( VisualFactoryCache& factoryCache )
index 006440a..7792321 100644 (file)
@@ -105,9 +105,10 @@ public:
    * @brief Create a new primitive visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @brief Create a new primitive visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] properties A Property::Map containing settings for this visual
    * @return A smart-pointer to the newly allocated visual.
    */
    * @return A smart-pointer to the newly allocated visual.
    */
-  static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache );
+  static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
 
 public:  // from Visual
 
 
 public:  // from Visual
 
index b375932..5dbb80f 100644 (file)
@@ -54,10 +54,20 @@ namespace Toolkit
 namespace Internal
 {
 
 namespace Internal
 {
 
+SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties )
+{
+  SvgVisualPtr svgVisual( new SvgVisual( factoryCache ) );
+  svgVisual->ParseFromUrl( imageUrl );
+  svgVisual->SetProperties( properties );
+
+  return svgVisual;
+}
+
 SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
 {
 SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
 {
-  SvgVisual* svgVisual = new SvgVisual( factoryCache );
+  SvgVisualPtr svgVisual( new SvgVisual( factoryCache ) );
   svgVisual->ParseFromUrl( imageUrl );
   svgVisual->ParseFromUrl( imageUrl );
+
   return svgVisual;
 }
 
   return svgVisual;
 }
 
index 2dc5226..26e7208 100644 (file)
@@ -61,6 +61,20 @@ public:
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @param[in] imageUrl The URL to svg resource to use
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @param[in] imageUrl The URL to svg resource to use
+   * @param[in] properties A Property::Map containing settings for this visual
+   * @return A smart-pointer to the newly allocated visual.
+   */
+  static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties );
+
+  /**
+   * @brief Create the SVG Visual using the image URL.
+   *
+   * The visual will parse the SVG image once it is set.
+   * And rasterize it into BufferImage synchronously when the associated actor is put on stage, and destroy the BufferImage when it is off stage
+   *
+   * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] imageUrl The URL to svg resource to use
+   * @return A smart-pointer to the newly allocated visual.
    */
   static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
 
    */
   static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
 
index 03bcfae..7a8ad7a 100644 (file)
@@ -134,9 +134,11 @@ const char* FRAGMENT_SHADER_ATLAS_CLAMP = DALI_COMPOSE_SHADER(
 
 } // unnamed namespace
 
 
 } // unnamed namespace
 
-TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache )
+TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
 {
 {
-  return new TextVisual( factoryCache );
+  TextVisualPtr TextVisualPtr( new TextVisual( factoryCache ) );
+  TextVisualPtr->SetProperties( properties );
+  return TextVisualPtr;
 }
 
 float TextVisual::GetHeightForWidth( float width )
 }
 
 float TextVisual::GetHeightForWidth( float width )
index c5b0efd..5ce01ed 100644 (file)
@@ -71,9 +71,10 @@ public:
    * @brief Create a new text visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
    * @brief Create a new text visual.
    *
    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+   * @param[in] properties A Property::Map containing settings for this visual
    * @return A smart-pointer to the newly allocated visual.
    */
    * @return A smart-pointer to the newly allocated visual.
    */
-  static TextVisualPtr New( VisualFactoryCache& factoryCache );
+  static TextVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
 
 public: // from Visual::Base
 
 
 public: // from Visual::Base
 
index 9fab730..c9e1852 100644 (file)
@@ -117,19 +117,19 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
     {
       case Toolkit::Visual::BORDER:
       {
     {
       case Toolkit::Visual::BORDER:
       {
-        visualPtr = BorderVisual::New( *( mFactoryCache.Get() ) );
+        visualPtr = BorderVisual::New( *( mFactoryCache.Get() ), propertyMap );
         break;
       }
 
       case Toolkit::Visual::COLOR:
       {
         break;
       }
 
       case Toolkit::Visual::COLOR:
       {
-        visualPtr = ColorVisual::New( *( mFactoryCache.Get() ) );
+        visualPtr = ColorVisual::New( *( mFactoryCache.Get() ), propertyMap );
         break;
       }
 
       case Toolkit::Visual::GRADIENT:
       {
         break;
       }
 
       case Toolkit::Visual::GRADIENT:
       {
-        visualPtr = GradientVisual::New( *( mFactoryCache.Get() ) );
+        visualPtr = GradientVisual::New( *( mFactoryCache.Get() ), propertyMap );
         break;
       }
 
         break;
       }
 
@@ -143,11 +143,11 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
           UrlType::Type type = ResolveUrlType( imageUrl );
           if( UrlType::N_PATCH == type )
           {
           UrlType::Type type = ResolveUrlType( imageUrl );
           if( UrlType::N_PATCH == type )
           {
-            visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl );
+            visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
           }
           else if( UrlType::SVG == type )
           {
           }
           else if( UrlType::SVG == type )
           {
-            visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl );
+            visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
           }
           else // Regular image
           {
           }
           else // Regular image
           {
@@ -160,12 +160,11 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
 
             if( batchingEnabled )
             {
 
             if( batchingEnabled )
             {
-              visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl );
-              break;
+              visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
             }
             else
             {
             }
             else
             {
-              visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl );
+              visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
             }
           }
         }
             }
           }
         }
@@ -175,13 +174,13 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
 
       case Toolkit::Visual::MESH:
       {
 
       case Toolkit::Visual::MESH:
       {
-        visualPtr = MeshVisual::New( *( mFactoryCache.Get() ) );
+        visualPtr = MeshVisual::New( *( mFactoryCache.Get() ), propertyMap );
         break;
       }
 
       case Toolkit::Visual::PRIMITIVE:
       {
         break;
       }
 
       case Toolkit::Visual::PRIMITIVE:
       {
-        visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ) );
+        visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ), propertyMap );
         break;
       }
 
         break;
       }
 
@@ -193,17 +192,13 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
 
       case Toolkit::DevelVisual::TEXT:
       {
 
       case Toolkit::DevelVisual::TEXT:
       {
-        visualPtr = TextVisual::New( *( mFactoryCache.Get() ) );
+        visualPtr = TextVisual::New( *( mFactoryCache.Get() ), propertyMap );
         break;
       }
     }
   }
 
         break;
       }
     }
   }
 
-  if( visualPtr )
-  {
-    visualPtr->SetProperties( propertyMap );
-  }
-  else
+  if( !visualPtr )
   {
     DALI_LOG_ERROR( "Renderer type unknown\n" );
   }
   {
     DALI_LOG_ERROR( "Renderer type unknown\n" );
   }