[dali_1.2.34] Merge branch 'devel/master' 98/123898/1
authorNick Holland <nick.holland@partner.samsung.com>
Fri, 7 Apr 2017 10:12:04 +0000 (11:12 +0100)
committerNick Holland <nick.holland@partner.samsung.com>
Fri, 7 Apr 2017 10:12:04 +0000 (11:12 +0100)
Change-Id: I3e08898386d70912a0b784dc4ae5a67f6c1847ba

56 files changed:
automated-tests/resources/broken.png [new file with mode: 0644]
automated-tests/resources/button-up.9.png [new file with mode: 0644]
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.h
automated-tests/src/dali-toolkit/utc-Dali-ImageAtlas.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp
dali-toolkit/internal/file.list
dali-toolkit/internal/image-loader/async-image-loader-impl.cpp
dali-toolkit/internal/image-loader/async-image-loader-impl.h
dali-toolkit/internal/image-loader/image-atlas-impl.cpp
dali-toolkit/internal/image-loader/image-load-thread.cpp
dali-toolkit/internal/image-loader/image-load-thread.h
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/text/text-scroller.cpp
dali-toolkit/internal/visuals/image-atlas-manager.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/image/image-visual.h
dali-toolkit/internal/visuals/texture-manager.cpp [new file with mode: 0644]
dali-toolkit/internal/visuals/texture-manager.h [new file with mode: 0644]
dali-toolkit/internal/visuals/texture-upload-observer.cpp [new file with mode: 0644]
dali-toolkit/internal/visuals/texture-upload-observer.h [new file with mode: 0644]
dali-toolkit/internal/visuals/visual-factory-cache.cpp
dali-toolkit/internal/visuals/visual-factory-cache.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/image-loader/async-image-loader.cpp
doc/dali-toolkit-doc.h
packaging/dali-toolkit.spec
plugins/dali-swig/SWIG/adaptor/window.i
plugins/dali-swig/SWIG/dali-adaptor.i
plugins/dali-swig/SWIG/dali-gc.i
plugins/dali-swig/SWIG/devel-properties.i
plugins/dali-swig/SWIG/events/actor-event.i
plugins/dali-swig/SWIG/property-value.i [changed mode: 0644->0755]
plugins/dali-swig/SWIG/signals.i [changed mode: 0644->0755]
plugins/dali-swig/examples/control-dashboard.cs
plugins/dali-swig/examples/dali-test.cs
plugins/dali-swig/examples/hello-world.cs
plugins/dali-swig/examples/image-view.cs
plugins/dali-swig/examples/json-loader.cs
plugins/dali-swig/examples/scroll-view.cs
plugins/dali-swig/examples/visuals-example.cs [changed mode: 0644->0755]
plugins/dali-swig/examples/visuals-using-custom-view/visuals-using-custom-view.cs [changed mode: 0644->0755]
plugins/dali-swig/manual/cpp/devel-property-wrap.cpp
plugins/dali-swig/manual/csharp/Color.cs [changed mode: 0644->0755]
plugins/dali-swig/manual/csharp/DaliEnumConstants.cs
plugins/dali-swig/manual/csharp/ManualPINVOKE.cs
plugins/dali-swig/manual/csharp/Position.cs [changed mode: 0644->0755]
plugins/dali-swig/manual/csharp/Position2D.cs [new file with mode: 0755]
plugins/dali-swig/manual/csharp/Size.cs [changed mode: 0644->0755]
plugins/dali-swig/manual/csharp/Size2D.cs [new file with mode: 0755]
plugins/dali-swig/manual/csharp/ViewRegistry.cs [changed mode: 0644->0755]
plugins/dali-swig/manual/csharp/ViewWrapperImpl.cs

diff --git a/automated-tests/resources/broken.png b/automated-tests/resources/broken.png
new file mode 100644 (file)
index 0000000..2d1c272
Binary files /dev/null and b/automated-tests/resources/broken.png differ
diff --git a/automated-tests/resources/button-up.9.png b/automated-tests/resources/button-up.9.png
new file mode 100644 (file)
index 0000000..a2e2e01
Binary files /dev/null and b/automated-tests/resources/button-up.9.png differ
index c7a1b8b..9b8bd63 100755 (executable)
@@ -18,6 +18,7 @@ SET(TC_SOURCES
    utc-Dali-FlexContainer.cpp
    utc-Dali-GaussianBlurView.cpp
    utc-Dali-ImageView.cpp
+   utc-Dali-ImageVisual.cpp
    utc-Dali-JsonParser.cpp
    utc-Dali-KeyInputFocusManager.cpp
    utc-Dali-PageTurnView.cpp
index b809b87..0f037d3 100644 (file)
 #include <climits>
 #include <cstdio>
 #include <unistd.h>
-
-namespace Dali
-{
+#include <vector>
+#include <algorithm>
 
 namespace
 {
-EventThreadCallback* gEventThreadCallback = NULL;
+// Note, this is not thread safe - however, should not be using
+// triggers from multiple threads - they should all be created on
+// event thread.
+std::vector<Dali::EventThreadCallback*> gEventThreadCallbacks;
 }
 
+
+namespace Dali
+{
+
 struct EventThreadCallback::Impl
 {
   CallbackBase* callback;
-  unsigned int triggeredCount;
-  unsigned int expectedCount;
   sem_t mySemaphore;
 };
 
@@ -46,38 +50,42 @@ EventThreadCallback::EventThreadCallback( CallbackBase* callback )
 : mImpl( new Impl() )
 {
   mImpl->callback = callback;
-  mImpl->triggeredCount = 0u;
-  mImpl->expectedCount = UINT_MAX;
   sem_init( &(mImpl->mySemaphore), 0, 0 );
-  gEventThreadCallback = this;
+
+  gEventThreadCallbacks.push_back(this);
 }
 
 EventThreadCallback::~EventThreadCallback()
 {
+  std::vector<EventThreadCallback*>::iterator iter =
+    std::find(gEventThreadCallbacks.begin(), gEventThreadCallbacks.end(), this);
+  if( iter != gEventThreadCallbacks.end() )
+  {
+    gEventThreadCallbacks.erase(iter);
+  }
   delete mImpl;
 }
 
 void EventThreadCallback::Trigger()
 {
-  mImpl->triggeredCount++;
-  if(  mImpl->triggeredCount >= mImpl->expectedCount )
-  {
-    sem_post( &(mImpl->mySemaphore) );
-  }
+  sem_post( &(mImpl->mySemaphore) );
 }
 
-bool EventThreadCallback::WaitingForTrigger(unsigned int count, unsigned int seconds)
+// returns true if timed out rather than triggered
+bool EventThreadCallback::WaitingForTrigger()
 {
-  if(  mImpl->triggeredCount >= count )
-  {
-    return true;
-  }
   struct timespec now;
   clock_gettime( CLOCK_REALTIME, &now );
-  now.tv_sec += seconds;
-  mImpl->expectedCount = count;
+  if( now.tv_nsec < 999900000 ) // 999, 900, 000
+    now.tv_nsec += 100000;
+  else
+  {
+    now.tv_sec += 1;
+    now.tv_nsec = 0;
+  }
+
   int error = sem_timedwait( &(mImpl->mySemaphore), &now );
-  return error != 0;
+  return error != 0; // true if timeout
 }
 
 CallbackBase* EventThreadCallback::GetCallback()
@@ -85,19 +93,14 @@ CallbackBase* EventThreadCallback::GetCallback()
   return mImpl->callback;
 }
 
-EventThreadCallback* EventThreadCallback::Get()
-{
-  return gEventThreadCallback;
 }
 
-}
 
 namespace Test
 {
 
 bool WaitForEventThreadTrigger( int triggerCount )
 {
-  bool success = true;
   const int TEST_TIMEOUT(30);
 
   struct timespec startTime;
@@ -106,23 +109,31 @@ bool WaitForEventThreadTrigger( int triggerCount )
   now.tv_sec = startTime.tv_sec;
   now.tv_nsec = startTime.tv_nsec;
 
-  Dali::EventThreadCallback* eventTrigger = NULL;
-  while( eventTrigger == NULL )
+  // Round robin poll of each semaphore:
+  while ( triggerCount > 0 )
   {
-    eventTrigger = Dali::EventThreadCallback::Get();
+    if( gEventThreadCallbacks.size() > 0 )
+    {
+      for( std::vector<Dali::EventThreadCallback*>::iterator iter = gEventThreadCallbacks.begin();
+           iter != gEventThreadCallbacks.end(); ++iter )
+      {
+        Dali::EventThreadCallback* eventTrigger = (*iter);
+        Dali::CallbackBase* callback = eventTrigger->GetCallback();
+        bool timedout = eventTrigger->WaitingForTrigger();
+        if( ! timedout )
+        {
+          // Semaphore was unlocked - execute the trigger
+          Dali::CallbackBase::Execute( *callback );
+          triggerCount--;
+        }
+      }
+    }
     clock_gettime( CLOCK_REALTIME, &now );
     if( now.tv_sec - startTime.tv_sec > TEST_TIMEOUT )
     {
-      success = false;
+      // Ensure we break out of the loop if elapsed time has passed
       break;
     }
-    usleep(10);
-  }
-  if( eventTrigger != NULL )
-  {
-    Dali::CallbackBase* callback = eventTrigger->GetCallback();
-    eventTrigger->WaitingForTrigger( triggerCount, TEST_TIMEOUT - (now.tv_sec - startTime.tv_sec) );
-    Dali::CallbackBase::Execute( *callback );
   }
 
   clock_gettime( CLOCK_REALTIME, &now );
@@ -130,7 +141,7 @@ bool WaitForEventThreadTrigger( int triggerCount )
   {
     fprintf(stderr, "WaitForEventThreadTrigger took %ld seconds\n", now.tv_sec - startTime.tv_sec );
   }
-  return success;
+  return triggerCount == 0;
 }
 
 }
index a0303be..1ae27d2 100644 (file)
@@ -36,12 +36,10 @@ public:
 
   void Trigger();
 
-  bool WaitingForTrigger(unsigned int count, unsigned int seconds );
+  bool WaitingForTrigger();
 
   CallbackBase* GetCallback();
 
-  static EventThreadCallback* Get();
-
 private:
 
   // undefined copy constructor.
index f6164fb..cca026f 100644 (file)
@@ -467,7 +467,7 @@ int UtcDaliImageAtlasImageView(void)
   application.GetPlatform().SetClosestImageSize(  Vector2(100, 100) );
   Stage::GetCurrent().Add( imageView3 );
 
-  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   application.SendNotification();
   application.Render(RENDER_FRAME_INTERVAL);
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp
new file mode 100644 (file)
index 0000000..fd94447
--- /dev/null
@@ -0,0 +1,845 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <toolkit-timer.h>
+#include <toolkit-bitmap-loader.h>
+#include <toolkit-event-thread-callback.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/shader.h>
+#include <dali/devel-api/images/nine-patch-image.h>
+#include <dali/devel-api/object/handle-devel.h>
+#include <dali-toolkit/devel-api/align-enums.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include "dummy-control.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void dali_image_visual_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void dali_image_visual_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+namespace
+{
+const char* TEST_IMAGE_FILE_NAME =  TEST_RESOURCE_DIR  "/gallery_small-1.jpg";
+const char* TEST_LARGE_IMAGE_FILE_NAME =  TEST_RESOURCE_DIR "/tbcol.png";
+const char* TEST_SMALL_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/icon-edit.png";
+const char* TEST_REMOTE_IMAGE_FILE_NAME = "https://www.tizen.org/sites/all/themes/tizen_theme/logo.png";
+}
+
+
+Actor CreateActorWithImageVisual(const Property::Map& map)
+{
+  VisualFactory factory = VisualFactory::Get();
+  DummyControl actor = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  Visual::Base visual = factory.CreateVisual( map );
+  DALI_TEST_CHECK( visual );
+  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  actor.SetSize( 200.f, 200.f );
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+  return actor;
+}
+
+void TestVisualRender( ToolkitTestApplication& application,
+                       DummyControl& actor,
+                       Visual::Base& visual,
+                       std::size_t expectedSamplers = 0,
+                       ImageDimensions imageDimensions = ImageDimensions(),
+                       Integration::ResourcePointer resourcePtr = Integration::ResourcePointer())
+{
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+
+  if( resourcePtr )
+  {
+    // set the image size, for test case, this needs to be set before loading started
+    application.GetPlatform().SetClosestImageSize(  Vector2(imageDimensions.GetWidth(), imageDimensions.GetHeight()) );
+  }
+
+  actor.SetSize( 200.f, 200.f );
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+  Stage::GetCurrent().Add( actor );
+
+  application.SendNotification(); // Send messages to update
+  application.Render();           // process update and render
+  application.SendNotification(); // process any signals to event
+
+  if( resourcePtr )
+  {
+    DALI_TEST_EQUALS( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceSynchronouslyFunc ), true, TEST_LOCATION);
+  }
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+}
+
+static void TestMixColor( Visual::Base visual, Property::Index mixColorIndex, const Vector4& testColor )
+{
+  Property::Map map;
+  visual.CreatePropertyMap(map);
+  Property::Value* value = map.Find( mixColorIndex );
+  DALI_TEST_CHECK( value );
+  Vector3 mixColor1;
+  DALI_TEST_CHECK( value->Get( mixColor1 ) );
+  DALI_TEST_EQUALS( mixColor1, Vector3(testColor), 0.001, TEST_LOCATION );
+
+  value = map.Find( DevelVisual::Property::MIX_COLOR );
+  DALI_TEST_CHECK( value );
+  Vector4 mixColor2;
+  DALI_TEST_CHECK( value->Get( mixColor2 ) );
+  DALI_TEST_EQUALS( mixColor2, testColor, 0.001, TEST_LOCATION );
+
+  value = map.Find( DevelVisual::Property::OPACITY );
+  DALI_TEST_CHECK( value );
+  float opacity;
+  DALI_TEST_CHECK( value->Get( opacity ) );
+  DALI_TEST_EQUALS( opacity, testColor.a, 0.001, TEST_LOCATION );
+}
+
+
+
+int UtcDaliImageVisualPropertyMap(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request image visual with a Property::Map" );
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL,  TEST_LARGE_IMAGE_FILE_NAME );
+
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+  DALI_TEST_CHECK( visual );
+
+  // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
+  // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
+  DummyControl actor = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+
+  actor.SetSize( 200.f, 200.f );
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+  Stage::GetCurrent().Add( actor );
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+
+  Stage::GetCurrent().Remove( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+
+int UtcDaliImageVisualRemoteImageLoad(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request remote image visual with a Property::Map" );
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL,  TEST_REMOTE_IMAGE_FILE_NAME );
+
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+  DALI_TEST_CHECK( visual );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
+  DummyControl actor = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+
+  actor.SetSize( 200.f, 200.f );
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+  Stage::GetCurrent().Add( actor );
+  application.SendNotification();
+
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+
+  Stage::GetCurrent().Remove( actor );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualTextureReuse1(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request remote image visual with a Property::Map; request a second visual with the same property map - should reuse texture" );
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+  TraceCallStack& drawTrace = gl.GetDrawTrace();
+  drawTrace.Enable(true);
+
+  Actor actor = CreateActorWithImageVisual( propertyMap );
+  Stage::GetCurrent().Add( actor );
+  application.SendNotification();
+
+  // Wait for image to load
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
+  textureTrace.Reset();
+  drawTrace.Reset();
+
+  Actor actor2 = CreateActorWithImageVisual( propertyMap );
+  Stage::GetCurrent().Add(actor2);
+
+  application.SendNotification(); // Send messages to update
+  application.Render();           // process update and render
+  application.SendNotification(); // process any signals to event
+
+  DALI_TEST_EQUALS( actor2.GetRendererCount(), 1u, TEST_LOCATION );
+
+  tet_infoline("Test that 2 draw calls occur with no new texture gens/binds, i.e. both\n"
+               "draw calls use the same texture as the previous draw call\n" );
+
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("BindTexture"), 0, TEST_LOCATION );
+
+  tet_infoline("Test that removing 1 actor doesn't delete the texture\n");
+
+  Stage::GetCurrent().Remove( actor );
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+
+  tet_infoline("Test that removing last actor does delete the texture\n");
+
+  Stage::GetCurrent().Remove( actor2 );
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( actor2.GetRendererCount() == 0u );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliImageVisualTextureReuse2(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request remote image visual with a Property::Map; request a second visual with the same url but different property map - should create new texture" );
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+  TraceCallStack& drawTrace = gl.GetDrawTrace();
+  drawTrace.Enable(true);
+
+  Actor actor = CreateActorWithImageVisual( propertyMap );
+  Stage::GetCurrent().Add( actor );
+  application.SendNotification();
+
+  // Wait for image to load
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
+  textureTrace.Reset();
+  drawTrace.Reset();
+
+  propertyMap.Insert( ImageVisual::Property::SAMPLING_MODE, Dali::SamplingMode::NEAREST );
+  propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 100 );
+  propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 100 );
+  Actor actor2 = CreateActorWithImageVisual( propertyMap );
+  Stage::GetCurrent().Add(actor2);
+
+  application.SendNotification();
+
+  // Wait for image to load
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor2.GetRendererCount(), 1u, TEST_LOCATION );
+
+  tet_infoline("Test that 2 draw calls occur with 1 new texture gen/bind, i.e. both "
+               "renderers are using different textures\n" );
+
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("BindTexture"), 2, TEST_LOCATION );
+
+  tet_infoline("Test that removing 1 actor deletes it's texture\n");
+
+  Stage::GetCurrent().Remove( actor );
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
+
+  tet_infoline("Test that removing last actor deletes it's texture\n");
+
+  Stage::GetCurrent().Remove( actor2 );
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( actor2.GetRendererCount() == 0u );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 2, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliImageVisualImageHandle(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request image visual with an image handle" );
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
+  Visual::Base visual = factory.CreateVisual( image );
+
+  // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
+  // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
+
+  const int width=512;
+  const int height=513;
+
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
+  DummyControl actor = DummyControl::New();
+  TestVisualRender( application, actor, visual, 1u,
+                    ImageDimensions(width, height),
+                    Integration::ResourcePointer(bitmap) );
+
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliImageVisualCustomWrapModePixelArea(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area with atlasing" );
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  // Test wrap mode with atlasing. Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
+  const int width=34;
+  const int height=34;
+  const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL, TEST_SMALL_IMAGE_FILE_NAME );
+  propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
+  propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
+  propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
+  propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
+  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
+  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
+  propertyMap.Insert( DevelImageVisual::Property::ATLASING, true );
+
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+  DALI_TEST_CHECK( visual );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+  TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
+  texParameterTrace.Enable( true );
+
+  DummyControl actor = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  actor.SetSize(2000, 2000);
+  actor.SetParentOrigin(ParentOrigin::CENTER);
+  Stage::GetCurrent().Add( actor );
+
+  // loading started
+  application.SendNotification();
+  application.Render();
+
+  BitmapLoader loader = BitmapLoader::GetLatestCreated();
+  DALI_TEST_CHECK( loader );
+  loader.WaitForLoading();// waiting until the image to be loaded
+  DALI_TEST_CHECK( loader.IsLoaded() );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+
+  // WITH atlasing, the wrapping is handled manually in shader, so the following gl function should not be called
+  std::stringstream out;
+  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
+  DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+  out.str("");
+  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
+  DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+
+  // test the uniforms which used to handle the wrap mode
+  Renderer renderer = actor.GetRendererAt( 0u );
+  DALI_TEST_CHECK( renderer );
+
+  Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
+  DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
+  Vector4 pixelAreaUniform;
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
+  DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  Property::Value wrapModeValue = renderer.GetProperty( renderer.GetPropertyIndex( "wrapMode" ) );
+  Vector2 wrapMode( WrapMode::MIRRORED_REPEAT-1, WrapMode::REPEAT-1 );
+  DALI_TEST_EQUALS( wrapModeValue.Get<Vector2>(), wrapMode, TEST_LOCATION );
+  Vector2 wrapModeUniform;
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector2>( "wrapMode", wrapModeUniform ) );
+  DALI_TEST_EQUALS( wrapMode, wrapModeUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  actor.Unparent( );
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualCustomWrapModeNoAtlas(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area without atlasing" );
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  // Test wrap mode without atlasing. Image with a size bigger than 512*512 will NOT be uploaded as a part of the atlas.
+  const int width=600;
+  const int height=600;
+  const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
+  propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
+  propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
+  propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
+  propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
+  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
+  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
+
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+  DALI_TEST_CHECK( visual );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+  TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
+  texParameterTrace.Enable( true );
+
+  DummyControl actor = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+  actor.SetSize(2000, 2000);
+  actor.SetParentOrigin(ParentOrigin::CENTER);
+  Stage::GetCurrent().Add( actor );
+
+  // loading started
+  application.SendNotification();
+  application.Render();
+
+  BitmapLoader loader = BitmapLoader::GetLatestCreated();
+  DALI_TEST_CHECK( loader );
+  loader.WaitForLoading();// waiting until the image to be loaded
+  DALI_TEST_CHECK( loader.IsLoaded() );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+
+  // WITHOUT atlasing, the wrapping is handled by setting gl texture parameters
+  std::stringstream out;
+  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
+  DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+  out.str("");
+  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
+  DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+
+  // test the uniforms which used to handle the wrap mode
+  Renderer renderer = actor.GetRendererAt( 0u );
+  DALI_TEST_CHECK( renderer );
+
+  Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
+  DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
+  Vector4 pixelAreaUniform;
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
+  DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+  Property::Index wrapModeIndex = renderer.GetPropertyIndex( "wrapMode" );
+  DALI_TEST_CHECK(wrapModeIndex == Property::INVALID_INDEX);
+
+  actor.Unparent();
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualAnimateMixColor(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Animate mix color" );
+
+  application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
+
+  VisualFactory factory = VisualFactory::Get();
+  Property::Map propertyMap;
+  propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+  propertyMap.Insert("mixColor", Color::BLUE);
+  propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+
+  DummyControl actor = DummyControl::New(true);
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+  actor.SetSize(2000, 2000);
+  actor.SetParentOrigin(ParentOrigin::CENTER);
+  actor.SetColor(Color::BLACK);
+  Stage::GetCurrent().Add(actor);
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  Renderer renderer = actor.GetRendererAt(0);
+  Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
+  Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
+
+  tet_infoline("Test that the renderer has the mixColor property");
+  DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+
+  const Vector4 TARGET_MIX_COLOR( 1.0f, 0.0f, 0.0f, 0.5f );
+
+  Property::Map map;
+  map["target"] = "testVisual";
+  map["property"] = "mixColor";
+  map["initialValue"] = Color::MAGENTA;
+  map["targetValue"] = TARGET_MIX_COLOR;
+  map["animator"] = Property::Map()
+    .Add("alphaFunction", "LINEAR")
+    .Add("timePeriod", Property::Map()
+         .Add("delay", 0.0f)
+         .Add("duration", 4.0f));
+
+  Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+  Animation animation = dummyImpl.CreateTransition( transition );
+
+  blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+  animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
+  animation.Play();
+
+  application.SendNotification();
+  application.Render(0); // Ensure animation starts
+  application.Render(2000u); // Halfway point
+  Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f );
+
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a), true, TEST_LOCATION );
+
+  application.Render(2000u); // Halfway point between blue and white
+
+  DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a), true, TEST_LOCATION );
+
+  TestMixColor( visual, DevelVisual::Property::MIX_COLOR, TARGET_MIX_COLOR );
+
+  blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualAnimateOpacity(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Animate image visual opacity" );
+
+  application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
+
+  VisualFactory factory = VisualFactory::Get();
+  Property::Map propertyMap;
+  propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+  propertyMap.Insert("opacity", 0.5f);
+  propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+
+  DummyControl actor = DummyControl::New(true);
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+  actor.SetSize(2000, 2000);
+  actor.SetParentOrigin(ParentOrigin::CENTER);
+  actor.SetColor(Color::BLACK);
+  Stage::GetCurrent().Add(actor);
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  Renderer renderer = actor.GetRendererAt(0);
+  tet_infoline("Test that the renderer has the opacity property");
+  Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
+  DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+
+
+  Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+  {
+    tet_infoline( "Test that the opacity can be increased to full via animation, and that the blend mode is set appropriately at the start and end of the animation." );
+
+    Property::Map map;
+    map["target"] = "testVisual";
+    map["property"] = "opacity";
+    map["targetValue"] = 1.0f;
+    map["animator"] = Property::Map()
+      .Add("alphaFunction", "LINEAR")
+      .Add("timePeriod", Property::Map()
+           .Add("delay", 0.0f)
+           .Add("duration", 4.0f));
+
+    Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+    Animation animation = dummyImpl.CreateTransition( transition );
+    animation.Play();
+
+    application.SendNotification();
+    application.Render(0);     // Ensure animation starts
+    application.Render(2000u); // Halfway point through animation
+    application.SendNotification(); // Handle any signals
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.75f), true, TEST_LOCATION );
+
+    application.Render(2001u); // end
+    application.SendNotification(); // ensure animation finished signal is sent
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 1.0f), true, TEST_LOCATION );
+
+    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
+  }
+
+
+  {
+    tet_infoline( "Test that the opacity can be reduced via animation, and that the blend mode is set appropriately at the start and end of the animation." );
+
+    Property::Map map;
+    map["target"] = "testVisual";
+    map["property"] = DevelVisual::Property::OPACITY;
+    map["targetValue"] = 0.1f;
+    map["animator"] = Property::Map()
+      .Add("alphaFunction", "LINEAR")
+      .Add("timePeriod", Property::Map()
+           .Add("delay", 0.0f)
+           .Add("duration", 4.0f));
+
+    Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+    Animation animation = dummyImpl.CreateTransition( transition );
+    animation.Play();
+
+    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+    application.SendNotification();
+    application.Render(0);     // Ensure animation starts
+    application.Render(2000u); // Halfway point
+    application.SendNotification();
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.55f), true, TEST_LOCATION );
+
+    application.Render(2016u); // end
+    application.SendNotification();
+
+    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.1f), true, TEST_LOCATION );
+
+    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+  }
+
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualAnimatePixelArea(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "ImageVisual animate pixel area" );
+
+  application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
+
+  VisualFactory factory = VisualFactory::Get();
+  Property::Map propertyMap;
+  propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+  propertyMap.Insert("mixColor", Color::BLUE);
+  propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+
+  DummyControl actor = DummyControl::New(true);
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+  actor.SetSize(2000, 2000);
+  actor.SetParentOrigin(ParentOrigin::CENTER);
+  actor.SetColor(Color::BLACK);
+  Stage::GetCurrent().Add(actor);
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  Renderer renderer = actor.GetRendererAt(0);
+  Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
+
+  tet_infoline("Test that the renderer has the mixColor property");
+  DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+
+  // TransitionData only takes string keys
+  Property::Map map;
+  map["target"] = "testVisual";
+  map["property"] = "pixelArea";
+  map["initialValue"] = Vector4( 0,0,0,1 );
+  map["targetValue"] = Vector4( 0,0,1,1 ); // Animate width from zero to full
+  map["animator"] = Property::Map()
+    .Add("alphaFunction", "LINEAR")
+    .Add("timePeriod", Property::Map()
+         .Add("delay", 0.0f)
+         .Add("duration", 4.0f));
+
+  Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+  Animation animation = dummyImpl.CreateTransition( transition );
+  animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
+  animation.Play();
+
+  application.SendNotification();
+  application.Render(0);     // Ensure animation starts
+  application.Render(2000u); // Halfway point
+
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4(0.0f, 0.0f, 0.5f, 1.0f )), true, TEST_LOCATION );
+
+  application.Render(2000u); // End of animation
+
+  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4( 0.0f, 0.0f, 1.0f, 1.0f )), true, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualTextureCancelRemoteLoad(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Request remote image visual, then destroy visual to cancel load" );
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+  TraceCallStack& drawTrace = gl.GetDrawTrace();
+  drawTrace.Enable(true);
+
+  Actor actor = CreateActorWithImageVisual( propertyMap );
+  Stage::GetCurrent().Add( actor );
+  application.SendNotification();
+
+  Stage::GetCurrent().Remove( actor );
+  application.SendNotification();
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), false, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION );
+
+  END_TEST;
+}
index 9e00636..5cd0063 100644 (file)
@@ -553,6 +553,59 @@ int UtcDaliToolkitTextlabelScrollingP(void)
   END_TEST;
 }
 
+int UtcDaliToolkitTextlabelScrollingInterruptedP(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitTextlabelScrollingInterruptedP");
+  TextLabel label = TextLabel::New("Some text to scroll");
+  DALI_TEST_CHECK( label );
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+  Stage::GetCurrent().Add( label );
+  label.SetSize( 360.0f, 20.f );
+  // Turn on all the effects
+  label.SetProperty( TextLabel::Property::MULTI_LINE, false );
+  label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f );
+  label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 );
+  label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f );
+
+  // Render the text.
+  application.SendNotification();
+  application.Render();
+
+  unsigned int actorCount1 = label.GetChildCount();
+  tet_printf("Initial actor count is(%d)\n", actorCount1 );
+
+  try
+  {
+    // Render some text with the shared atlas backend
+    label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
+    application.SendNotification();
+    application.Render(2000);
+
+    unsigned int actorCount1 = label.GetChildCount();
+    tet_printf("Actor count after scrolling is(%d)\n", actorCount1 );
+
+    label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
+
+    // Render the text.
+    application.SendNotification();
+    application.Render();
+
+    unsigned int actorCount2 = label.GetChildCount();
+    tet_printf("After changing color the actor count is(%d)\n", actorCount2 );
+
+    DALI_TEST_EQUALS( actorCount1, actorCount2, TEST_LOCATION );
+
+  }
+  catch( ... )
+  {
+    tet_result(TET_FAIL);
+  }
+
+  END_TEST;
+}
+
 int UtcDaliToolkitTextlabelScrollingN(void)
 {
   ToolkitTestApplication application;
index 9e39e36..80429f4 100644 (file)
@@ -1371,260 +1371,6 @@ int UtcDaliVisualAnimatePrimitiveVisual(void)
   END_TEST;
 }
 
-int UtcDaliVisualAnimateImageVisualMixColor(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliAnimateImageVisual mix color" );
-
-  application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
-
-  VisualFactory factory = VisualFactory::Get();
-  Property::Map propertyMap;
-  propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
-  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-  propertyMap.Insert("mixColor", Color::BLUE);
-  propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-
-  DummyControl actor = DummyControl::New(true);
-  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
-
-  actor.SetSize(2000, 2000);
-  actor.SetParentOrigin(ParentOrigin::CENTER);
-  actor.SetColor(Color::BLACK);
-  Stage::GetCurrent().Add(actor);
-
-  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
-
-  Renderer renderer = actor.GetRendererAt(0);
-  Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
-  Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
-  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
-
-  tet_infoline("Test that the renderer has the mixColor property");
-  DALI_TEST_CHECK( index != Property::INVALID_INDEX );
-
-  const Vector4 TARGET_MIX_COLOR( 1.0f, 0.0f, 0.0f, 0.5f );
-
-  Property::Map map;
-  map["target"] = "testVisual";
-  map["property"] = "mixColor";
-  map["initialValue"] = Color::MAGENTA;
-  map["targetValue"] = TARGET_MIX_COLOR;
-  map["animator"] = Property::Map()
-    .Add("alphaFunction", "LINEAR")
-    .Add("timePeriod", Property::Map()
-         .Add("delay", 0.0f)
-         .Add("duration", 4.0f));
-
-  Dali::Toolkit::TransitionData transition = TransitionData::New( map );
-
-  Animation animation = dummyImpl.CreateTransition( transition );
-
-  blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
-  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
-
-  animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
-  animation.Play();
-
-  application.SendNotification();
-  application.Render(0);
-  application.Render(2000u); // halfway point
-  Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f );
-
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a), true, TEST_LOCATION );
-
-  application.Render(2000u); // halfway point between blue and white
-
-  DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a), true, TEST_LOCATION );
-
-  TestMixColor( visual, DevelVisual::Property::MIX_COLOR, TARGET_MIX_COLOR );
-
-  blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
-  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
-
-  END_TEST;
-}
-
-
-int UtcDaliVisualAnimateImageVisualOpacity(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliAnimateImageVisual mix color" );
-
-  application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
-
-  VisualFactory factory = VisualFactory::Get();
-  Property::Map propertyMap;
-  propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
-  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-  propertyMap.Insert("opacity", 0.5f);
-  propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-
-  DummyControl actor = DummyControl::New(true);
-  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
-
-  actor.SetSize(2000, 2000);
-  actor.SetParentOrigin(ParentOrigin::CENTER);
-  actor.SetColor(Color::BLACK);
-  Stage::GetCurrent().Add(actor);
-
-  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
-
-  Renderer renderer = actor.GetRendererAt(0);
-  tet_infoline("Test that the renderer has the opacity property");
-  Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
-  DALI_TEST_CHECK( index != Property::INVALID_INDEX );
-
-
-  Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
-  DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
-
-  {
-    tet_infoline( "Test that the opacity can be increased to full via animation, and that the blend mode is set appropriately at the start and end of the animation." );
-
-    Property::Map map;
-    map["target"] = "testVisual";
-    map["property"] = "opacity";
-    map["targetValue"] = 1.0f;
-    map["animator"] = Property::Map()
-      .Add("alphaFunction", "LINEAR")
-      .Add("timePeriod", Property::Map()
-           .Add("delay", 0.0f)
-           .Add("duration", 4.0f));
-
-    Dali::Toolkit::TransitionData transition = TransitionData::New( map );
-    Animation animation = dummyImpl.CreateTransition( transition );
-    animation.Play();
-
-    application.SendNotification();
-    application.Render(0);
-    application.Render(2000u); // halfway point
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.75f), true, TEST_LOCATION );
-
-    application.Render(2001u); // end
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 1.0f), true, TEST_LOCATION );
-
-    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
-    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
-  }
-
-
-  {
-    tet_infoline( "Test that the opacity can be reduced via animation, and that the blend mode is set appropriately at the start and end of the animation." );
-
-    Property::Map map;
-    map["target"] = "testVisual";
-    map["property"] = DevelVisual::Property::OPACITY;
-    map["targetValue"] = 0.1f;
-    map["animator"] = Property::Map()
-      .Add("alphaFunction", "LINEAR")
-      .Add("timePeriod", Property::Map()
-           .Add("delay", 0.0f)
-           .Add("duration", 4.0f));
-
-    Dali::Toolkit::TransitionData transition = TransitionData::New( map );
-    Animation animation = dummyImpl.CreateTransition( transition );
-    animation.Play();
-
-    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
-    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
-
-    application.SendNotification();
-    application.Render(0);
-    application.Render(2000u); // halfway point
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.55f), true, TEST_LOCATION );
-
-    application.Render(2016u); // end
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.1f), true, TEST_LOCATION );
-
-    blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
-    DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
-  }
-
-
-  END_TEST;
-}
-
-int UtcDaliVisualAnimateImageVisualPixelArea(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliAnimateImageVisual pixel area" );
-
-  application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
-
-  VisualFactory factory = VisualFactory::Get();
-  Property::Map propertyMap;
-  propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
-  propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-  propertyMap.Insert("mixColor", Color::BLUE);
-  propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-
-  DummyControl actor = DummyControl::New(true);
-  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
-
-  actor.SetSize(2000, 2000);
-  actor.SetParentOrigin(ParentOrigin::CENTER);
-  actor.SetColor(Color::BLACK);
-  Stage::GetCurrent().Add(actor);
-
-  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
-
-  Renderer renderer = actor.GetRendererAt(0);
-  Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
-
-  tet_infoline("Test that the renderer has the mixColor property");
-  DALI_TEST_CHECK( index != Property::INVALID_INDEX );
-
-  // TransitionData only takes string keys
-  Property::Map map;
-  map["target"] = "testVisual";
-  map["property"] = "pixelArea";
-  map["initialValue"] = Vector4( 0,0,0,1 );
-  map["targetValue"] = Vector4( 0,0,1,1 ); // Animate width from zero to full
-  map["animator"] = Property::Map()
-    .Add("alphaFunction", "LINEAR")
-    .Add("timePeriod", Property::Map()
-         .Add("delay", 0.0f)
-         .Add("duration", 4.0f));
-
-  Dali::Toolkit::TransitionData transition = TransitionData::New( map );
-
-  Animation animation = dummyImpl.CreateTransition( transition );
-  animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
-  animation.Play();
-
-  application.SendNotification();
-  application.Render(0);
-  application.Render(2000u); // halfway point
-
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4(0.0f, 0.0f, 0.5f, 1.0f )), true, TEST_LOCATION );
-
-  application.Render(2000u);
-
-  DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4( 0.0f, 0.0f, 1.0f, 1.0f )), true, TEST_LOCATION );
-
-  END_TEST;
-}
-
 
 int UtcDaliVisualWireframeVisual(void)
 {
index 4966804..acf3192 100644 (file)
@@ -38,8 +38,7 @@ namespace
 {
 typedef NinePatchImage::StretchRanges StretchRanges;
 
-const char* TEST_IMAGE_FILE_NAME =  "gallery_image_01.jpg";
-const char* TEST_NPATCH_FILE_NAME =  "gallery_image_01.9.png";
+const char* TEST_NPATCH_FILE_NAME =  TEST_RESOURCE_DIR  "/button-up-1.9.png";
 const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
 const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
 const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
@@ -51,8 +50,7 @@ const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif";
 
 // resolution: 34*34, pixel format: RGBA8888
 static const char* gImage_34_RGBA = TEST_RESOURCE_DIR "/icon-edit.png";
-// resolution: 600*600, pixel format: RGB888
-static const char* gImage_600_RGB = TEST_RESOURCE_DIR "/test-image-600.jpg";
+
 
 Property::Map DefaultTransform()
 {
@@ -592,243 +590,9 @@ int UtcDaliVisualFactoryDefaultOffsetsGradientVisual(void)
   END_TEST;
 }
 
-int UtcDaliVisualFactoryGetImageVisual1(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetImageVisual1: Request image visual with a Property::Map" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  Property::Map propertyMap;
-  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::URL,  TEST_IMAGE_FILE_NAME );
-
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( visual );
-
-  // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
-  // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
-
-  const int width=512;
-  const int height=513;
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = gl.GetTextureTrace();
-  textureTrace.Enable(true);
-
-  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
-  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
-
-  DummyControl actor = DummyControl::New();
-  TestVisualRender( application, actor, visual, 1u,
-                    ImageDimensions(width, height),
-                    Integration::ResourcePointer( bitmap ) );
-
-  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
-
-  Stage::GetCurrent().Remove( actor );
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
-  END_TEST;
-}
-
-int UtcDaliVisualFactoryGetImageVisual2(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetImageVisual2: Request image visual with an image handle" );
 
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
-  Visual::Base visual = factory.CreateVisual( image );
-
-  // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
-  // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
-
-  const int width=512;
-  const int height=513;
-
-  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
-  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = gl.GetTextureTrace();
-  textureTrace.Enable(true);
 
-  DummyControl actor = DummyControl::New();
-  TestVisualRender( application, actor, visual, 1u,
-                    ImageDimensions(width, height),
-                    Integration::ResourcePointer(bitmap) );
-
-  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliVisualFactoryGetImageVisual3(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetImageVisual3: Request image visual with a Property::Map, test custom wrap mode and pixel area with atlasing" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  // Test wrap mode with atlasing. Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
-  const int width=34;
-  const int height=34;
-  const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
-
-  Property::Map propertyMap;
-  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::URL,  gImage_34_RGBA );
-  propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
-  propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
-  propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
-  propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
-  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
-  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
-  propertyMap.Insert( DevelImageVisual::Property::ATLASING, true );
-
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( visual );
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = gl.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
-  texParameterTrace.Enable( true );
-
-  DummyControl actor = DummyControl::New();
-  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-  actor.SetSize(2000, 2000);
-  actor.SetParentOrigin(ParentOrigin::CENTER);
-  Stage::GetCurrent().Add( actor );
-
-  // loading started
-  application.SendNotification();
-  application.Render();
-  application.Render();
-  application.SendNotification();
-  BitmapLoader loader = BitmapLoader::GetLatestCreated();
-  DALI_TEST_CHECK( loader );
-  loader.WaitForLoading();// waiting until the image to be loaded
-  DALI_TEST_CHECK( loader.IsLoaded() );
-
-  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-
-  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
-
-  // WITH atlasing, the wrapping is handled manually in shader, so the following gl function should not be called
-  std::stringstream out;
-  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
-  DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
-  out.str("");
-  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
-  DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
-
-  // test the uniforms which used to handle the wrap mode
-  Renderer renderer = actor.GetRendererAt( 0u );
-  DALI_TEST_CHECK( renderer );
-
-  Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
-  DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
-  Vector4 pixelAreaUniform;
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
-  DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
-
-  Property::Value wrapModeValue = renderer.GetProperty( renderer.GetPropertyIndex( "wrapMode" ) );
-  Vector2 wrapMode( WrapMode::MIRRORED_REPEAT-1, WrapMode::REPEAT-1 );
-  DALI_TEST_EQUALS( wrapModeValue.Get<Vector2>(), wrapMode, TEST_LOCATION );
-  Vector2 wrapModeUniform;
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector2>( "wrapMode", wrapModeUniform ) );
-  DALI_TEST_EQUALS( wrapMode, wrapModeUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
-
-  actor.Unparent( );
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
-  END_TEST;
-}
-
-int UtcDaliVisualFactoryGetImageVisual4(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetImageVisual4: Request image visual with a Property::Map, test custom wrap mode and pixel area without atlasing" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  // Test wrap mode without atlasing. Image with a size bigger than 512*512 will NOT be uploaded as a part of the atlas.
-  const int width=600;
-  const int height=600;
-  const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
-
-  Property::Map propertyMap;
-  propertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::URL,  gImage_600_RGB );
-  propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
-  propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
-  propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
-  propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
-  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
-  propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
-
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( visual );
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = gl.GetTextureTrace();
-  textureTrace.Enable(true);
-  TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
-  texParameterTrace.Enable( true );
-
-  DummyControl actor = DummyControl::New();
-  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-  actor.SetSize(2000, 2000);
-  actor.SetParentOrigin(ParentOrigin::CENTER);
-  Stage::GetCurrent().Add( actor );
-
-  // loading started
-  application.SendNotification();
-  application.Render();
-  application.Render();
-  application.SendNotification();
-  BitmapLoader loader = BitmapLoader::GetLatestCreated();
-  DALI_TEST_CHECK( loader );
-  loader.WaitForLoading();// waiting until the image to be loaded
-  DALI_TEST_CHECK( loader.IsLoaded() );
-
-  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-
-  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
-
-  // WITHOUT atlasing, the wrapping is handled by setting gl texture parameters
-  std::stringstream out;
-  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
-  DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
-  out.str("");
-  out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
-  DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
-
-  // test the uniforms which used to handle the wrap mode
-  Renderer renderer = actor.GetRendererAt( 0u );
-  DALI_TEST_CHECK( renderer );
-
-  Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
-  DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
-  Vector4 pixelAreaUniform;
-  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
-  DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
-
-  Property::Index wrapModeIndex = renderer.GetPropertyIndex( "wrapMode" );
-  DALI_TEST_CHECK(wrapModeIndex == Property::INVALID_INDEX);
-
-  actor.Unparent();
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
-  END_TEST;
-}
 
 int UtcDaliVisualFactoryGetNPatchVisual1(void)
 {
index 0799c9e..c0dd44b 100644 (file)
@@ -28,6 +28,8 @@ toolkit_src_files = \
    $(toolkit_src_dir)/visuals/svg/svg-visual.cpp \
    $(toolkit_src_dir)/visuals/text/text-visual.cpp \
    $(toolkit_src_dir)/visuals/transition-data-impl.cpp \
+   $(toolkit_src_dir)/visuals/texture-manager.cpp \
+   $(toolkit_src_dir)/visuals/texture-upload-observer.cpp \
    $(toolkit_src_dir)/visuals/visual-base-data-impl.cpp \
    $(toolkit_src_dir)/visuals/visual-base-impl.cpp \
    $(toolkit_src_dir)/visuals/visual-factory-cache.cpp \
index 1fbef38..8454992 100644 (file)
@@ -49,7 +49,7 @@ IntrusivePtr<AsyncImageLoader> AsyncImageLoader::New()
   return internal;
 }
 
-uint32_t AsyncImageLoader::Load( const std::string& url,
+uint32_t AsyncImageLoader::Load( const VisualUrl& url,
                                  ImageDimensions dimensions,
                                  FittingMode::Type fittingMode,
                                  SamplingMode::Type samplingMode,
@@ -83,7 +83,7 @@ void AsyncImageLoader::CancelAll()
 
 void AsyncImageLoader::ProcessLoadedImage()
 {
-  while( LoadingTask *next =  mLoadThread.NextCompletedTask() )
+  while( LoadingTask *next = mLoadThread.NextCompletedTask() )
   {
     mLoadedSignal.Emit( next->id, next->pixelData );
     delete next;
index 92a1652..fe4c73b 100644 (file)
@@ -51,7 +51,7 @@ public:
   /**
    * @copydoc Toolkit::AsyncImageLoader::Load( const std::string&, ImageDimensions, FittingMode::Type, SamplingMode::Type, bool )
    */
-  uint32_t Load( const std::string& url,
+  uint32_t Load( const VisualUrl& url,
                  ImageDimensions dimensions,
                  FittingMode::Type fittingMode,
                  SamplingMode::Type samplingMode,
@@ -85,14 +85,11 @@ protected:
   ~AsyncImageLoader();
 
 private:
-
   Toolkit::AsyncImageLoader::ImageLoadedSignalType mLoadedSignal;
 
   ImageLoadThread mLoadThread;
   uint32_t        mLoadTaskId;
   bool            mIsLoadThreadStarted;
-
-
 };
 
 } // namespace Internal
index d784d3e..30f1ba7 100644 (file)
@@ -21,7 +21,7 @@
 // EXTERNAL INCLUDES
 #include <string.h>
 #include <dali/public-api/signals/callback.h>
-#include <dali/public-api/images/resource-image.h>
+#include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/devel-api/adaptor-framework/bitmap-loader.h>
 #include <dali/integration-api/debug.h>
 
@@ -127,7 +127,7 @@ float ImageAtlas::GetOccupancyRate() const
 
 void ImageAtlas::SetBrokenImage( const std::string& brokenImageUrl )
 {
-  mBrokenImageSize = ResourceImage::GetImageSize( brokenImageUrl );
+  mBrokenImageSize = Dali::GetClosestImageSize( brokenImageUrl );
   if(mBrokenImageSize.GetWidth() > 0 && mBrokenImageSize.GetHeight() > 0 ) // check the url is valid
   {
     mBrokenImageUrl = brokenImageUrl;
@@ -145,7 +145,7 @@ bool ImageAtlas::Upload( Vector4& textureRect,
   ImageDimensions zero;
   if( size == zero ) // image size not provided
   {
-    dimensions = ResourceImage::GetImageSize( url );
+    dimensions = Dali::GetClosestImageSize( url );
     if( dimensions == zero ) // Fail to read the image & broken image file exists
     {
       if( !mBrokenImageUrl.empty() )
index d0b504d..a06953e 100644 (file)
@@ -30,7 +30,7 @@ namespace Toolkit
 namespace Internal
 {
 
-LoadingTask::LoadingTask( uint32_t id, const std::string& url, ImageDimensions dimensions,
+LoadingTask::LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dimensions,
                           FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection )
 : pixelData(),
   url( url ),
@@ -44,7 +44,14 @@ LoadingTask::LoadingTask( uint32_t id, const std::string& url, ImageDimensions d
 
 void LoadingTask::Load()
 {
-  pixelData = Dali::LoadImageFromFile( url, dimensions, fittingMode, samplingMode, orientationCorrection );
+  if( url.IsLocal() )
+  {
+    pixelData = Dali::LoadImageFromFile( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection );
+  }
+  else
+  {
+    pixelData = Dali::DownloadImageSynchronously ( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection );
+  }
 }
 
 
index f46d435..f3d9632 100644 (file)
@@ -26,7 +26,7 @@
 #include <dali/devel-api/threading/mutex.h>
 #include <dali/devel-api/threading/thread.h>
 #include <dali/devel-api/adaptor-framework/event-thread-callback.h>
-
+#include <dali-toolkit/internal/visuals/visual-url.h>
 
 namespace Dali
 {
@@ -51,8 +51,9 @@ struct LoadingTask
    * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
    * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
    */
-  LoadingTask( uint32_t id, const std::string& url, ImageDimensions dimensions,
-               FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection );
+  LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dimensions,
+               FittingMode::Type fittingMode, SamplingMode::Type samplingMode,
+               bool orientationCorrection );
 
   /**
    * Load the image
@@ -69,13 +70,13 @@ private:
 
 public:
 
-  PixelData pixelData;             ///< pixelData handle after successfull load
-  std::string url;                 ///< url of the image to load
-  uint32_t     id;                 ///< The unique id associated with this task.
-  ImageDimensions dimensions;      ///< dimensions to load
-  FittingMode::Type fittingMode;   ///< fitting options
-  SamplingMode::Type samplingMode; ///< sampling options
-  bool orientationCorrection:1;    ///< if orientation correction is needed
+  PixelData          pixelData;     ///< pixelData handle after successfull load
+  VisualUrl          url;           ///< url of the image to load
+  uint32_t           id;            ///< The unique id associated with this task.
+  ImageDimensions    dimensions;    ///< dimensions to load
+  FittingMode::Type  fittingMode;   ///< fitting options
+  SamplingMode::Type samplingMode;  ///< sampling options
+  bool               orientationCorrection:1; ///< if orientation correction is needed
 
 };
 
index 69416c1..6fe86a4 100644 (file)
@@ -451,6 +451,7 @@ struct AtlasRenderer::Impl
         mActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
         mActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
         mActor.SetSize( textSize );
+        mActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
       }
 
       for( std::vector< MeshRecord >::iterator it = meshContainer.begin(),
@@ -567,17 +568,18 @@ struct AtlasRenderer::Impl
     renderer.SetTextures( textureSet );
     renderer.SetProperty( Dali::Renderer::Property::BLEND_MODE, BlendMode::ON );
     renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT + mDepth );
+
     Actor actor = Actor::New();
 #if defined(DEBUG_ENABLED)
     actor.SetName( "Text renderable actor" );
 #endif
     actor.AddRenderer( renderer );
-
     // Keep all of the origins aligned
     actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
     actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
     actor.SetSize( actorSize );
     actor.RegisterProperty("uOffset", Vector2::ZERO );
+    actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
     return actor;
   }
 
index d2f9348..a9a7284 100644 (file)
@@ -51,7 +51,9 @@ const char* VERTEX_SHADER_SCROLL = DALI_COMPOSE_SHADER(
   attribute mediump vec2 aPosition;\n
   varying highp vec2 vTexCoord;\n
   varying highp float vRatio;\n
-  uniform mediump mat4 uMvpMatrix;\n
+  uniform mediump mat4 uModelMatrix;\n
+  uniform mediump mat4 uViewMatrix;\n
+  uniform mediump mat4 uProjection;\n
   uniform mediump vec3 uSize;\n
   uniform mediump float uDelta;\n
   uniform mediump vec2 uTextureSize;
@@ -61,25 +63,29 @@ const char* VERTEX_SHADER_SCROLL = DALI_COMPOSE_SHADER(
   void main()\n
   {\n
     {\n
-      mediump vec4 vertexPosition = vec4(aPosition*uSize.xy, 0.0, 1.0);\n
+      highp vec4 vertexPosition = vec4(aPosition*uSize.xy, 0.0, 1.0);\n
+      vertexPosition = uViewMatrix *  uModelMatrix  * vertexPosition ;\n
+      vertexPosition.x = floor( vertexPosition.x ) + 0.5;
+      vertexPosition.y = floor( vertexPosition.y ) + 0.5;
       float smallTextPadding = max(uSize.x - uTextureSize.x, 0. );\n
       float gap = max( uGap, smallTextPadding );\n
-      vTexCoord.x = ( uDelta + ( uRtl * ( uTextureSize.x - uSize.x ) )  + ( aPosition.x * uSize.x ) )/ ( uTextureSize.x+gap );\n
-      vTexCoord.y = aPosition.y;\n
+      float delta = floor ( uDelta ) + 0.5;
+      vTexCoord.x = ( delta  + ( uRtl * ( uTextureSize.x - uSize.x ) ) + (  aPosition.x * uSize.x ) )/ ( uTextureSize.x + gap );\n
+      vTexCoord.y = ( 0.5 + floor(  aPosition.y * uSize.y ) )/ ( uTextureSize.y ) ;\n
       vRatio = uTextureSize.x / ( uTextureSize.x + gap );\n
-      gl_Position = uMvpMatrix * vertexPosition;\n
+      gl_Position = uProjection * vertexPosition;
     }\n
   }\n
 );
 
 const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vTexCoord;\n
+  varying highp vec2 vTexCoord;\n
   varying highp float vRatio;\n
   uniform sampler2D sTexture;\n
   \n
   void main()\n
   {\n
-    mediump vec2 texCoord;\n
+    highp vec2 texCoord;\n
     texCoord.y = vTexCoord.y;\n
     texCoord.x = fract( vTexCoord.x ) / vRatio;\n
     if ( texCoord.x > 1.0 )\n
@@ -169,7 +175,7 @@ void CreateRenderer( FrameBufferImage frameBufferImage, Dali::Renderer& renderer
   Shader shader = Shader::New( VERTEX_SHADER_SCROLL , FRAGMENT_SHADER, Shader::Hint::NONE );
 
   Sampler sampler = Sampler::New();
-  sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST );
+  sampler.SetFilterMode(FilterMode::LINEAR, FilterMode::LINEAR );
 
   TextureSet textureSet = TextureSet::New();
   TextureSetImage( textureSet, 0u, frameBufferImage );
@@ -268,6 +274,13 @@ void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, co
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters controlSize[%f,%f] offscreenSize[%f,%f] direction[%d] alignmentOffset[%f]\n",
                  controlSize.x, controlSize.y, offScreenSize.x, offScreenSize.y, direction, alignmentOffset );
 
+  CleanUp(); //  If already scrolling then restart with new parameters
+
+  if ( mScrollAnimation )
+  {
+    mScrollAnimation.Clear();
+  }
+
   FrameBufferImage offscreenRenderTargetForText = FrameBufferImage::New( offScreenSize.width, offScreenSize.height, Pixel::RGBA8888 );
   Renderer renderer;
 
index fe01571..d959c1a 100644 (file)
@@ -20,7 +20,7 @@
 
 // EXTERNAL HEADER
 #include <dali/devel-api/images/texture-set-image.h>
-#include <dali/public-api/images/resource-image.h>
+#include <dali/devel-api/adaptor-framework/image-loading.h>
 
 namespace Dali
 {
@@ -58,7 +58,7 @@ TextureSet ImageAtlasManager::Add( Vector4& textureRect,
   ImageDimensions zero;
   if( size == zero )
   {
-    dimensions = ResourceImage::GetImageSize( url );
+    dimensions = Dali::GetClosestImageSize( url );
   }
 
   // big image, atlasing is not applied
index 3c82d75..06a9601 100644 (file)
@@ -34,6 +34,7 @@
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/internal/visuals/texture-manager.h>
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
@@ -261,11 +262,13 @@ ImageVisual::ImageVisual( VisualFactoryCache& factoryCache,
   mPlacementActor(),
   mImageUrl( imageUrl ),
   mDesiredSize( size ),
+  mTextureId( TextureManager::INVALID_TEXTURE_ID ),
   mFittingMode( fittingMode ),
   mSamplingMode( samplingMode ),
   mWrapModeU( WrapMode::DEFAULT ),
   mWrapModeV( WrapMode::DEFAULT ),
-  mAttemptAtlasing( false )
+  mAttemptAtlasing( false ),
+  mTextureLoading( false )
 {
 }
 
@@ -277,11 +280,13 @@ ImageVisual::ImageVisual( VisualFactoryCache& factoryCache, const Image& image )
   mPlacementActor(),
   mImageUrl(),
   mDesiredSize(),
+  mTextureId( TextureManager::INVALID_TEXTURE_ID ),
   mFittingMode( FittingMode::DEFAULT ),
   mSamplingMode( SamplingMode::DEFAULT ),
   mWrapModeU( WrapMode::DEFAULT ),
   mWrapModeV( WrapMode::DEFAULT ),
-  mAttemptAtlasing( false )
+  mAttemptAtlasing( false ),
+  mTextureLoading( false )
 {
 }
 
@@ -465,16 +470,16 @@ void ImageVisual::GetNaturalSize( Vector2& naturalSize )
   }
   else if( mImageUrl.IsValid() && mImageUrl.GetLocation() == VisualUrl::LOCAL )
   {
-    ImageDimensions dimentions = Dali::GetClosestImageSize( mImageUrl.GetUrl() );
-    naturalSize.x = dimentions.GetWidth();
-    naturalSize.y = dimentions.GetHeight();
+    ImageDimensions dimensions = Dali::GetClosestImageSize( mImageUrl.GetUrl() );
+    naturalSize.x = dimensions.GetWidth();
+    naturalSize.y = dimensions.GetHeight();
     return;
   }
 
   naturalSize = Vector2::ZERO;
 }
 
-void ImageVisual::CreateRenderer( TextureSet& textures )
+void ImageVisual::CreateRenderer( TextureSet& textureSet )
 {
   Geometry geometry;
   Shader shader;
@@ -509,8 +514,11 @@ void ImageVisual::CreateRenderer( TextureSet& textures )
   shader.RegisterProperty( PIXEL_ALIGNED_UNIFORM_NAME, PIXEL_ALIGN_ON ); // Set default to align
 
   mImpl->mRenderer = Renderer::New( geometry, shader );
-  DALI_ASSERT_DEBUG( textures );
-  mImpl->mRenderer.SetTextures( textures );
+  if( textureSet )
+  {
+    mImpl->mRenderer.SetTextures( textureSet );
+  }
+  // else still waiting for texture load to finish.
 
   //Register transform properties
   mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
@@ -583,12 +591,16 @@ void ImageVisual::LoadResourceSynchronously()
     BitmapLoader loader = BitmapLoader::New( mImageUrl.GetUrl(), mDesiredSize, mFittingMode, mSamplingMode );
     loader.Load();
     mPixels = loader.GetPixelData();
+    mTextureLoading = false;
   }
 }
 
 TextureSet ImageVisual::CreateTextureSet( Vector4& textureRect, bool synchronousLoading, bool attemptAtlasing )
 {
   TextureSet textureSet;
+
+  mTextureLoading = false;
+
   textureRect = FULL_TEXTURE_RECT;
   if( synchronousLoading )
   {
@@ -622,23 +634,34 @@ TextureSet ImageVisual::CreateTextureSet( Vector4& textureRect, bool synchronous
     {
       textureSet = mFactoryCache.GetAtlasManager()->Add( textureRect, mImageUrl.GetUrl(), mDesiredSize, mFittingMode, true, this );
       mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
+      mTextureLoading = true;
     }
     if( !textureSet ) // big image, no atlasing or atlasing failed
     {
       mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
-      ResourceImage resourceImage = Dali::ResourceImage::New( mImageUrl.GetUrl(), mDesiredSize, mFittingMode, mSamplingMode );
-      resourceImage.LoadingFinishedSignal().Connect( this, &ImageVisual::OnImageLoaded );
-      textureSet = TextureSet::New();
-      TextureSetImage( textureSet, 0u, resourceImage );
+      TextureManager& textureManager = mFactoryCache.GetTextureManager();
+      mTextureId = textureManager.RequestLoad( mImageUrl, mDesiredSize, mFittingMode,
+                                               mSamplingMode, TextureManager::NO_ATLAS, this );
+
+      TextureManager::LoadState loadState = textureManager.GetTextureState( mTextureId );
+
+      mTextureLoading = ( loadState == TextureManager::LOADING );
+
+      if( loadState == TextureManager::UPLOADED )
+      {
+        // UploadComplete has already been called - keep the same texture set
+        textureSet = textureManager.GetTextureSet(mTextureId);
+      }
     }
   }
 
-  if( !(mImpl->mFlags & Impl::IS_ATLASING_APPLIED) )
+  if( ! (mImpl->mFlags & Impl::IS_ATLASING_APPLIED) && textureSet )
   {
     Sampler sampler = Sampler::New();
     sampler.SetWrapMode(  mWrapModeU, mWrapModeV  );
     textureSet.SetSampler( 0u, sampler );
   }
+
   return textureSet;
 }
 
@@ -646,7 +669,7 @@ void ImageVisual::InitializeRenderer()
 {
   mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
 
-  if( !mImpl->mCustomShader && mImageUrl.GetLocation() == VisualUrl::LOCAL )
+  if( ! mImpl->mCustomShader && mImageUrl.GetLocation() == VisualUrl::LOCAL )
   {
     bool defaultWrapMode = mWrapModeU <= WrapMode::CLAMP_TO_EDGE && mWrapModeV <= WrapMode::CLAMP_TO_EDGE;
 
@@ -697,18 +720,6 @@ void ImageVisual::InitializeRenderer( const Image& image )
   ApplyImageToSampler( image );
 }
 
-void ImageVisual::UploadCompleted()
-{
-  // Resource image is loaded. If weak handle is holding a placement actor, it is the time to add the renderer to actor.
-  Actor actor = mPlacementActor.GetHandle();
-  if( actor )
-  {
-    actor.AddRenderer( mImpl->mRenderer );
-    // reset the weak handle so that the renderer only get added to actor once
-    mPlacementActor.Reset();
-  }
-}
-
 void ImageVisual::DoSetOnStage( Actor& actor )
 {
   if( mImageUrl.IsValid() )
@@ -726,7 +737,6 @@ void ImageVisual::DoSetOnStage( Actor& actor )
   }
 
   mPlacementActor = actor;
-
   // Search the Actor tree to find if Layer UI behaviour set.
   Layer layer = actor.GetLayer();
   if ( layer && layer.GetBehavior() == Layer::LAYER_3D )
@@ -740,7 +750,7 @@ void ImageVisual::DoSetOnStage( Actor& actor )
     mImpl->mRenderer.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, mPixelArea );
   }
 
-  if( IsSynchronousResourceLoading() || !(mImpl->mFlags & Impl::IS_ATLASING_APPLIED) )
+  if( mTextureLoading == false )
   {
     actor.AddRenderer( mImpl->mRenderer );
     mPlacementActor.Reset();
@@ -755,10 +765,10 @@ void ImageVisual::DoSetOffStage( Actor& actor )
   actor.RemoveRenderer( mImpl->mRenderer);
   if( mImageUrl.IsValid() )
   {
-    RemoveFromAtlas( mImageUrl.GetUrl() );
+    RemoveTexture( mImageUrl.GetUrl() );
     mImage.Reset();
   }
-
+  mTextureLoading = false;
   mImpl->mRenderer.Reset();
   mPlacementActor.Reset();
 }
@@ -876,34 +886,74 @@ void ImageVisual::ApplyImageToSampler( const Image& image )
   }
 }
 
-void ImageVisual::OnImageLoaded( ResourceImage image )
+// From existing atlas manager
+void ImageVisual::UploadCompleted()
 {
-  if( image.GetLoadingState() == Dali::ResourceLoadingFailed )
+  // Texture has been uploaded. If weak handle is holding a placement actor, it is the time to add the renderer to actor.
+  Actor actor = mPlacementActor.GetHandle();
+  if( actor )
+  {
+    actor.AddRenderer( mImpl->mRenderer );
+
+    // reset the weak handle so that the renderer only get added to actor once
+    mPlacementActor.Reset();
+  }
+  mTextureLoading = false;
+}
+
+// From Texture Manager
+void ImageVisual::UploadComplete( bool loadingSuccess, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle )
+{
+  Actor actor = mPlacementActor.GetHandle();
+  if( actor )
   {
-    Image brokenImage = VisualFactoryCache::GetBrokenVisualImage();
     if( mImpl->mRenderer )
     {
-      ApplyImageToSampler( brokenImage );
+      actor.AddRenderer( mImpl->mRenderer );
+      // reset the weak handle so that the renderer only get added to actor once
+      mPlacementActor.Reset();
+
+      if( loadingSuccess )
+      {
+        Sampler sampler = Sampler::New();
+        sampler.SetWrapMode(  mWrapModeU, mWrapModeV  );
+        textureSet.SetSampler( 0u, sampler );
+        mImpl->mRenderer.SetTextures(textureSet);
+      }
+      else
+      {
+        Image brokenImage = VisualFactoryCache::GetBrokenVisualImage();
+        ApplyImageToSampler( brokenImage );
+      }
     }
   }
+  mTextureLoading = false;
 }
 
-void ImageVisual::RemoveFromAtlas(const std::string& url)
+void ImageVisual::RemoveTexture(const std::string& url)
 {
-  Vector4 atlasRect( 0.f, 0.f, 1.f, 1.f );
-  Property::Index index = mImpl->mRenderer.GetPropertyIndex( ATLAS_RECT_UNIFORM_NAME );
-  if( index != Property::INVALID_INDEX )
+  if( mTextureId != TextureManager::INVALID_TEXTURE_ID )
   {
-    Property::Value atlasRectValue = mImpl->mRenderer.GetProperty( index );
-    atlasRectValue.Get( atlasRect );
+    mFactoryCache.GetTextureManager().Remove( mTextureId );
+    mTextureId = TextureManager::INVALID_TEXTURE_ID;
   }
+  else
+  {
+    Vector4 atlasRect( 0.f, 0.f, 1.f, 1.f );
+    Property::Index index = mImpl->mRenderer.GetPropertyIndex( ATLAS_RECT_UNIFORM_NAME );
+    if( index != Property::INVALID_INDEX )
+    {
+      Property::Value atlasRectValue = mImpl->mRenderer.GetProperty( index );
+      atlasRectValue.Get( atlasRect );
+    }
 
-  TextureSet textureSet = mImpl->mRenderer.GetTextures();
-  mImpl->mRenderer.Reset();
+    TextureSet textureSet = mImpl->mRenderer.GetTextures();
+    mImpl->mRenderer.Reset();
 
-  if( index != Property::INVALID_INDEX )
-  {
-    mFactoryCache.GetAtlasManager()->Remove( textureSet, atlasRect );
+    if( index != Property::INVALID_INDEX )
+    {
+      mFactoryCache.GetAtlasManager()->Remove( textureSet, atlasRect );
+    }
   }
 }
 
index f771f6d..9113437 100644 (file)
@@ -27,6 +27,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/image-loader/atlas-upload-observer.h>
+#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
 #include <dali-toolkit/internal/visuals/visual-url.h>
 
@@ -94,7 +95,7 @@ typedef IntrusivePtr< ImageVisual > ImageVisualPtr;
  * If the Visual is in a LayerUI it will pixel align the image, using a Layer3D will disable pixel alignment.
  * Changing layer behaviour between LayerUI to Layer3D whilst the visual is already staged will not have an effect.
  */
-class ImageVisual: public Visual::Base, public ConnectionTracker, public AtlasUploadObserver
+class ImageVisual: public Visual::Base, public ConnectionTracker, public AtlasUploadObserver, public TextureUploadObserver
 {
 public:
 
@@ -231,6 +232,14 @@ public:
    */
   virtual void UploadCompleted();
 
+  /**
+   * @copydoc TextureUploadObserver::UploadCompleted
+   *
+   * To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
+   * This callback is the place to add the renderer as it would be called once the loading is finished.
+   */
+  virtual void UploadComplete( bool success, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle );
+
 private:
 
   /**
@@ -286,21 +295,15 @@ private:
   TextureSet CreateTextureSet( Vector4& textureRect, bool synchronousLoading, bool attemptAtlasing );
 
   /**
-   * Callback function of image resource loading succeed
-   * @param[in] image The Image content that we attempted to load from mImageUrl
-   */
-  void OnImageLoaded( ResourceImage image );
-
-  /**
    * Set the value to the uTextureRect uniform
    * @param[in] textureRect The texture rectangular area.
    */
   void SetTextureRectUniform( const Vector4& textureRect  );
 
   /**
-   * Remove the image from atlas if it is not used anymore.
+   * Remove the texture if it is not used anymore.
    */
-  void RemoveFromAtlas(const std::string& url);
+  void RemoveTexture(const std::string& url);
 
   /**
    * Helper method to set individual values by index key.
@@ -318,13 +321,14 @@ private:
   VisualUrl mImageUrl;
 
   Dali::ImageDimensions mDesiredSize;
+  TextureManager::TextureId mTextureId;
+
   Dali::FittingMode::Type mFittingMode:3;
   Dali::SamplingMode::Type mSamplingMode:4;
   Dali::WrapMode::Type mWrapModeU:3;
   Dali::WrapMode::Type mWrapModeV:3;
-
-  bool mAttemptAtlasing:1; // If true will attempt atlasing, otherwise create unique texture
-
+  bool mAttemptAtlasing:1; ///< If true will attempt atlasing, otherwise create unique texture
+  bool mTextureLoading:1;  ///< True if the texture is being loaded asynchronously, or false when it has loaded.
 };
 
 } // namespace Internal
diff --git a/dali-toolkit/internal/visuals/texture-manager.cpp b/dali-toolkit/internal/visuals/texture-manager.cpp
new file mode 100644 (file)
index 0000000..7c8098d
--- /dev/null
@@ -0,0 +1,505 @@
+ /*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "texture-manager.h"
+
+// EXTERNAL HEADERS
+#include <dali/devel-api/common/hash.h>
+#include <dali/devel-api/images/texture-set-image.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL HEADERS
+#include <dali/integration-api/debug.h>
+#include <dali-toolkit/internal/image-loader/async-image-loader-impl.h>
+#include <dali-toolkit/internal/image-loader/image-atlas-impl.h>
+#include <dali-toolkit/public-api/image-loader/sync-image-loader.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#ifdef DEBUG_ENABLED
+Debug::Filter* gTextureManagerLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_TEXTURE_MANAGER" );
+#endif
+
+const uint32_t      DEFAULT_ATLAS_SIZE( 1024u );                     ///< This size can fit 8 by 8 images of average size 128 * 128
+const Vector4       FULL_ATLAS_RECT( 0.0f, 0.0f, 1.0f, 1.0f );       ///< UV Rectangle that covers the full Texture
+const char * const  BROKEN_IMAGE_URL( DALI_IMAGE_DIR "broken.png" ); ///< URL For the broken image placeholder
+const int           INVALID_INDEX( -1 );                             ///< Invalid index used to represent a non-existant TextureInfo struct
+const int           INVALID_CACHE_INDEX( -1 ); ///< Invalid Cache index
+
+} // Anonymous namespace
+
+
+TextureManager::TextureManager()
+: mAsyncLocalLoader( Toolkit::AsyncImageLoader::New() ),
+  mAsyncRemoteLoader( Toolkit::AsyncImageLoader::New() ),
+  mCurrentTextureId( 0 )
+{
+  mAsyncLocalLoader.ImageLoadedSignal().Connect( this, &TextureManager::AsyncLocalLoadComplete );
+  mAsyncRemoteLoader.ImageLoadedSignal().Connect( this, &TextureManager::AsyncRemoteLoadComplete );
+}
+
+TextureManager::TextureId TextureManager::RequestLoad(
+  const VisualUrl&         url,
+  const ImageDimensions    desiredSize,
+  FittingMode::Type        fittingMode,
+  Dali::SamplingMode::Type samplingMode,
+  const UseAtlas           useAtlas,
+  TextureUploadObserver*   observer )
+{
+  // First check if the requested Texture is cached.
+  const TextureHash textureHash = GenerateHash( url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas );
+
+  // Look up the texture by hash. Note: The extra parameters are used in case of a hash collision.
+  int cacheIndex = FindCachedTexture( textureHash, url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas );
+  TextureManager::TextureId textureId = INVALID_TEXTURE_ID;
+
+  // Check if the requested Texture exists in the cache.
+  if( cacheIndex != INVALID_CACHE_INDEX )
+  {
+    // Mark this texture being used by another client resource.
+    ++( mTextureInfoContainer[ cacheIndex ].referenceCount );
+    textureId = mTextureInfoContainer[ cacheIndex ].textureId;
+
+    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture @%d, textureId=%d\n", url.GetUrl().c_str(), observer, cacheIndex, textureId );
+  }
+  else
+  {
+    // We need a new Texture.
+    textureId = GenerateUniqueTextureId();
+    mTextureInfoContainer.push_back( TextureInfo( textureId, url.GetUrl(), desiredSize, fittingMode, samplingMode, false, useAtlas, textureHash ) );
+    cacheIndex = mTextureInfoContainer.size() - 1u;
+
+    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d\n", url.GetUrl().c_str(), observer, cacheIndex, textureId );
+  }
+
+  // The below code path is common whether we are using the cache or not.
+  // The textureInfoIndex now refers to either a pre-existing cached TextureInfo, or a new TextureInfo just created.
+  TextureInfo& textureInfo( mTextureInfoContainer[ cacheIndex ] );
+
+  DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureInfo loadState:%s\n",
+                 textureInfo.loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" :
+                 textureInfo.loadState == TextureManager::LOADING ? "LOADING" :
+                 textureInfo.loadState == TextureManager::UPLOADED ? "UPLOADED" :
+                 textureInfo.loadState == TextureManager::CANCELLED ? "CANCELLED" : "Unknown" );
+
+  // Check if we should add the observer. Only do this if we have not loaded yet and it will not have loaded by the end of this method.
+  switch( textureInfo.loadState )
+  {
+    case TextureManager::NOT_STARTED:
+    {
+      LoadTexture( textureInfo );
+      ObserveTexture( textureInfo, observer );
+      break;
+    }
+    case TextureManager::LOADING:
+    {
+      ObserveTexture( textureInfo, observer );
+      break;
+    }
+    case TextureManager::UPLOADED:
+    {
+      if( observer )
+      {
+        // The Texture has already loaded. The other observers have already been notified.
+        // We need to send a "late" loaded notification for this observer.
+        observer->UploadComplete( textureInfo.loadingSucceeded,
+                                  textureInfo.textureSet, textureInfo.useAtlas,
+                                  textureInfo.atlasRect );
+      }
+      break;
+    }
+    case TextureManager::CANCELLED:
+    {
+      // A cancelled texture hasn't finished loading yet. Treat as a loading texture
+      // (it's ref count has already been incremented, above)
+      textureInfo.loadState = TextureManager::LOADING;
+      ObserveTexture( textureInfo, observer );
+      break;
+    }
+  }
+
+  // Return the TextureId for which this Texture can now be referenced by externally.
+  return textureId;
+}
+
+void TextureManager::Remove( const TextureManager::TextureId textureId )
+{
+  int textureInfoIndex = GetCacheIndexFromId( textureId );
+  if( textureInfoIndex != INVALID_INDEX )
+  {
+    TextureInfo& textureInfo( mTextureInfoContainer[ textureInfoIndex ] );
+
+
+    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::Remove(%d) cacheIdx:%d loadState:%s\n",
+                   textureId, textureInfoIndex,
+                   textureInfo.loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" :
+                   textureInfo.loadState == TextureManager::LOADING ? "LOADING" :
+                   textureInfo.loadState == TextureManager::UPLOADED ? "UPLOADED" :
+                   textureInfo.loadState == TextureManager::CANCELLED ? "CANCELLED" : "Unknown" );
+
+    // Decrement the reference count and check if this is the last user of this Texture.
+    if( --textureInfo.referenceCount <= 0 )
+    {
+      // This is the last remove for this Texture.
+      textureInfo.referenceCount = 0;
+      bool removeTextureInfo = false;
+
+      // If loaded, we can remove the TextureInfo and the Atlas (if atlased).
+      if( textureInfo.loadState == UPLOADED )
+      {
+        if( textureInfo.atlas )
+        {
+          textureInfo.atlas.Remove( textureInfo.atlasRect );
+        }
+        removeTextureInfo = true;
+      }
+      else if( textureInfo.loadState == LOADING )
+      {
+        // We mark the textureInfo for removal.
+        // Once the load has completed, this method will be called again.
+        textureInfo.loadState = CANCELLED;
+      }
+      else
+      {
+        // In other states, we are not waiting for a load so we are safe to remove the TextureInfo data.
+        removeTextureInfo = true;
+      }
+
+      // If the state allows us to remove the TextureInfo data, we do so.
+      if( removeTextureInfo )
+      {
+        // Permanently remove the textureInfo struct.
+        mTextureInfoContainer.erase( mTextureInfoContainer.begin() + textureInfoIndex );
+      }
+    }
+  }
+}
+
+TextureManager::LoadState TextureManager::GetTextureState( TextureId textureId )
+{
+  LoadState loadState = TextureManager::NOT_STARTED;
+
+  int cacheIndex = GetCacheIndexFromId( textureId );
+  if( cacheIndex != INVALID_CACHE_INDEX )
+  {
+    TextureInfo& cachedTextureInfo( mTextureInfoContainer[ cacheIndex ] );
+    loadState = cachedTextureInfo.loadState;
+  }
+  return loadState;
+}
+
+TextureSet TextureManager::GetTextureSet( TextureId textureId )
+{
+  TextureSet textureSet;// empty handle
+
+  int cacheIndex = GetCacheIndexFromId( textureId );
+  if( cacheIndex != INVALID_CACHE_INDEX )
+  {
+    TextureInfo& cachedTextureInfo( mTextureInfoContainer[ cacheIndex ] );
+    textureSet = cachedTextureInfo.textureSet;
+  }
+  return textureSet;
+}
+
+
+
+bool TextureManager::LoadTexture( TextureInfo& textureInfo )
+{
+  bool success = true;
+
+  if( textureInfo.loadState == NOT_STARTED )
+  {
+    textureInfo.loadState = LOADING;
+
+    if( !textureInfo.loadSynchronously )
+    {
+      if( textureInfo.url.IsLocal() )
+      {
+        mAsyncLocalLoadingInfoContainer.push_back( AsyncLoadingInfo( textureInfo.textureId ) );
+        mAsyncLocalLoadingInfoContainer.back().loadId = GetImplementation(mAsyncLocalLoader).Load(
+          textureInfo.url, textureInfo.desiredSize,
+          textureInfo.fittingMode, textureInfo.samplingMode, true );
+      }
+      else
+      {
+        mAsyncRemoteLoadingInfoContainer.push_back( AsyncLoadingInfo( textureInfo.textureId ) );
+        mAsyncRemoteLoadingInfoContainer.back().loadId = GetImplementation(mAsyncRemoteLoader).Load(
+          textureInfo.url, textureInfo.desiredSize,
+          textureInfo.fittingMode, textureInfo.samplingMode, true );
+      }
+    }
+  }
+
+  return success;
+}
+
+void TextureManager::ObserveTexture( TextureInfo& textureInfo,
+                                     TextureUploadObserver* observer )
+{
+  if( observer )
+  {
+    textureInfo.observerList.PushBack( observer );
+    observer->DestructionSignal().Connect( this, &TextureManager::ObserverDestroyed );
+  }
+}
+
+void TextureManager::AsyncLocalLoadComplete( uint32_t id, PixelData pixelData )
+{
+  AsyncLoadComplete( mAsyncLocalLoadingInfoContainer, id, pixelData );
+}
+
+void TextureManager::AsyncRemoteLoadComplete( uint32_t id, PixelData pixelData )
+{
+  AsyncLoadComplete( mAsyncRemoteLoadingInfoContainer, id, pixelData );
+}
+
+void TextureManager::AsyncLoadComplete( AsyncLoadingInfoContainerType& loadingContainer, uint32_t id, PixelData pixelData )
+{
+  DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::AsyncLoadComplete( id:%d )\n", id );
+
+  if( loadingContainer.size() >= 1u )
+  {
+    AsyncLoadingInfo loadingInfo = loadingContainer.front();
+
+    if( loadingInfo.loadId == id )
+    {
+      int cacheIndex = GetCacheIndexFromId( loadingInfo.textureId );
+      if( cacheIndex != INVALID_CACHE_INDEX )
+      {
+        // Once we have found the TextureInfo data, we call a common function used to process loaded data for both sync and async loads.
+        TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] );
+
+        DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "  CacheIndex:%d LoadState: %d\n", cacheIndex, textureInfo.loadState );
+
+        // Only perform atlasing if the load has not been cancelled since the request.
+        if( textureInfo.loadState != CANCELLED )
+        {
+          // Perform atlasing and finalize the load.
+          PostLoad( textureInfo, pixelData );
+        }
+        else
+        {
+          Remove( textureInfo.textureId );
+        }
+      }
+    }
+
+    loadingContainer.pop_front();
+  }
+}
+
+
+bool TextureManager::PostLoad( TextureInfo& textureInfo, PixelData pixelData )
+{
+  bool success = false;
+
+  // Was the load successful?
+  if( pixelData && ( pixelData.GetWidth() != 0 ) && ( pixelData.GetHeight() != 0 ) )
+  {
+    // Regardless of whether the atlasing succeeds or not, we have a valid image, so we mark it as successful.
+    success = true;
+
+    bool usingAtlas = false;
+
+    // No atlas support for now
+    textureInfo.useAtlas = NO_ATLAS;
+
+    if( ! usingAtlas )
+    {
+      DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "  TextureManager::PostLoad() textureId:%d\n", textureInfo.textureId );
+
+      Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
+      texture.Upload( pixelData );
+      textureInfo.textureSet = TextureSet::New();
+      textureInfo.textureSet.SetTexture( 0u, texture );
+    }
+  }
+
+  if( ! success )
+  {
+    DALI_LOG_ERROR( "TextureManager::AsyncImageLoad(%s) failed\n", textureInfo.url.GetUrl().c_str() );
+    // @todo If the load was unsuccessful, upload the broken image.
+  }
+
+  // Update the load state.
+  // Note: This is regardless of success as we care about whether a
+  // load attempt is in progress or not.  If unsuccessful, a broken
+  // image is still loaded.
+  textureInfo.loadState = UPLOADED;
+
+  // We need to store the load succeeded state as if a future request to load this texture comes in,
+  // we need to re-broadcast the UploadComplete notification to that observer.
+  textureInfo.loadingSucceeded = success;
+
+  // If there is an observer: Notify the load is complete, whether successful or not:
+  const unsigned int observerCount = textureInfo.observerList.Count();
+  for( unsigned int i = 0; i < observerCount; ++i )
+  {
+    TextureUploadObserver* observer = textureInfo.observerList[i];
+    if( observer )
+    {
+      observer->UploadComplete( success, textureInfo.textureSet, textureInfo.useAtlas, textureInfo.atlasRect );
+      observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
+    }
+  }
+
+  textureInfo.observerList.Clear();
+
+  return success;
+}
+
+TextureManager::TextureId TextureManager::GenerateUniqueTextureId()
+{
+  return mCurrentTextureId++;
+}
+
+int TextureManager::GetCacheIndexFromId( const TextureId textureId )
+{
+  const unsigned int size = mTextureInfoContainer.size();
+
+  for( unsigned int i = 0; i < size; ++i )
+  {
+    if( mTextureInfoContainer[i].textureId == textureId )
+    {
+      return i;
+    }
+  }
+
+  DALI_LOG_WARNING( "Cannot locate TextureId: %d\n", textureId );
+  return INVALID_CACHE_INDEX;
+}
+
+TextureManager::TextureHash TextureManager::GenerateHash(
+  const std::string&             url,
+  const ImageDimensions          size,
+  const FittingMode::Type        fittingMode,
+  const Dali::SamplingMode::Type samplingMode,
+  const UseAtlas                 useAtlas )
+{
+  std::string hashTarget( url );
+  const size_t urlLength = hashTarget.length();
+  const uint16_t width = size.GetWidth();
+  const uint16_t height = size.GetWidth();
+
+  // If either the width or height has been specified, include the resizing options in the hash
+  if( width != 0 || height != 0 )
+  {
+    // We are appending 5 bytes to the URL to form the hash input.
+    hashTarget.resize( urlLength + 5u );
+    char* hashTargetPtr = &( hashTarget[ urlLength ] );
+
+    // Pack the width and height (4 bytes total).
+    *hashTargetPtr++ = size.GetWidth() & 0xff;
+    *hashTargetPtr++ = ( size.GetWidth() >> 8u ) & 0xff;
+    *hashTargetPtr++ = size.GetHeight() & 0xff;
+    *hashTargetPtr++ = ( size.GetHeight() >> 8u ) & 0xff;
+
+    // Bit-pack the FittingMode, SamplingMode and atlasing.
+    // FittingMode=2bits, SamplingMode=3bits, useAtlas=1bit
+    *hashTargetPtr   = ( fittingMode << 4u ) | ( samplingMode << 1 ) | useAtlas;
+  }
+  else
+  {
+    // We are not including sizing information, but we still need an extra byte for atlasing.
+    hashTarget.resize( urlLength + 1u );
+    // Add the atlasing to the hash input.
+    hashTarget[ urlLength ] = useAtlas;
+  }
+
+  return Dali::CalculateHash( hashTarget );
+}
+
+int TextureManager::FindCachedTexture(
+  const TextureManager::TextureHash hash,
+  const std::string&                url,
+  const ImageDimensions             size,
+  const FittingMode::Type           fittingMode,
+  const Dali::SamplingMode::Type    samplingMode,
+  const bool                        useAtlas )
+{
+  // Default to an invalid ID, in case we do not find a match.
+  int cacheIndex = INVALID_CACHE_INDEX;
+
+  // Iterate through our hashes to find a match.
+  const unsigned int count = mTextureInfoContainer.size();
+  for( unsigned int i = 0u; i < count; ++i )
+  {
+    if( mTextureInfoContainer[i].hash == hash )
+    {
+      // We have a match, now we check all the original parameters in case of a hash collision.
+      TextureInfo& textureInfo( mTextureInfoContainer[i] );
+
+      if( ( url == textureInfo.url.GetUrl() ) &&
+          ( useAtlas == textureInfo.useAtlas ) &&
+          ( size == textureInfo.desiredSize ) &&
+          ( ( size.GetWidth() == 0 && size.GetHeight() == 0 ) ||
+            ( fittingMode == textureInfo.fittingMode &&
+              samplingMode == textureInfo.samplingMode ) ) )
+      {
+        // The found Texture is a match.
+        cacheIndex = i;
+        break;
+      }
+    }
+  }
+
+  return cacheIndex;
+}
+
+void TextureManager::ObserverDestroyed( TextureUploadObserver* observer )
+{
+  const unsigned int count = mTextureInfoContainer.size();
+  for( unsigned int i = 0; i < count; ++i )
+  {
+    TextureInfo& textureInfo( mTextureInfoContainer[i] );
+    for( TextureInfo::ObserverListType::Iterator j = textureInfo.observerList.Begin(); j != textureInfo.observerList.End(); ++j )
+    {
+      if( *j == observer )
+      {
+        textureInfo.observerList.Erase( j );
+        break;
+      }
+    }
+  }
+}
+
+TextureManager::~TextureManager()
+{
+  mTextureInfoContainer.clear();
+  mAsyncLocalLoadingInfoContainer.clear();
+  mAsyncRemoteLoadingInfoContainer.clear();
+}
+
+
+
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/internal/visuals/texture-manager.h b/dali-toolkit/internal/visuals/texture-manager.h
new file mode 100644 (file)
index 0000000..312b12e
--- /dev/null
@@ -0,0 +1,368 @@
+#ifndef DALI_TOOLKIT_TEXTURE_MANAGER_H
+#define DALI_TOOLKIT_TEXTURE_MANAGER_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <dali/devel-api/common/owner-container.h>
+#include <deque>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/image-loader/image-atlas.h>
+#include <dali-toolkit/public-api/image-loader/async-image-loader.h>
+#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
+
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+ * The TextureManager provides a common Image loading API for Visuals.
+ *
+ * The TextureManager is responsible for providing sync, async, atlased and non-atlased loads.
+ * Texture caching is provided and performed when possible.
+ * Broken Images are automatically provided on load failure.
+ */
+class TextureManager : public ConnectionTracker
+{
+public:
+
+  typedef int32_t TextureId;       ///< The TextureId type. This is used as a handle to refer to a particular Texture.
+  static const int INVALID_TEXTURE_ID = -1; ///< Used to represent a null TextureId or error
+
+  enum UseAtlas
+  {
+    NO_ATLAS,
+    USE_ATLAS
+  };
+
+  enum LoadType
+  {
+    LOAD_ASYNCHRONOUSLY,
+    LOAD_SYNCHRONOUSLY
+  };
+
+  /**
+   * @brief The LoadState Enumeration represents the current state of a particular Textures life-cycle.
+   */
+  enum LoadState
+  {
+    NOT_STARTED,     ///< Default
+    LOADING,         ///< Loading has been started, but not finished.
+    UPLOADED,        ///< Loaded (and ready).
+    CANCELLED,       ///< Removed before loading completed
+  };
+
+public:
+
+  /**
+   * Constructor.
+   */
+  TextureManager();
+
+  /**
+   * Destructor.
+   */
+  ~TextureManager();
+
+
+// TextureManager Main API:
+
+  /**
+   * @brief Requests an image load of the given URL.
+   *
+   * The parameters are used to specify how the image is loaded.
+   * The observer has the UploadComplete method called when the load is ready.
+   *
+   * When the client has finished with the Texture, Remove() should be called.
+   *
+   * @param[in] url               The URL of the image to load
+   * @param[in] desiredSize       The size the image is likely to appear at. This can be set to 0,0 for automatic
+   * @param[in] fittingMode       The FittingMode to use
+   * @param[in] samplingMode      The SamplingMode to use
+   * @param[in] useAtlasing       Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be loaded, and marked successful,
+   *                              but "useAtlasing" will be set to false in the "UploadCompleted" callback from the TextureManagerUploadObserver.
+   * @param[in] observer          The client object should inherit from this and provide the "UploadCompleted" virtual.
+   *                              This is called when an image load completes (or fails).
+   * @return                      A TextureId to use as a handle to reference this Texture
+   */
+  TextureId RequestLoad( const VisualUrl&         url,
+                         const ImageDimensions    desiredSize,
+                         FittingMode::Type        fittingMode,
+                         Dali::SamplingMode::Type samplingMode,
+                         const UseAtlas           useAtlasing,
+                         TextureUploadObserver*   observer );
+
+  /**
+   * @brief Remove a Texture from the TextureManager.
+   *
+   * Textures are cached and therefore only the removal of the last
+   * occurrence of a Texture will cause its removal internally.
+   *
+   * @param[in] textureId The ID of the Texture to remove.
+   */
+  void Remove( const TextureManager::TextureId textureId );
+
+  /**
+   * @brief Get the current state of a texture
+   * @param[in] textureId The texture id to query
+   * @return The loading state if the texture is valid, or NOT_STARTED if the textureId
+   * is not valid.
+   */
+  LoadState GetTextureState( TextureId textureId );
+
+  /**
+   * @brief Get the associated texture set if the texture id is valid
+   * @param[in] textureId The texture Id to look up
+   * @return the associated texture set, or an empty handle if textureId is not valid
+   */
+  TextureSet GetTextureSet( TextureId textureId );
+
+private:
+
+
+  typedef size_t TextureHash; ///< The type used to store the hash used for Texture caching.
+
+  /**
+   * @brief This struct is used to manage the life-cycle of Texture loading and caching.
+   * TODO-TX: pimpl this
+   */
+  struct TextureInfo
+  {
+    TextureInfo( TextureId textureId,
+                 const VisualUrl& url,
+                 ImageDimensions desiredSize,
+                 FittingMode::Type fittingMode,
+                 Dali::SamplingMode::Type samplingMode,
+                 bool loadSynchronously,
+                 UseAtlas useAtlas,
+                 TextureManager::TextureHash hash )
+    : url( url ),
+      desiredSize( desiredSize ),
+      useSize( desiredSize ),
+      atlasRect( 0.0f, 0.0f, 1.0f, 1.0f ), // Full atlas rectangle
+      textureId( textureId ),
+      hash( hash ),
+      referenceCount( 1u ),
+      loadState( NOT_STARTED ),
+      fittingMode( fittingMode ),
+      samplingMode( samplingMode ),
+      loadSynchronously( loadSynchronously ),
+      useAtlas( useAtlas ),
+      loadingSucceeded( false )
+    {
+    }
+
+    /**
+     * Container type used to store all observer clients of this Texture
+     */
+    typedef Dali::Vector< TextureUploadObserver* > ObserverListType;
+
+    ObserverListType observerList; ///< Container used to store all observer clients of this Texture
+    Toolkit::ImageAtlas atlas;     ///< The atlas this Texture lays within (if any)
+    PixelData pixelData;           ///< The PixelData holding the image data (this is used if atlasing is deferred)
+    TextureSet textureSet;         ///< The TextureSet holding the Texture
+    VisualUrl url;                 ///< The URL of the image
+    ImageDimensions desiredSize;   ///< The size requested
+    ImageDimensions useSize;       ///< The size used
+    Vector4 atlasRect;             ///< The atlas rect used if atlased
+    TextureId textureId;           ///< The TextureId associated with this Texture
+    TextureManager::TextureHash hash; ///< The hash used to cache this Texture
+    int16_t referenceCount;        ///< The reference count of clients using this Texture
+    LoadState loadState:3;         ///< The load state showing the load progress of the Texture
+    FittingMode::Type fittingMode:2; ///< The requested FittingMode
+    Dali::SamplingMode::Type samplingMode:3; ///< The requested SamplingMode
+    bool loadSynchronously;        ///< True if synchronous loading was requested
+    UseAtlas useAtlas; ///< USE_ATLAS if an atlas was requested. This is updated to false if atlas is not used
+    bool loadingSucceeded;         ///< True if the image was loaded successfully
+  };
+
+  // Structs:
+
+  /**
+   * Struct to hold information about a requested Async load.
+   * This is used to look up a TextureManager::TextureId from the returned AsyncLoad Id.
+   */
+  struct AsyncLoadingInfo
+  {
+    AsyncLoadingInfo( TextureId textureId )
+    : textureId( textureId ),
+      loadId( 0 )
+    {
+    }
+
+    TextureId           textureId;   ///< The external Texture Id assigned to this load
+    unsigned short      loadId;      ///< The load Id used by the async loader to reference this load
+  };
+
+  /**
+   * @brief This struct is used within a container to manage atlas creation and destruction.
+   */
+  struct AtlasInfo
+  {
+    AtlasInfo( Toolkit::ImageAtlas atlas, TextureSet textureSet )
+    : atlas( atlas ),
+      textureSet( textureSet )
+    {
+    }
+
+    Toolkit::ImageAtlas                 atlas;                          ///< The ImageAtlas object
+    TextureSet                          textureSet;                     ///< The TextureSet is kept in the struct to allow fast lookup of TextureSet to Atlas
+  };
+
+  // Private typedefs:
+
+  typedef std::deque<AsyncLoadingInfo>  AsyncLoadingInfoContainerType;  ///< The container type used to manage Asynchronous loads in progress
+  typedef std::vector<AtlasInfo>        AtlasInfoContainerType;         ///< The container type used to manage Atlas creation and destruction
+  typedef std::vector<TextureInfo>      TextureInfoContainerType;       ///< The container type used to manage the life-cycle and caching of Textures
+
+  /**
+   * @brief Used internally to initiate a load.
+   * @param[in] textureInfo The TextureInfo struct associated with the Texture
+   * @return                True if the load was initiated
+   */
+  bool LoadTexture( TextureInfo& textureInfo );
+
+  /**
+   * Add the observer to the observer list
+   * @param[in] textureInfo The TextureInfo struct associated with the texture
+   * observer The observer wishing to observe the texture upload
+   */
+  void ObserveTexture( TextureInfo & textureInfo, TextureUploadObserver* observer );
+
+  /**
+   * @brief This signal handler is called when the async local loader finishes loading.
+   * @param[in] id        This is the async image loaders Id
+   * @param[in] pixelData The loaded image data
+   */
+  void AsyncLocalLoadComplete( uint32_t id, PixelData pixelData );
+
+  /**
+   * @brief This signal handler is called when the async local loader finishes loading.
+   * @param[in] id        This is the async image loaders Id
+   * @param[in] pixelData The loaded image data
+   */
+  void AsyncRemoteLoadComplete( uint32_t id, PixelData pixelData );
+
+  /**
+   * Common method to handle loading completion
+   * @param[in] container The Async loading container
+   * @param[in] id        This is the async image loaders Id
+   * @param[in] pixelData The loaded image data
+   */
+  void AsyncLoadComplete( AsyncLoadingInfoContainerType& container, uint32_t id, PixelData pixelData );
+
+  /**
+   * @brief Performs Post-Load steps including atlasing.
+   * @param[in]           textureInfo The struct associated with this Texture
+   * @param[in]           pixelData   The image pixelData
+   * @return                          True if successful
+   */
+  bool PostLoad( TextureManager::TextureInfo& textureInfo, PixelData pixelData );
+
+  /**
+   * @brief Generates a new, unique TextureId
+   * @return A unique TextureId
+   */
+  TextureManager::TextureId GenerateUniqueTextureId();
+
+  /**
+   * @brief Used to lookup an index into the TextureInfoContainer from a TextureId
+   * @param[in] textureId The TextureId to look up
+   * @return              The cache index
+   */
+  int GetCacheIndexFromId( TextureId textureId );
+
+
+  /**
+   * @brief Generates a hash for caching based on the input parameters.
+   * @param[in] url          The URL of the image to load
+   * @param[in] size         The image size
+   * @param[in] fittingMode  The FittingMode to use
+   * @param[in] samplingMode The SamplingMode to use
+   * @param[in] useAtlas     True if atlased
+   * @return                 A hash of the provided data for caching.
+   */
+  TextureHash GenerateHash( const std::string& url, const ImageDimensions size,
+                            const FittingMode::Type fittingMode,
+                            const Dali::SamplingMode::Type samplingMode, const UseAtlas useAtlas );
+
+  /**
+   * @brief Looks up a cached texture by its hash.
+   * If found, the given parameters are used to check there is no hash-collision.
+   * @param[in] hash The hash to look up
+   * @param[in] url          The URL of the image to load
+   * @param[in] size         The image size
+   * @param[in] fittingMode  The FittingMode to use
+   * @param[in] samplingMode The SamplingMode to use
+   * @param[in] useAtlas     True if atlased
+   * @return                 A TextureId of a cached Texture if found. Or INVALID_TEXTURE_ID if not found.
+   */
+  TextureManager::TextureId FindCachedTexture( const TextureManager::TextureHash hash, const std::string& url, const ImageDimensions size,
+      const FittingMode::Type fittingMode, const Dali::SamplingMode::Type samplingMode, const bool useAtlas );
+
+
+private:
+
+  /**
+   * Undefined copy constructor.
+   */
+  TextureManager( const TextureManager& );
+
+  /**
+   * Undefined assignment operator.
+   */
+  TextureManager& operator=( const TextureManager& rhs );
+
+  /**
+   * This is called by the TextureManagerUploadObserver when an observer is destroyed.
+   * We use the callback to know when to remove an observer from our notify list.
+   * @param[in] observer The observer that generated the callback
+   */
+  void ObserverDestroyed( TextureUploadObserver* observer );
+
+private:  // Member Variables:
+
+  AsyncLoadingInfoContainerType         mAsyncLocalLoadingInfoContainer;     ///< Used to manage Asynchronous loads in progress
+  AsyncLoadingInfoContainerType         mAsyncRemoteLoadingInfoContainer;     ///< Used to manage Asynchronous loads in progress
+  AtlasInfoContainerType                mAtlasContainer;                ///< Used to manage Atlas creation and destruction
+  TextureInfoContainerType              mTextureInfoContainer;          ///< Used to manage the life-cycle and caching of Textures
+  Toolkit::AsyncImageLoader             mAsyncLocalLoader;              ///< The Asynchronous image loader used to provide all local async loads
+  Toolkit::AsyncImageLoader             mAsyncRemoteLoader;             ///< The Asynchronous image loader used to provide all remote async loads
+  TextureId                             mCurrentTextureId;              ///< The current value used for the unique Texture Id generation
+
+};
+
+
+} // name Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXTURE_MANAGER_H
diff --git a/dali-toolkit/internal/visuals/texture-upload-observer.cpp b/dali-toolkit/internal/visuals/texture-upload-observer.cpp
new file mode 100644 (file)
index 0000000..8ffd35f
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "texture-upload-observer.h"
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+TextureUploadObserver::TextureUploadObserver()
+{
+}
+
+TextureUploadObserver::~TextureUploadObserver()
+{
+  if( !mDestructionSignal.Empty() )
+  {
+    mDestructionSignal.Emit( this );
+  }
+}
+
+TextureUploadObserver::DestructionSignalType& TextureUploadObserver::DestructionSignal()
+{
+  return mDestructionSignal;
+}
+
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/internal/visuals/texture-upload-observer.h b/dali-toolkit/internal/visuals/texture-upload-observer.h
new file mode 100644 (file)
index 0000000..c300274
--- /dev/null
@@ -0,0 +1,84 @@
+#ifndef DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
+#define DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+
+class TextureSet;
+
+namespace Toolkit
+{
+
+
+/**
+ * @brief Base class used to observe the upload status of a texture.
+ *
+ * Derived class must implement the UploadComplete method which is
+ * executed once the texture is ready to draw.
+ */
+class DALI_IMPORT_API TextureUploadObserver
+{
+public:
+
+  typedef Signal< void ( TextureUploadObserver* ) > DestructionSignalType; ///< Signal prototype for the Destruction Signal.
+
+  /**
+   * @brief Constructor.
+   */
+  TextureUploadObserver();
+
+  /**
+   * @brief Virtual destructor.
+   */
+  virtual ~TextureUploadObserver();
+
+  /**
+   * The action to be taken once the async load has finished and the upload to GPU is completed.
+   * This should be overridden by the deriving class.
+   *
+   * @param[in] loadSuccess True if the texture load was successful (i.e. the resource is available). If false, then the resource failed to load. In future, this will automatically upload a "broken" image.
+   * @param[in] textureSet  The TextureSet containing the Texture
+   * @param[in] useAtlasing True if atlasing was used (note: this may be different to what was requested)
+   * @param[in] atlasRect   If using atlasing, this is the rectangle within the atlas to use.
+   */
+  virtual void UploadComplete( bool loadSuccess, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect ) = 0;
+
+  /**
+   * @brief Returns the destruction signal.
+   * This is emitted when the observer is destroyed.
+   * This is used by the observer notifier to mark this observer as destroyed (IE. It no longer needs notifying).
+   */
+  DestructionSignalType& DestructionSignal();
+
+private:
+
+  DestructionSignalType mDestructionSignal; ///< The destruction signal emitted when the observer is destroyed.
+
+};
+
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
index dd8d306..d9a566d 100644 (file)
@@ -112,6 +112,11 @@ ImageAtlasManagerPtr VisualFactoryCache::GetAtlasManager()
   return mAtlasManager;
 }
 
+TextureManager& VisualFactoryCache::GetTextureManager()
+{
+  return mTextureManager;
+}
+
 NPatchLoader& VisualFactoryCache::GetNPatchLoader()
 {
   return mNPatchLoader;
index 470cf07..cc68e0f 100644 (file)
@@ -28,6 +28,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/npatch-loader.h>
 #include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
+#include <dali-toolkit/internal/visuals/texture-manager.h>
 
 namespace Dali
 {
@@ -37,11 +38,12 @@ namespace Toolkit
 
 namespace Internal
 {
-
 class ImageAtlasManager;
+class NPatchLoader;
+class TextureManager;
+
 typedef IntrusivePtr<ImageAtlasManager> ImageAtlasManagerPtr;
 
-class NPatchLoader;
 
 /**
  * Caches shaders and geometries. Owned by VisualFactory.
@@ -145,6 +147,12 @@ public:
   ImageAtlasManagerPtr GetAtlasManager();
 
   /**
+   * Get the texture manager
+   * @return A reference to the texture manager
+   */
+  TextureManager& GetTextureManager();
+
+  /**
    * Get the N-Patch texture cache.
    * @return A reference to the N patch loader
    */
@@ -185,8 +193,8 @@ private:
   Shader mShader[SHADER_TYPE_MAX+1];
 
   ImageAtlasManagerPtr mAtlasManager;
-  NPatchLoader mNPatchLoader;
-
+  TextureManager       mTextureManager;
+  NPatchLoader         mNPatchLoader;
   SvgRasterizeThread*  mSvgRasterizeThread;
 };
 
index 33f5008..dc24ba8 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 33;
+const unsigned int TOOLKIT_MICRO_VERSION = 34;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index c1e23ee..b01134d 100644 (file)
@@ -19,6 +19,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/image-loader/async-image-loader-impl.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
 
 namespace Dali
 {
@@ -63,12 +64,12 @@ AsyncImageLoader AsyncImageLoader::New()
 
 uint32_t AsyncImageLoader::Load( const std::string& url )
 {
-  return GetImplementation( *this ).Load( url, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
+  return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
 }
 
 uint32_t AsyncImageLoader::Load( const std::string& url, ImageDimensions dimensions )
 {
-  return GetImplementation( *this ).Load( url, dimensions, FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
+  return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), dimensions, FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
 }
 
 uint32_t AsyncImageLoader::Load( const std::string& url,
@@ -77,7 +78,7 @@ uint32_t AsyncImageLoader::Load( const std::string& url,
                                  SamplingMode::Type samplingMode,
                                  bool orientationCorrection )
 {
-  return GetImplementation(*this).Load( url, dimensions, fittingMode, samplingMode, orientationCorrection );
+  return GetImplementation(*this).Load( Toolkit::Internal::VisualUrl(url), dimensions, fittingMode, samplingMode, orientationCorrection );
 }
 
 bool AsyncImageLoader::Cancel( uint32_t loadingTaskId )
index a58cbda..bf41fae 100644 (file)
  *
  * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
  *
- * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature Element</b>.</a>
  *
  * \endif
  *
index a9e934e..4f889c7 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.2.33
+Version:    1.2.34
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT
index 5870e36..ca70dc9 100755 (executable)
  *
  */
 
+%typemap(csimports) Dali::Window %{
+    using System;
+    using System.Runtime.InteropServices;
+%}
+
+
 %typemap(cscode) Dali::Window %{
+
+    public void SetAcceptFocus( bool accept )
+    {
+      NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+
+    public bool IsFocusAcceptable()
+    {
+      return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+
     public void Show()
     {
       NDalicPINVOKE.Show(swigCPtr);
       NDalicPINVOKE.IsVisible(swigCPtr);
       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
+
+    public class WindowFocusChangedEventArgs : EventArgs
+    {
+        public bool FocusGained
+        {
+            get;
+            set;
+        }
+    }
+
+    private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
+    [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+    private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
+    private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler;
+
+    public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
+    {
+        add
+        {
+            if (_windowFocusChangedEventHandler == null)
+            {
+                _windowFocusChangedEventCallback = OnWindowFocusedChanged;
+                WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
+            }
+
+            _windowFocusChangedEventHandler += value;
+        }
+        remove
+        {
+            _windowFocusChangedEventHandler -= value;
+
+            if (_windowFocusChangedEventHandler == null && _windowFocusChangedEventCallback != null)
+            {
+                WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
+            }
+        }
+    }
+
+    private void OnWindowFocusedChanged(bool focusGained)
+    {
+        WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
+
+        e.FocusGained = focusGained;
+
+        if (_windowFocusChangedEventHandler != null)
+        {
+            _windowFocusChangedEventHandler(this, e);
+        }
+    }
+
+    public WindowFocusSignalType WindowFocusChangedSignal() {
+      WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+
 %}
+
+%ignore Dali::Window::IndicatorVisibilityChangedSignal();
index 5834e10..0114378 100755 (executable)
 %template(ApplicationSignal) Dali::Signal<void(Dali::Application&)>;
 %template(ApplicationControlSignal) Dali::Signal<void(Dali::Application&, void*)>;
 %template(TimerSignalType) Dali::Signal<bool()>;
+%template(WindowFocusSignalType) Dali::Signal<void(bool)>;
 
 
 // Application specialisation
index 3ef430c..059fdc1 100644 (file)
 %}
 %enddef
 
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
-  ~TimerSignalType() {
-    DisposeQueue.Instance.Add(this);
-  }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
-%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
-    if (!Stage.IsInstalled()) {
-      DisposeQueue.Instance.Add(this);
-      return;
-    }
-
-    lock(this) {
-      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
-        if (swigCMemOwn) {
-          swigCMemOwn = false;
-          NDalicPINVOKE.delete_TimerSignalType(swigCPtr);
-        }
-        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
-      }
-      global::System.GC.SuppressFinalize(this);
-    }
-  }
-%}
-%enddef
-
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Any );
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Any );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Actor );
@@ -387,13 +358,13 @@ DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, PushButton );
 DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, PushButton );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, RadioButton );
 DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, RadioButton );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ToggleButton );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ToggleButton );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Builder );
 DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Builder );
 
-//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, View );
-//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, View );
-//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ViewImpl );
-//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ViewImpl );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit::DevelKeyboardFocusManager, CustomAlgorithmInterface );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali::Toolkit::DevelKeyboardFocusManager, CustomAlgorithmInterface );
 
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, FlexContainer );
 DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, FlexContainer );
@@ -453,10 +424,13 @@ DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, TextLabel );
 
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, VideoView );
 DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, VideoView );
-//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, VisualBase );
-//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, VisualBase);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali::Toolkit::Visual, Base, VisualBase );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION_RENAME( Dali::Toolkit::Visual, Base, VisualBase);
+
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, VisualFactory );
 DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, VisualFactory );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, TransitionData );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, TransitionData );
 
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Application&)>, ApplicationSignal);
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Application&)>, ApplicationSignal);
@@ -497,8 +471,9 @@ DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Actor, Dali:
 //DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STRINGVALUEPAIR( Dali, pair<std::string, Dali::Property::Value>);
 //DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BOOLSIGNAL( Dali, Signal<bool()>);
 //DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BOOLSIGNAL( Dali, Signal<bool()>);
-//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TIMERSIGNALTYPE( Dali, Signal<bool()>);
-//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TIMERSIGNALTYPE( Dali, Signal<bool()>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool()>, TimerSignalType);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool()>, TimerSignalType);
 
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor)>, ActorSignal);
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor)>, ActorSignal);
index 30a2dfc..131f163 100755 (executable)
   public static readonly int VISUAL_PROPERTY_TRANSFORM = NDalicManualPINVOKE.Visual_Property_TRANSFORM_get();
   public static readonly int VISUAL_PROPERTY_PREMULTIPLIED_ALPHA = NDalicManualPINVOKE.Visual_Property_PREMULTIPLIED_ALPHA_get();
   public static readonly int VISUAL_PROPERTY_MIX_COLOR = NDalicManualPINVOKE.Visual_Property_MIX_COLOR_get();
+  public static readonly int IMAGE_VISUAL_BORDER = NDalicManualPINVOKE.Image_Visual_BORDER_get();
 %}
 
 %typemap(cscode) Dali::Toolkit::Visual::Type %{
   ,
-  TEXT
+  TEXT,
+  N_PATCH,
+  SVG,
+  ANIMATED_IMAGE
 %}
 
 %typemap(cscode) Dali::Actor::Property %{
index fbf5a8e..0947698 100755 (executable)
@@ -34,7 +34,7 @@
 
     public IntPtr GetPtrfrom ## ClassName ()
     {
-       return (IntPtr)swigCPtr;
+      return (IntPtr)swigCPtr;
     }
 
     public Position CurrentPosition
       }
     }
 
-    public Size3D CurrentSize
+    public Size2D Size2D
+    {
+      get
+      {
+        Size temp = new Size(0.0f,0.0f,0.0f);
+        GetProperty( Actor.Property.SIZE).Get(  temp );
+        return new Size2D(temp);
+      }
+      set
+      {
+        SetProperty( Actor.Property.SIZE, new Dali.Property.Value( new Size(value) ) );
+      }
+    }
+
+    public Size CurrentSize
     {
       get
       {
       }
     }
 
-   public bool Visibility
-   {
+    public bool Visibility
+    {
       get
       {
         return IsVisible();
       }
-   }
+    }
 
     public float Opacity
     {
       }
     }
 
+    public Position2D Position2D
+    {
+      get
+      {
+        Position temp = new Position(0.0f,0.0f,0.0f);
+        GetProperty( Actor.Property.POSITION).Get(  temp );
+        return new Position2D(temp);
+      }
+      set
+      {
+        SetProperty( Actor.Property.POSITION, new Dali.Property.Value( new Position(value) ) );
+      }
+    }
+
     public Vector2 ScreenPosition
     {
       get
old mode 100644 (file)
new mode 100755 (executable)
index 290b4a1..e5e971e
     }
 
 
+    public Value(Size2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Size2D.getCPtr(vectorValue)), true) {
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+
+    public Value(Size vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Size.getCPtr(vectorValue)), true) {
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+
+    public Value(Position2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Position2D.getCPtr(vectorValue)), true) {
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+
+    public Value(Position vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Position.getCPtr(vectorValue)), true) {
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+
+    public Value(Color vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_6(Color.getCPtr(vectorValue)), true) {
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+
+
+    public bool Get(Size2D vectorValue) {
+      bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Size2D.getCPtr(vectorValue));
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+
+    public bool Get(Size vectorValue) {
+      bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Size.getCPtr(vectorValue));
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+
+    public bool Get(Position2D vectorValue) {
+      bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Position2D.getCPtr(vectorValue));
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+
+    public bool Get(Position vectorValue) {
+      bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Position.getCPtr(vectorValue));
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+
+    public bool Get(Color vectorValue) {
+      bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_7(swigCPtr, Color.getCPtr(vectorValue));
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+
+
  %}
 
 
 
 
-#endif
\ No newline at end of file
+#endif
old mode 100644 (file)
new mode 100755 (executable)
index 0842c9b..5605405
@@ -265,6 +265,9 @@ DALI_SIGNAL_1_PARAM( Dali::Actor );
 //  Signal< void (float) >
 DALI_SIGNAL_1_PARAM( float );
 
+//  Signal< void (bool) >
+DALI_SIGNAL_1_PARAM( bool );
+
 // Signal< void (Dali::Application&) >
 DALI_SIGNAL_1_PARAM( Dali::Application& );
 
index 39b7641..2b5de66 100755 (executable)
@@ -398,7 +398,7 @@ namespace MyCSharpExample
             controlLayout.ParentOrigin = NDalic.ParentOriginCenter;
             controlLayout.AnchorPoint = NDalic.AnchorPointCenter;
             controlLayout.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
-            controlLayout.SetCellPadding(new Size(10.0f, 10.0f));
+            controlLayout.SetCellPadding(new Size2D(10, 10));
             controlLayout.SetRelativeWidth(0, 0.5f);
             controlLayout.SetRelativeWidth(1, 0.5f);
             controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER);
index f85a78a..c2d5917 100755 (executable)
@@ -105,6 +105,7 @@ namespace MyCSharpExample
 
         public void Initialize(object source, NUIApplicationInitEventArgs e)
         {
+
             //1)
             NavigationPropertiesTests();
 
@@ -125,6 +126,7 @@ namespace MyCSharpExample
 
             //7)
             ViewDownCastTest();
+
         }
 
 
@@ -402,8 +404,9 @@ namespace MyCSharpExample
             spin.Background = background;
 
             background = spin.Background;
-            Vector4 backgroundColor = new Vector4();
+            Color backgroundColor = new Color();
             background.Find(Dali.Constants.ColorVisualProperty.MixColor).Get(backgroundColor);
+
             if (backgroundColor == Color.Red)
             {
                 Console.WriteLine("Custom View Background property : test passed");
@@ -415,7 +418,8 @@ namespace MyCSharpExample
 
             // BackgroundColor property
             spin.BackgroundColor = Color.Yellow;
-            if (spin.BackgroundColor == Color.Yellow)
+
+            if (spin.BackgroundColor.EqualTo(Color.Yellow))
             {
                 Console.WriteLine("Custom View BackgroundColor property : test passed");
             }
@@ -462,10 +466,10 @@ namespace MyCSharpExample
             handle.GetProperty(myPropertyIndex).Get(ref myProperty);
             Console.WriteLine("myProperty value: " + myProperty);
 
-            int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f)), Property.AccessMode.READ_WRITE);
-            Size myProperty2 = new Size(0.0f, 0.0f);
+            int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f, 5.0f)), Property.AccessMode.READ_WRITE);
+            Size myProperty2 = new Size(0.0f, 0.0f, 0.0f);
             handle.GetProperty(myPropertyIndex2).Get(myProperty2);
-            Console.WriteLine("myProperty2 value: " + myProperty2.W + ", " + myProperty2.H);
+            Console.WriteLine("myProperty2 value: " + myProperty2.Width + ", " + myProperty2.Height);
 
             Actor actor = new Actor();
             actor.Size = new Position(200.0f, 200.0f, 0.0f);
@@ -476,8 +480,8 @@ namespace MyCSharpExample
 
             Stage stage = Stage.GetCurrent();
             stage.BackgroundColor = Color.White;
-            Size stageSize = stage.Size;
-            Console.WriteLine("Stage size: " + stageSize.W + ", " + stageSize.H);
+            Size2D stageSize = stage.Size;
+            Console.WriteLine("Stage size: " + stageSize.Width + ", " + stageSize.Height);
             stage.Add(actor);
 
             TextLabel text = new TextLabel("Hello World");
@@ -585,14 +589,15 @@ namespace MyCSharpExample
             Console.WriteLine("");
             Console.WriteLine("### [6] SizePositionTest START");
 
-            Size Size = new Size(100, 50);
+            Size Size = new Size(100, 50, 25);
             Console.WriteLine("    Created " + Size);
-            Console.WriteLine("    Size x =  " + Size.W + ", y = " + Size.H);
-            Size += new Size(20, 20);
-            Console.WriteLine("    Size x =  " + Size.W + ", y = " + Size.H);
-            Size.W += 10;
-            Size.H += 10;
-            Console.WriteLine("    Size width =  " + Size.W + ", height = " + Size.H);
+            Console.WriteLine("    Size w =  " + Size.Width + ", h = " + Size.Height + ", d = " + Size.Depth);
+            Size += new Size(20, 20, 20);
+            Console.WriteLine("    Size w =  " + Size.Width + ", h = " + Size.Height + ", d = " + Size.Depth);
+            Size.Width += 10;
+            Size.Height += 10;
+            Size.Depth += 10;
+            Console.WriteLine("    Size width =  " + Size.Width+ ", height = " + Size.Height + ", depth = " + Size.Depth);
 
             Console.WriteLine(" *************************");
             Position Position = new Position(20, 100, 50);
@@ -604,7 +609,7 @@ namespace MyCSharpExample
             Position.Y += 10;
             Position.Z += 10;
             Console.WriteLine("    Position width =  " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z);
-            Position parentOrigin = new Dali.Position(NDalic.ParentOriginBottomRight);
+            Position parentOrigin = ParentOrigin.BottomRight;
             Console.WriteLine("    parentOrigin x =  " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z);
 
             Console.WriteLine(" *************************");
@@ -771,7 +776,117 @@ namespace MyCSharpExample
             Example example = new Example(Application.NewApplication());
             example.MainLoop();
         }
+
+      private void LOG(string str, int result = -1)
+      {
+        if (result == 1) Console.WriteLine(str + " : test passed!");
+        else if (result == 0) Console.WriteLine(str + " : test failed! TEST FAILED! test failed! TEST FAILED!");
+        else Console.WriteLine(str);
+      }
+
+      private void CustomPropertyHighLevelClassTest()
+      {
+        LOG("=================================");
+        LOG(" high level class test");
+        LOG("=================================");
+
+        Handle handle = new Handle();
+        int myPropertyIndex1 = handle.RegisterProperty("myProperty1", new Property.Value(new Size(10, 20, 30)), Property.AccessMode.READ_WRITE);
+        Size myProperty1 = Dali.Size.Zero;
+        handle.GetProperty(myPropertyIndex1).Get(myProperty1);
+        if (myProperty1.EqualTo(new Size(10, 20, 30))) LOG( "myProperty1 must be Size(10, 20, 30) get=" + myProperty1, 1);
+        else LOG( "myProperty1 must be Size(10, 20, 30) get=" + myProperty1, 0);
+
+        int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Position(40, 50, 60)), Property.AccessMode.READ_WRITE);
+        Position myProperty2 = Dali.Position.Zero;
+        handle.GetProperty(myPropertyIndex2).Get(myProperty2);
+        if (myProperty2.EqualTo(new Position(40, 50, 60))) LOG( "myProperty2 must be Position(40, 50, 60) get=" + myProperty2, 1);
+        else LOG( "myProperty2 must be Position(40, 50, 60) get=" + myProperty2, 0);
+
+        int myPropertyIndex3 = handle.RegisterProperty("myProperty3", new Property.Value(Color.Cyan), Property.AccessMode.READ_WRITE);
+        Color myProperty3 = Color.Transparent;
+        handle.GetProperty(myPropertyIndex3).Get(myProperty3);
+        if (myProperty3.EqualTo(Color.Cyan)) LOG( "myProperty3 must be Color.Cyan get=" + myProperty3, 1);
+        else LOG( "myProperty3 must be Color.Cyan get=" + myProperty3, 0);
+
+        int myPropertyIndex4 = handle.RegisterProperty("myProperty4", new Property.Value(new Size2D(100, 200)), Property.AccessMode.READ_WRITE);
+        Size2D myProperty4 = new Size2D(0, 0);
+        handle.GetProperty(myPropertyIndex4).Get(myProperty4);
+        if (myProperty4.EqualTo(new Size2D(100, 200))) LOG( "myProperty4 must be new Size2D(100, 200) get=" + myProperty4, 1);
+        else LOG( "myProperty4 must be new Size2D(100, 200) get=" + myProperty4, 0);
+
+        int myPropertyIndex5 = handle.RegisterProperty("myProperty5", new Property.Value(new Position2D(200, 300)), Property.AccessMode.READ_WRITE);
+        Position2D myProperty5 = new Position2D(0, 0);
+        handle.GetProperty(myPropertyIndex5).Get(myProperty5);
+        if (myProperty5.EqualTo(new Position2D(200, 300))) LOG( "myProperty5 must be new Position2D(200, 300) get=" + myProperty5, 1);
+        else LOG( "myProperty5 must be new Position2D(200, 300) get=" + myProperty5, 0);
+
+        View view = new View();
+        view.Size2D = new Size2D(new Size(200.0f, 200.0f, 0.0f));
+        view.Name = "MyView1";
+        view.BackgroundColor = new Color(1.0f, 0.0f, 1.0f, 0.8f);
+        LOG("view id: " + view.GetId());
+        LOG("view size: " + view.Size.Width + ", " + view.Size.Height + "," + view.Size.Depth);
+        LOG("view size2d: " + view.Size2D.Width + ", " + view.Size2D.Height);
+        LOG("view name: " + view.Name);
+
+        Stage stage = Stage.GetCurrent();
+        Size2D stageSize = stage.Size;
+        LOG("Stage size2d: " + stageSize.Width + ", " + stageSize.Height);
+        stage.Add(view);
+
+        Size Size = new Size(100, 50, 25);
+        LOG( Size +  "Created. this should be (100, 50, 25)!");
+        LOG( "Size width= " + Size.Width + ", height=" + Size.Height + ",depth=" + Size.Depth );
+        Size += new Size(20, 20, 20);
+        if(Size.EqualTo(new Size(120, 70, 45))){ LOG( "plus Size(20,20,20) should be +20 for each! x =  " + Size.Width + ", y = " + Size.Height + ", z = " + Size.Depth, 1);}
+        else { LOG( "plus Size(20,20,20) should be +20 for each! x =  " + Size.Width + ", y = " + Size.Height + ", z = " + Size.Depth, 0);}
+
+        Size.Width += 10;
+        Size.Height += 10;
+        Size.Depth += 10;
+        if(Size.EqualTo(new Size(130, 80, 55))){ LOG( "plus 10 for each! width =  " + Size.Width + ", height = " + Size.Height + ", depth = " + Size.Depth, 1); }
+        else { LOG( "plus 10 for each! width =  " + Size.Width + ", height = " + Size.Height + ", depth = " + Size.Depth, 0); }
+
+        Position Position = new Position(20, 100, 50);
+        LOG(Position + "Created ");
+        LOG( "Position x =  " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z );
+        Position += new Position(20, 20, 20);
+        if(Position.EqualTo(new Position(40, 120, 70))) LOG( "plus Position(20, 20, 20)! Position x =  " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z, 1);
+        else LOG( "plus Position(20, 20, 20)! Position x =  " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z, 0);
+
+        Position.X += 10;
+        Position.Y += 10;
+        Position.Z += 10;
+        if(Position.EqualTo(new Position(50, 130, 80))) LOG( "plus +10 for each! Position width =  " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z, 1 );
+        else  LOG( "plus +10 for each! Position width =  " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z, 0 );
+
+        Position2D _position2d = new Position2D(new Position(600.0f, 700.0f, 800.0f));
+        LOG(_position2d + "Created ");
+        LOG( "_postion2d x =  " + _position2d.X + ", y = " + _position2d.Y);
+        _position2d += new Position2D(20, 20);
+        if(_position2d.EqualTo(new Position2D(620, 720))) LOG( "plus Position2D(20, 20)! Position x =  " + _position2d.X + ", y = " + _position2d.Y, 1);
+        else LOG( "plus Position2D(20, 20)! Position x =  " + _position2d.X + ", y = " + _position2d.Y, 0);
+
+        Position parentOrigin = ParentOrigin.BottomRight;
+        LOG( "parentOrigin.BottomRight x=" + parentOrigin.X + ", y=" + parentOrigin.Y + ", z=" + parentOrigin.Z );
+
+        Color color = new Color(20, 100, 50, 200);
+        LOG( color +  "    Created ");
+        LOG( "Color R =  " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A );
+        color += new Color(20, 20, 20, 20);
+        if(color.EqualTo(new Color(40, 120, 70, 220))) LOG( "plus Color(20, 20, 20, 20)! Color R =  " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A, 1 );
+        else LOG( "plus Color(20, 20, 20, 20)! Color R =  " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A, 0 );
+        color.R += 10;
+        color.G += 10;
+        color.B += 10;
+        color.A += 10;
+        if(color.EqualTo(new Color(50, 130, 80, 230))) LOG( "plus +10 for each! Color r =  " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A, 1 );
+        else LOG( "plus +10 for each! Color r =  " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A, 0 );
+
+        LOG("=================================");
+      }
+
     }
 }
 
-
index 8687aa0..60c7791 100755 (executable)
@@ -56,14 +56,14 @@ namespace MyCSharpExample
                 StartTime = 0,
                 EndTime = 500,
                 TargetProperty = "Orientation",
-                Destination = new Rotation(new Radian(new Degree(180.0f)), Vect3.Xaxis)
+                Destination = new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X)
             };
             _animation.AnimateTo(_text);
 
             _animation.StartTime = 500;
             _animation.EndTime = 1000;
             _animation.TargetProperty = "Orientation";
-            _animation.Destination = new Rotation(new Radian(new Degree(0.0f)), Vect3.Xaxis);
+            _animation.Destination = new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X);
             _animation.AnimateTo(_text);
 
             _animation.StartTime = 1000;
index b8215ef..6ece63b 100755 (executable)
@@ -153,9 +153,9 @@ namespace ImageViewExample
                 _animation.EndTime = 6000;
                 _animation.TargetProperty = "Size";
                 KeyFrames _keyFrames = new KeyFrames();
-                _keyFrames.Add(0.0f, new Size3D(0.0f, 0.0f, 0.0f));
-                _keyFrames.Add(0.3f, new Size3D((stage.Size * 0.7f)));
-                _keyFrames.Add(1.0f, new Size3D(stage.Size));
+                _keyFrames.Add(0.0f, new Size(0.0f, 0.0f, 0.0f));
+                _keyFrames.Add(0.3f, new Size((stage.Size * 0.7f)));
+                _keyFrames.Add(1.0f, new Size(stage.Size));
                 _animation.AnimateBetween(_imageView, _keyFrames, Animation.Interpolation.Linear);
 
                 _animation.EndAction = Animation.EndActions.Discard;
index 388b077..b4250b3 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
index c4cf845..2527c3d 100755 (executable)
@@ -54,10 +54,10 @@ namespace MyCSharpExample
 
       // Create a scroll view
       _scrollView = new ScrollView();
-      Size stageSize = stage.Size;
-      _scrollView.Size = new Position(stageSize.W, stageSize.H, 0.0f);
-      _scrollView.Position = new Position(0,0,0);
-      _scrollView.AnchorPoint = NDalic.AnchorPointTopLeft;
+      Size2D stageSize = stage.Size;
+      _scrollView.Size = new Position(stageSize.Width, stageSize.Height, 0.0f);
+      _scrollView.ParentOrigin = NDalic.ParentOriginCenter;
+      _scrollView.AnchorPoint = NDalic.AnchorPointCenter;
       stage.Add(_scrollView);
 
       // Add actors to a scroll view with 3 pages
@@ -69,14 +69,15 @@ namespace MyCSharpExample
         {
           View pageActor = new View();
           pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
-          pageActor.AnchorPoint = NDalic.AnchorPointTopLeft;
-          pageActor.Position = new Position(pageColumn * stageSize.W, pageRow * stageSize.H, 0.0f);
+          pageActor.ParentOrigin = NDalic.ParentOriginCenter;
+          pageActor.AnchorPoint = NDalic.AnchorPointCenter;
+          pageActor.Position = new Position(pageColumn * stageSize.Width, pageRow * stageSize.Height, 0.0f);
 
           // Add images in a 3x4 grid layout for each page
           int imageRows = 4;
           int imageColumns = 3;
           float margin = 10.0f;
-          Position imageSize = new Position((stageSize.W / imageColumns) - margin, (stageSize.H / imageRows) - margin, 0.0f);
+          Position imageSize = new Position((stageSize.Width / imageColumns) - margin, (stageSize.Height/ imageRows) - margin, 0.0f);
 
           for(int row = 0; row < imageRows; row++)
           {
@@ -87,8 +88,8 @@ namespace MyCSharpExample
               imageView.ParentOrigin = NDalic.ParentOriginCenter;
               imageView.AnchorPoint = NDalic.AnchorPointCenter;
               imageView.Size = imageSize;
-              imageView.Position = new Position( margin * 0.5f + (imageSize.X + margin) * column - stageSize.W * 0.5f + imageSize.X * 0.5f,
-                  margin * 0.5f + (imageSize.Y + margin) * row - stageSize.H * 0.5f + imageSize.Y * 0.5f, 0.0f );
+              imageView.Position = new Position( margin * 0.5f + (imageSize.X + margin) * column - stageSize.Width * 0.5f + imageSize.X * 0.5f,
+                  margin * 0.5f + (imageSize.Y + margin) * row - stageSize.Height * 0.5f + imageSize.Y * 0.5f, 0.0f );
               pageActor.Add(imageView);
             }
           }
@@ -101,9 +102,9 @@ namespace MyCSharpExample
 
       // Set scroll view to have 3 pages in X axis and allow page snapping,
       // and also disable scrolling in Y axis.
-      RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.W));
+      RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.Width));
       RulerPtr scrollRulerY = new RulerPtr(new DefaultRuler());
-      scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.W * pageColumns, true));
+      scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.Width * pageColumns, true));
       scrollRulerY.Disable();
       _scrollView.SetRulerX(scrollRulerX);
       _scrollView.SetRulerY(scrollRulerY);
old mode 100644 (file)
new mode 100755 (executable)
index 907054e..51c57d9
@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,7 +41,7 @@ namespace MyCSharpExample
             contentLayout.Name = ("ContentLayout");
             contentLayout.WidthResizePolicy = "FILL_TO_PARENT";
             contentLayout.HeightResizePolicy = "FILL_TO_PARENT";
-            contentLayout.SetCellPadding(new Size(0.0f, 5.0f));
+            contentLayout.SetCellPadding(new Size2D(0, 5));
             contentLayout.BackgroundColor = new Color(0.949f, 0.949f, 0.949f, 1.0f);
 
             stage.GetDefaultLayer().Add(contentLayout);
old mode 100644 (file)
new mode 100755 (executable)
index b98a9ef..8762974
@@ -37,7 +37,7 @@ namespace VisualsUsingCustomView
             contentLayout.Name = "ContentLayout";
             contentLayout.WidthResizePolicy = "FILL_TO_PARENT";
             contentLayout.HeightResizePolicy = "FILL_TO_PARENT";
-            contentLayout.SetCellPadding(new Size(5.0f, 5.0f));
+            contentLayout.SetCellPadding(new Size2D(5, 5));
             contentLayout.BackgroundColor = new Color(0.949f, 0.949f, 0.949f, 1.0f);
 
             stage.GetDefaultLayer().Add(contentLayout);
index a1d85dd..573139c 100755 (executable)
@@ -28,6 +28,7 @@
 #include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 #include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -231,6 +232,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_Visual_Property_MIX_COLOR_get() {
   return jresult;
 }
 
+SWIGEXPORT int SWIGSTDCALL CSharp_Image_Visual_BORDER_get() {
+  int jresult ;
+  int result;
+
+  result = (int)Dali::Toolkit::DevelImageVisual::Property::BORDER;
+  jresult = (int)result;
+  return jresult;
+}
+
 #ifdef __cplusplus
 }
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index abcb020..ca0dd01
-namespace Dali
-{
-  using System;
-
-  public enum Colors
-  {
-    Red,
-    White,
-    Blue,
-    Green,
-    Black,
-    Yellow,
-    Magenta,
-    Cyan
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali {
+
+using System;
+
+public class Color : global::System.IDisposable {
+  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Color(global::System.IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
   }
 
+  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj) {
+    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+  }
 
-  public class Color
-  {
+  ~Color() {
+    DisposeQueue.Instance.Add(this);
+  }
 
-    private float r;
-    private float g;
-    private float b;
-    private float a;
-
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     */
-    public Color()
-    {
-      r = 0.0f;
-      g = 0.0f;
-      b = 0.0f;
-      a = 0.0f;
+  public virtual void Dispose() {
+    if (!Stage.IsInstalled()) {
+      DisposeQueue.Instance.Add(this);
+      return;
     }
 
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     * @param [in] red The Color r.
-     * @param [in] green The Color g.
-     * @param [in] blue The Color b.
-     * @param [in] alpha The Color a.
-     */
-    public Color(float red, float green, float blue, float alpha)
-    {
-      r = red;
-      g = green;
-      b = blue;
-      a = alpha;
+    lock(this) {
+      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          NDalicPINVOKE.delete_Vector4(swigCPtr);
+        }
+        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+      }
+      global::System.GC.SuppressFinalize(this);
     }
+  }
 
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     * @param [in] o The Vector4 having r g b a components
-     */
-    public Color(Vector4 o)
-    {
-      r = o.r;
-      g = o.g;
-      b = o.b;
-      a = o.a;
-    }
 
+  public static Color operator+(Color arg1, Color arg2) {
+    return arg1.Add(arg2);
+  }
 
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     * @param [in] color as enum Colors.
-     */
-    public Color(Colors color)
-    {
-      switch (color)
-      {
-        case Colors.Red:
-          SetColor(1.0f, 0.0f, 0.0f, 1.0f);
-          break;
-        case Colors.White:
-          SetColor(1.0f, 1.0f, 1.0f, 1.0f);
-          break;
-        case Colors.Blue:
-          SetColor(0.0f, 0.0f, 1.0f, 1.0f);
-          break;
-        case Colors.Green:
-          SetColor(0.0f, 1.0f, 0.0f, 1.0f);
-          break;
-        case Colors.Black:
-          SetColor(0.0f, 0.0f, 0.0f, 1.0f);
-          break;
-        case Colors.Yellow:
-          SetColor(1.0f, 1.0f, 0.0f, 1.0f);
-          break;
-        case Colors.Cyan:
-          SetColor(0.0f, 1.0f, 1.0f, 1.0f);
-          break;
-        case Colors.Magenta:
-          SetColor(1.0f, 0.0f, 1.0f, 1.0f);
-          break;
-      }
-    }
+  public static Color operator-(Color arg1, Color arg2) {
+    return arg1.Subtract(arg2);
+  }
 
+  public static Color operator-(Color arg1) {
+    return arg1.Subtract();
+  }
 
-    /**
-     * @brief SetColor
-     *
-     * @since 1.0.0
-     * @param [in] red The Color r.
-     * @param [in] green The Color g.
-     * @param [in] blue The Color b.
-     * @param [in] alpha The Color a.
-     */
-    public void SetColor(float red, float green, float blue, float alpha)
-    {
-      r = red;
-      g = green;
-      b = blue;
-      a = alpha;
-    }
+  public static Color operator*(Color arg1, Color arg2) {
+    return arg1.Multiply(arg2);
+  }
 
-    /**
-     * @brief name "R", type float (Color's Red component)
-     * @SINCE_1_0.0
-     */
+  public static Color operator*(Color arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
 
-    public float R
-    {
-      get { return r; }
-      set { r = value; }
-    }
+  public static Color operator/(Color arg1, Color arg2) {
+    return arg1.Divide(arg2);
+  }
 
-    /**
-     * @brief name "G", type float (Color's Green component)
-     * @SINCE_1_0.0
-     */
-    public float G
-    {
-      get { return g; }
-      set { g = value; }
-    }
+  public static Color operator/(Color arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
 
-    /**
-     * @brief name "B", type float (Color's Blue component)
-     * @SINCE_1_0.0
-     */
-    public float B
-    {
-      get { return b; }
-      set { b = value; }
-    }
 
-    /**
-     * @brief name "A", type float (Color's Alpha value)
-     * @SINCE_1_0.0
-     */
-    public float A
+  public float this[uint index]
+  {
+    get
     {
-      get { return a; }
-      set { a = value; }
+      return ValueOfIndex(index);
     }
+  }
 
-    /**
-     * @brief operator+
-     *
-     * @since 1.0.0
-     * @param [in] l The Color to add.
-     * @param [in] r The Color to add
-     * @return A reference to this
-     */
-    public static Color operator +(Color l, Color r)
-    {
-      return new Color(l.R + r.R, l.G + r.G, l.B + r.B, l.A + r.A);
-    }
+  public static Color GetColorFromPtr(global::System.IntPtr cPtr) {
+    Color ret = new Color(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+       return ret;
+  }
 
-    /**
-     * @brief operator-
-     *
-     * @since 1.0.0
-     * @param [in] l The Color to substract.
-     * @param [in] r The Color to substract
-     * @return A reference to this
-     */
-    public static Color operator -(Color l, Color r)
-    {
-      return new Color(l.R - r.R, l.G - r.G, l.B - r.B, l.A - r.A);
-    }
 
-    /**
-     * @brief operator*
-     *
-     * @since 1.0.0
-     * @param [in] a The Color to multiply.
-     * @param [in] b The constant double to multiply.
-     * @return A reference to this
-     */
-    public static Color operator *(Color a, double b)
-    {
-      return new Color((float)(a.R * b), (float)(a.G * b), (float)(a.B * b), (float)(a.A * b));
-    }
+  public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
 
-    /**
-     * @brief operator/
-     *
-     * @since 1.0.0
-     * @param [in] a The Color to divide.
-     * @param [in] b The Color to divide
-     * @return float value of division operation
-     */
-    public static float operator /(Color a, Color b)
-    {
-      return (float)System.Math.Sqrt((a.R / b.R) * (a.G / b.G) * (a.B / b.B) * (a.A / b.A));
-    }
+  public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(r, g, b, a), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
 
-    /**
-     * @brief Operator ==
-     *
-     * @since 1.0.0
-     * @param [in] x The Color object to compare.
-     * @param [in] y The Color object to compare.
-     * @return bool, whether colors are equal or not
-     */
-    public static bool operator == (Color x, Color y)
-    {
-      return x.R == y.R && x.G == y.G && x.B == y.B && x.A == y.A;
-    }
+  public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
 
-    /**
-     * @brief Operator !=
-     *
-     * @since 1.0.0
-     * @param [in] x The Color object to compare.
-     * @param [in] y The Color object to compare.
-     * @return bool, whether colors are equal or not
-     */
-    public static bool operator != (Color x, Color y)
-    {
-      return x.R != y.R || x.G != y.G || x.B != y.B || x.A != y.A;
-    }
+  private Color Add(Color rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    /**
-     * @brief GetHashCode
-     *
-     * @since 1.0.0
-     * @return int, hascode of Color
-     */
-    public override int GetHashCode()
-    {
-      return base.GetHashCode();
+  private Color AddAssign(Vector4 rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color Subtract(Color rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color SubtractAssign(Color rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color Multiply(Color rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color Multiply(float rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color MultiplyAssign(Color rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color MultiplyAssign(float rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color Divide(Vector4 rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color Divide(float rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color DivideAssign(Color rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color DivideAssign(float rhs) {
+    Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Color Subtract() {
+    Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool EqualTo(Color rhs) {
+    bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
+
+    if(rhs == null) return false;
+
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool NotEqualTo(Color rhs) {
+    bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  private float ValueOfIndex(uint index) {
+    float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public float R {
+    set {
+      NDalicPINVOKE.Vector4_r_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief Clone
-     *
-     * @since 1.0.0
-     * @return Color object
-     */
-    public Color Clone()
-    {
-      Color copy = new Color(R, G, B, A);
-      return copy;
+  public float G {
+    set {
+      NDalicPINVOKE.Vector4_g_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
+    get {
+      float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
 
-    // Create a color for RGBA values ranging from 0..255, useful when dealing with HTML colors
-    static Color FromRgbaByte( byte red, byte green, byte blue, byte alpha )
-    {
-      return new Color ( red / 255,  green / 255, blue / 255, alpha / 255 );
+  public float B {
+    set {
+      NDalicPINVOKE.Vector4_b_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    // User-defined conversion from Color to Vector4
-    public static implicit operator Vector4(Color color)
-    {
-      return new Vector4(color.r, color.g, color.b, color.a);
+  public float A {
+    set {
+      NDalicPINVOKE.Vector4_a_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
+    get {
+      float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
 
-    public static implicit operator Color(Vector4 vec)
-    {
-      return new Color(vec.r, vec.g, vec.b, vec.a);
+  public static Color Black {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.BLACK_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "White", type Color (White Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color White
-    {
-      get
-      {
-        return new Color(Colors.White);
-      }
+  public static Color White {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.WHITE_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "Black", type Color (Black Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color Black
-    {
-      get
-      {
-        return new Color(Colors.Black);
-      }
+  public static Color Red {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.RED_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "Red", type Color (Red Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color Red
-    {
-      get
-      {
-        return new Color(Colors.Red);
-      }
+  public static Color Green {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.GREEN_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "Green", type Color (Green Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color Green
-    {
-      get
-      {
-        return new Color(Colors.Green);
-      }
+  public static Color Blue {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.BLUE_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "Blue", type Color (Blue Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color Blue
-    {
-      get
-      {
-        return new Color(Colors.Blue);
-      }
+  public static Color Yellow {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.YELLOW_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "Yellow", type Color (Yellow Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color Yellow
-    {
-      get
-      {
-        return new Color(Colors.Yellow);
-      }
+  public static Color Magenta {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.MAGENTA_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "Magenta", type Color (Magenta Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color Magenta
-    {
-      get
-      {
-        return new Color(Colors.Magenta);
-      }
+  public static Color Cyan {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.CYAN_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief name "Cyan", type Color (Cyan Color object)
-     * @SINCE_1_0.0
-     */
-    public static Color Cyan
-    {
-      get
-      {
-        return new Color(Colors.Cyan);
-      }
+  public static Color Transparent {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.TRANSPARENT_get();
+      Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
   }
+
+  public static implicit operator Vector4(Color color)
+  {
+    return new Vector4(color.R, color.G, color.B, color.A);
+  }
+
+  public static implicit operator Color(Vector4 vec)
+  {
+    return new Color(vec.r, vec.g, vec.b, vec.a);
+  }
+
 }
+
+}
+
+
index 885070c..7a1e36e 100755 (executable)
@@ -46,54 +46,6 @@ namespace Dali
       OrthographicProjection = Dali.ProjectionMode.ORTHOGRAPHIC_PROJECTION      ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0
     }
 
-    public struct ParentOrigin
-    {
-      public static readonly float Top = NDalic.ParentOriginTop;
-      public static readonly float Bottom = NDalic.ParentOriginBottom;
-      public static readonly float Left = NDalic.ParentOriginLeft;
-      public static readonly float Right = NDalic.ParentOriginRight;
-      public static readonly float Middle = NDalic.ParentOriginMiddle;
-      public static readonly Dali.Vector3 TopLeft = NDalic.ParentOriginTopLeft;
-      public static readonly Dali.Vector3 TopCenter = NDalic.ParentOriginTopCenter;
-      public static readonly Dali.Vector3 TopRight = NDalic.ParentOriginTopRight;
-      public static readonly Dali.Vector3 CenterLeft = NDalic.ParentOriginCenterLeft;
-      public static readonly Dali.Vector3 Center = NDalic.ParentOriginCenter;
-      public static readonly Dali.Vector3 CenterRight = NDalic.ParentOriginCenterRight;
-      public static readonly Dali.Vector3 BottomLeft = NDalic.ParentOriginBottomLeft;
-      public static readonly Dali.Vector3 BottomCenter = NDalic.ParentOriginBottomCenter;
-      public static readonly Dali.Vector3 BottomRight = NDalic.ParentOriginBottomRight;
-    }
-
-    public struct AnchorPoint
-    {
-      public static readonly float Top = NDalic.AnchorPointTop;
-      public static readonly float Bottom = NDalic.AnchorPointBottom;
-      public static readonly float Left = NDalic.AnchorPointLeft;
-      public static readonly float Right = NDalic.AnchorPointRight;
-      public static readonly float Middle = NDalic.AnchorPointMiddle;
-      public static readonly Dali.Vector3 TopLeft = NDalic.AnchorPointTopLeft;
-      public static readonly Dali.Vector3 TopCenter = NDalic.AnchorPointTopCenter;
-      public static readonly Dali.Vector3 TopRight = NDalic.AnchorPointTopRight;
-      public static readonly Dali.Vector3 CenterLeft = NDalic.AnchorPointCenterLeft;
-      public static readonly Dali.Vector3 Center = NDalic.AnchorPointCenter;
-      public static readonly Dali.Vector3 CenterRight = NDalic.AnchorPointCenterRight;
-      public static readonly Dali.Vector3 BottomLeft = NDalic.AnchorPointBottomLeft;
-      public static readonly Dali.Vector3 BottomCenter = NDalic.AnchorPointBottomCenter;
-      public static readonly Dali.Vector3 BottomRight = NDalic.AnchorPointBottomRight;
-    }
-
-    public struct Vect3
-    {
-      public static readonly Dali.Vector3 One = Dali.Vector3.ONE;
-      public static readonly Dali.Vector3 Xaxis = Dali.Vector3.XAXIS;
-      public static readonly Dali.Vector3 Yaxis = Dali.Vector3.YAXIS;
-      public static readonly Dali.Vector3 Zaxis = Dali.Vector3.ZAXIS;
-      public static readonly Dali.Vector3 NegativeXaxis = Dali.Vector3.NEGATIVE_XAXIS;
-      public static readonly Dali.Vector3 NegativeYaxis = Dali.Vector3.NEGATIVE_YAXIS;
-      public static readonly Dali.Vector3 NegativeZaxis = Dali.Vector3.NEGATIVE_ZAXIS;
-      public static readonly Dali.Vector3 Zero = Dali.Vector3.ZERO;
-    }
-
     public struct Direction
     {
       public enum Type
@@ -130,7 +82,10 @@ namespace Dali
         Mesh = Dali.VisualType.MESH,
         Primitive = Dali.VisualType.PRIMITIVE,
         WireFrame = Dali.VisualType.WIREFRAME,
-        Text = Dali.VisualType.TEXT
+        Text = Dali.VisualType.TEXT,
+        NPatch = Dali.VisualType.N_PATCH,
+        Svg = Dali.VisualType.SVG,
+        AnimatedImage = Dali.VisualType.ANIMATED_IMAGE
       }
 
       public struct Property
@@ -188,6 +143,7 @@ namespace Dali
       public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
       public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
       public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
+      public static readonly int Border = NDalic.IMAGE_VISUAL_BORDER;
     }
 
     public struct MeshVisualProperty
index a7ce0a2..3998705 100755 (executable)
@@ -270,5 +270,8 @@ namespace Dali
 
         [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Visual_Property_MIX_COLOR_get")]
         public static extern int Visual_Property_MIX_COLOR_get();
+
+        [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Image_Visual_BORDER_get")]
+        public static extern int Image_Visual_BORDER_get();
     }
 }
old mode 100644 (file)
new mode 100755 (executable)
index e7c72a9..b705ac6
-namespace Dali
-{
-  using System;
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
-  public class Position
-  {
+namespace Dali {
 
-    private float x;
-    private float y;
-    private float z;
+public class Position : global::System.IDisposable {
+  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+  protected bool swigCMemOwn;
 
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     */
-    public Position()
-    {
-      x = 0.0f;
-      y = 0.0f;
-      z = 0.0f;
-    }
-
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     * @param [in] a The Position X.
-     * @param [in] b The Position Y.
-     * @param [in] c The Position Z.
-     */
-    public Position(float a, float b, float c)
-    {
-      x = a;
-      y = b;
-      z = c;
-    }
-
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     * @param [in] o The Vector Position X, Y, Z.
-     */
-    public Position(Vector3 o)
-    {
-      x = o.X;
-      y = o.Y;
-      z = o.Z;
+  internal Position(global::System.IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+  }
+
+  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position obj) {
+    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~Position() {
+    DisposeQueue.Instance.Add(this);
+  }
+
+  public virtual void Dispose() {
+    if (!Stage.IsInstalled()) {
+      DisposeQueue.Instance.Add(this);
+      return;
     }
 
-    ///< name "X", type float (Position X value)
-    //@since 1.0.0
-    public float X
-    {
-      get { return x; }
-      set { x = value; }
+    lock(this) {
+      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          NDalicPINVOKE.delete_Vector3(swigCPtr);
+        }
+        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+      }
+      global::System.GC.SuppressFinalize(this);
     }
+  }
+
+
+  public static Position operator+(Position arg1, Position arg2) {
+    return arg1.Add(arg2);
+  }
+
+  public static Position operator-(Position arg1, Position arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Position operator-(Position arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Position operator*(Position arg1, Position arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Position operator*(Position arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Position operator/(Position arg1, Position arg2) {
+    return arg1.Divide(arg2);
+  }
 
-    ///< name "Y", type float (Position Y value)
-    //@since 1.0.0
-    public float Y
+  public static Position operator/(Position arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
+
+
+  public float this[uint index]
+  {
+    get
     {
-      get { return y; }
-      set { y = value; }
+      return ValueOfIndex(index);
     }
+  }
 
-    ///< name "Z", type float (Position Z value)
-    //@since 1.0.0
-    public float Z
-    {
-      get { return z; }
-      set { z = value; }
-    }
-
-    /**
-     * @brief operator+
-     *
-     * @since 1.0.0
-     * @param [in] l The Position to add.
-     * @param [in] r The Position to add
-     * @return A reference to this
-     */
-    public static Position operator +(Position l, Position r)
-    {
-      return new Position(l.X + r.X, l.Y + r.Y, l.Z + r.Z);
-    }
-
-    /**
-     * @brief operator-
-     *
-     * @since 1.0.0
-     * @param [in] l The Position to substract.
-     * @param [in] r The Position to substract
-     * @return A reference to this
-     */
-    public static Position operator -(Position l, Position r)
-    {
-      return new Position(l.X - r.X, l.Y - r.Y, l.Z - r.Z);
-    }
-
-    /**
-     * @brief operator*
-     *
-     * @since 1.0.0
-     * @param [in] a The Position to multiply.
-     * @param [in] b The constant to multiply of type double.
-     * @return A reference to this
-     */
-    public static Position operator *(Position a, double b)
-    {
-      return new Position((int)(a.X * b), (int)(a.Y * b), (int)(a.Z * b));
-    }
-
-    /**
-     * @brief operator/
-     *
-     * @since 1.0.0
-     * @param [in] a The Position to divide.
-     * @param [in] b The Position to divide
-     * @return float value of division operation
-     */
-    public static float operator /(Position a, Position b)
-    {
-      return (float)System.Math.Sqrt((a.X / b.X) * (a.Y / b.Y) * (a.Z / b.Z));
-    }
-
-    /**
-     * @brief Operator ==
-     *
-     * @since 1.0.0
-     * @param [in] a The Position object to compare.
-     * @param [in] b The Position object to compare.
-     * @return bool, whether Position are equal or not
-     */
-    public static bool operator == (Position a, Position b)
-    {
-      return a.X == b.X && a.Y == b.Y && a.Z == b.Z;
-    }
-
-    /**
-     * @brief Operator !=
-     *
-     * @since 1.0.0
-     * @param [in] a The Position object to compare.
-     * @param [in] b The Position object to compare.
-     * @return bool, whether Position are equal or not
-     */
-    public static bool operator != (Position a, Position b)
-    {
-      return a.X != b.X || a.Y != b.Y || a.Z == b.Z;
+  public static Position GetPositionFromPtr(global::System.IntPtr cPtr) {
+    Position ret = new Position(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+       return ret;
+  }
+
+
+  public Position() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Position(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Position(Position2D position2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Position2D.getCPtr(position2d)), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+
+
+  private Position Add(Position rhs) {
+    Position ret = new Position(NDalicPINVOKE.Vector3_Add(swigCPtr, Position.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position Subtract(Position rhs) {
+    Position ret = new Position(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position Multiply(Position rhs) {
+    Position ret = new Position(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position Multiply(float rhs) {
+    Position ret = new Position(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position Divide(Position rhs) {
+    Position ret = new Position(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position Divide(float rhs) {
+    Position ret = new Position(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position Subtract() {
+    Position ret = new Position(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private float ValueOfIndex(uint index) {
+    float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool EqualTo(Position rhs) {
+    bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Position.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool NotEqualTo(Position rhs) {
+    bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Position.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  public float X {
+    set {
+      NDalicPINVOKE.Vector3_X_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
+    get {
+      float ret = NDalicPINVOKE.Vector3_X_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
 
-    /**
-     * @brief GetHashCode
-     *
-     * @since 1.0.0
-     * @return int, hascode of position
-     */
-    public override int GetHashCode()
-    {
-      return base.GetHashCode();
+  public float Y {
+    set {
+      NDalicPINVOKE.Vector3_Y_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Y_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
 
-    /**
-     * @brief Clone
-     *
-     * @since 1.0.0
-     * @return Position object
-     */
-    public Position Clone()
-    {
-      Position copy = new Position(X, Y, Z);
-      return copy;
+  public float Z {
+    set {
+      NDalicPINVOKE.Vector3_Z_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Z_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
 
-    // User-defined conversion from Position to Vector3
-    public static implicit operator Vector3(Position pos)
-    {
-      return new Vector3(pos.x, pos.y, pos.z);
+  internal static float ParentOriginTop
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.ParentOriginTop_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float ParentOriginBottom
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.ParentOriginBottom_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float ParentOriginLeft
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.ParentOriginLeft_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float ParentOriginRight
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.ParentOriginRight_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float ParentOriginMiddle
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.ParentOriginMiddle_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginTopLeft
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopLeft_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginTopCenter
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopCenter_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginTopRight
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopRight_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginCenterLeft
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterLeft_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginCenter
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenter_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginCenterRight
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterRight_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginBottomLeft
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomLeft_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginBottomCenter
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomCenter_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position ParentOriginBottomRight
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomRight_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float AnchorPointTop
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.AnchorPointTop_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float AnchorPointBottom
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.AnchorPointBottom_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float AnchorPointLeft
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.AnchorPointLeft_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float AnchorPointRight
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.AnchorPointRight_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static float AnchorPointMiddle
+  {
+      get
+      {
+          float ret = NDalicPINVOKE.AnchorPointMiddle_get();
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointTopLeft
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopLeft_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointTopCenter
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopCenter_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointTopRight
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopRight_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointCenterLeft
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterLeft_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointCenter
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenter_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointCenterRight
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterRight_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointBottomLeft
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomLeft_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointBottomCenter
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomCenter_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  internal static Position AnchorPointBottomRight
+  {
+      get
+      {
+          global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomRight_get();
+          Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+          if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+          return ret;
+      }
+  }
+
+  public static Position One {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ONE_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    public static implicit operator Position(Vector3 vec)
-    {
-      return new Position(vec.X, vec.Y, vec.Z);
+  internal static Position XAxis {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_XAXIS_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
+
+  internal static Position YAxis {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_YAXIS_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
+
+  internal static Position ZAxis {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZAXIS_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
+
+  internal static Position NegativeXAxis {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_XAXIS_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
+
+  internal static Position NegativeYAxis {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_YAXIS_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
+
+  internal static Position NegativeZAxis {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_ZAXIS_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    }
+  }
+
+  public static Position Zero {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get();
+      Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
   }
+
+  public static implicit operator Vector3(Position Position)
+  {
+    return new Vector3(Position.X, Position.Y, Position.Z);
+  }
+
+  public static implicit operator Position(Vector3 vec)
+  {
+    return new Position(vec.X, vec.Y, vec.Z);
+  }
+
+}
+
+  public struct ParentOrigin
+  {
+      public static readonly float Top = Position.ParentOriginTop;
+      public static readonly float Bottom = Position.ParentOriginBottom;
+      public static readonly float Left = Position.ParentOriginLeft;
+      public static readonly float Right = Position.ParentOriginRight;
+      public static readonly float Middle = Position.ParentOriginMiddle;
+      public static readonly Position TopLeft = Position.ParentOriginTopLeft;
+      public static readonly Position TopCenter = Position.ParentOriginTopCenter;
+      public static readonly Position TopRight = Position.ParentOriginTopRight;
+      public static readonly Position CenterLeft = Position.ParentOriginCenterLeft;
+      public static readonly Position Center = Position.ParentOriginCenter;
+      public static readonly Position CenterRight = Position.ParentOriginCenterRight;
+      public static readonly Position BottomLeft = Position.ParentOriginBottomLeft;
+      public static readonly Position BottomCenter = Position.ParentOriginBottomCenter;
+      public static readonly Position BottomRight = Position.ParentOriginBottomRight;
+  }
+  public struct AnchorPoint
+  {
+      public static readonly float Top = Position.AnchorPointTop;
+      public static readonly float Bottom = Position.AnchorPointBottom;
+      public static readonly float Left = Position.AnchorPointLeft;
+      public static readonly float Right = Position.AnchorPointRight;
+      public static readonly float Middle = Position.AnchorPointMiddle;
+      public static readonly Position TopLeft = Position.AnchorPointTopLeft;
+      public static readonly Position TopCenter = Position.AnchorPointTopCenter;
+      public static readonly Position TopRight = Position.AnchorPointTopRight;
+      public static readonly Position CenterLeft = Position.AnchorPointCenterLeft;
+      public static readonly Position Center = Position.AnchorPointCenter;
+      public static readonly Position CenterRight = Position.AnchorPointCenterRight;
+      public static readonly Position BottomLeft = Position.AnchorPointBottomLeft;
+      public static readonly Position BottomCenter = Position.AnchorPointBottomCenter;
+      public static readonly Position BottomRight = Position.AnchorPointBottomRight;
+  }
+  public struct PositionAxis
+  {
+      public static readonly Position X = Position.XAxis;
+      public static readonly Position Y = Position.YAxis;
+      public static readonly Position Z = Position.ZAxis;
+      public static readonly Position NegativeX = Position.NegativeXAxis;
+      public static readonly Position NegativeY = Position.NegativeYAxis;
+      public static readonly Position NegativeZ = Position.NegativeZAxis;
+  }
+
 }
+
+
diff --git a/plugins/dali-swig/manual/csharp/Position2D.cs b/plugins/dali-swig/manual/csharp/Position2D.cs
new file mode 100755 (executable)
index 0000000..668b5b0
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali {
+
+public class Position2D : global::System.IDisposable {
+  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Position2D(global::System.IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+  }
+
+  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position2D obj) {
+    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~Position2D() {
+    DisposeQueue.Instance.Add(this);
+  }
+
+  public virtual void Dispose() {
+    if (!Stage.IsInstalled()) {
+      DisposeQueue.Instance.Add(this);
+      return;
+    }
+
+    lock(this) {
+      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          NDalicPINVOKE.delete_Vector2(swigCPtr);
+        }
+        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+      }
+      global::System.GC.SuppressFinalize(this);
+    }
+  }
+
+
+  public static Position2D operator+(Position2D arg1, Position2D arg2) {
+    return arg1.Add(arg2);
+  }
+
+  public static Position2D operator-(Position2D arg1, Position2D arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Position2D operator-(Position2D arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Position2D operator*(Position2D arg1, Position2D arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Position2D operator*(Position2D arg1, int arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Position2D operator/(Position2D arg1, Position2D arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public static Position2D operator/(Position2D arg1, int arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public float this[uint index]
+  {
+    get
+    {
+      return ValueOfIndex(index);
+    }
+  }
+
+  public static Position2D GetPosition2DFromPtr(global::System.IntPtr cPtr) {
+    Position2D ret = new Position2D(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+       return ret;
+  }
+
+
+  public Position2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Position2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Position2D(Position position) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Position.getCPtr(position)), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  private Position2D Add(Position2D rhs) {
+    Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Position2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position2D Subtract(Position2D rhs) {
+    Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  private Position2D Multiply(Position2D rhs) {
+    Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position2D Multiply(int rhs) {
+    Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  private Position2D Divide(Position2D rhs) {
+    Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position2D Divide(int rhs) {
+    Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Position2D Subtract() {
+    Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool EqualTo(Position2D rhs) {
+    bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Position2D.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool NotEqualTo(Position2D rhs) {
+    bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Position2D.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private int ValueOfIndex(uint index) {
+    int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  public int X {
+    set {
+      NDalicPINVOKE.Vector2_X_set(swigCPtr, (float)value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return (int)ret;
+    }
+  }
+
+  public int Y {
+    set {
+      NDalicPINVOKE.Vector2_Y_set(swigCPtr, (float)value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return (int)ret;
+    }
+  }
+
+  public static implicit operator Vector2(Position2D position2d)
+  {
+    return new Vector2((float)position2d.X, (float)position2d.Y);
+  }
+
+  public static implicit operator Position2D(Vector2 vec)
+  {
+    return new Position2D((int)vec.X, (int)vec.Y);
+  }
+
+}
+
+}
+
+
old mode 100644 (file)
new mode 100755 (executable)
index d238d36..930557f
-namespace Dali
-{
-  using System;
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali {
+
+public class Size : global::System.IDisposable {
+  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Size(global::System.IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+  }
 
-  public class Size
-  {
-    private float width;
-    private float height;
-
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     * @param [in] a Width value .
-     * @param [in] b Height value.
-     */
-    public Size(float a, float b)
-    {
-      width = a;
-      height = b;
-    }
-    /**
-     * @brief default constructor
-     *
-     * @since 1.0.0
-     */
-    public Size()
-    {
-      width = 0.0f;
-      height = 0.0f;
-    }
+  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size obj) {
+    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+  }
 
-    /**
-     * @brief constructor with base class object
-     *
-     * @since 1.0.0
-     * @param [in] o The Vector2 with Width, Height values.
-     */
-    public Size(Vector2 o)
-    {
-      width = o.X;
-      height = o.Y;
-    }
+  ~Size() {
+    DisposeQueue.Instance.Add(this);
+  }
 
-    /**
-     * @brief Copy constructor
-     *
-     * @since 1.0.0
-     * @param [in] o The Size having Width & Y.
-     */
-    public Size(Size a)
-    {
-      width = a.width;
-      height = a.height;
+  public virtual void Dispose() {
+    if (!Stage.IsInstalled()) {
+      DisposeQueue.Instance.Add(this);
+      return;
     }
 
-    ///< name "W", type float (Size Width value)
-    //@since 1.0.0
-    public float W
-    {
-      get { return width; }
-      set { width = value; }
+    lock(this) {
+      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          NDalicPINVOKE.delete_Vector3(swigCPtr);
+        }
+        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+      }
+      global::System.GC.SuppressFinalize(this);
     }
+  }
 
-    ///< name "H", type float (Size Height value)
-    //@since 1.0.0
-    public float H
-    {
-      get { return height; }
-      set { height = value; }
-    }
 
-    public float Width
-    {
-      get { return width; }
-      set { width = value; }
-    }
+  public static Size operator+(Size arg1, Size arg2) {
+    return arg1.Add(arg2);
+  }
 
-    public float Height
-    {
-      get { return height; }
-      set { height = value; }
-    }
+  public static Size operator-(Size arg1, Size arg2) {
+    return arg1.Subtract(arg2);
+  }
 
-    /**
-     * @brief operator+
-     *
-     * @since 1.0.0
-     * @param [in] l The Size to add.
-     * @param [in] r The Size to add
-     * @return A reference to this
-     */
-    public static Size operator +(Size l, Size r)
-    {
-      return new Size(l.W + r.W, l.H + r.H);
-    }
+  public static Size operator-(Size arg1) {
+    return arg1.Subtract();
+  }
 
-    /**
-     * @brief operator-
-     *
-     * @since 1.0.0
-     * @param [in] l The Size to substract.
-     * @param [in] r The Size to substract
-     * @return A reference to this
-     */
-    public static Size operator -(Size l, Size r)
-    {
-      return new Size(l.W - r.W, l.H - r.H);
-    }
+  public static Size operator*(Size arg1, Size arg2) {
+    return arg1.Multiply(arg2);
+  }
 
-    /**
-     * @brief operator*
-     *
-     * @since 1.0.0
-     * @param [in] a The Size to multiply
-     * @param [in] b The constant to multiply of type double.
-     * @return A reference to this
-     */
-    public static Size operator *(Size a, double b)
-    {
-      return new Size((float)(a.W * b), (float)(a.H * b));
-    }
+  public static Size operator*(Size arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
 
-    /**
-     * @brief operator/
-     *
-     * @since 1.0.0
-     * @param [in] a The Size to divide.
-     * @param [in] b The Size to divide
-     * @return float of the size division
-     */
-    public static float operator /(Size a, Size b)
-    {
-      return (float)System.Math.Sqrt((a.W / b.W) * (a.H / b.H));
-    }
+  public static Size operator/(Size arg1, Size arg2) {
+    return arg1.Divide(arg2);
+  }
 
-    /**
-     * @brief Operator ==
-     *
-     * @since 1.0.0
-     * @param [in] a The Size object to compare.
-     * @param [in] b The Size object to compare.
-     * @return bool, whether Size are equal or not
-     */
-    public static bool operator == (Size a, Size b)
-    {
-      return a.W == b.W && a.H == b.H ;
-    }
+  public static Size operator/(Size arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
 
-    /**
-     * @brief Operator !=
-     *
-     * @since 1.0.0
-     * @param [in] a The Size object to compare.
-     * @param [in] b The Size object to compare.
-     * @return bool, whether Size are equal or not
-     */
-    public static bool operator != (Size a, Size b)
+  public float this[uint index]
+  {
+    get
     {
-      return a.W != b.W || a.H != b.H;
+      return ValueOfIndex(index);
     }
+  }
 
-    /**
-     * @brief GetHashCode
-     *
-     * @since 1.0.0
-     * @return int, hascode of Size
-     */
-    public override int GetHashCode()
-    {
-      return (int)(W + H);
-    }
+  public static Size GetSizeFromPtr(global::System.IntPtr cPtr) {
+    Size ret = new Size(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+       return ret;
+  }
 
-    /**
-     * @brief Clone
-     *
-     * @since 1.0.0
-     * @return returns a copy of Size object
-     */
-    public Size Clone()
-    {
-      Size copy = new Size(W, H);
-      return copy;
-    }
 
-    // User-defined conversion from Position to Vector2
-    public static implicit operator Vector2(Size size)
-    {
-      return new Vector2(size.width, size.height);
-    }
+  public Size() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
 
-    public static implicit operator Size(Vector2 vec)
-    {
-      return new Size(vec.X, vec.Y);
-    }
+  public Size(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
   }
 
-  public class Size3D
-  {
-    private float width;
-    private float height;
-    private float depth;
+  public Size(Size2D size2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Size2D.getCPtr(size2d)), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
 
-    public Size3D(float a, float b, float c)
-    {
-      width = a;
-      height = b;
-      depth = c;
-    }
 
-    public Size3D()
-    {
-      width = 0.0f;
-      height = 0.0f;
-      depth = 0.0f;
+  public static Size Zero {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get();
+      Size ret = (cPtr == global::System.IntPtr.Zero) ? null : new Size(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    public Size3D(Vector3 o)
-    {
-      width = o.X;
-      height = o.Y;
-      depth = o.Z;
-    }
+  private Size Add(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Add(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public Size3D(Vector2 o)
-    {
-      width = o.X;
-      height = o.Y;
-      depth = 0.0f;
-    }
+  private Size Subtract(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public Size3D(Size3D a)
-    {
-      width = a.width;
-      height = a.height;
-      depth = a.depth;
-    }
+  private Size Multiply(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float W
-    {
-      get { return width; }
-      set { width = value; }
-    }
+  private Size Multiply(float rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float H
-    {
-      get { return height; }
-      set { height = value; }
-    }
+  private Size Divide(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float D
-    {
-      get { return depth; }
-      set { depth = value; }
-    }
+  private Size Divide(float rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float Width
-    {
-      get { return width; }
-      set { width = value; }
-    }
+  private Size Subtract() {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float Height
-    {
-      get { return height; }
-      set { height = value; }
-    }
+  private float ValueOfIndex(uint index) {
+    float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float Depth
-    {
-      get { return depth; }
-      set { depth = value; }
-    }
+  public bool EqualTo(Size rhs) {
+    bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Size.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float X
-    {
-      get { return width; }
-      set { width = value; }
-    }
+  public bool NotEqualTo(Size rhs) {
+    bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Size.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
 
-    public float Y
-    {
-      get { return height; }
-      set { height = value; }
-    }
 
-    public float Z
-    {
-      get { return depth; }
-      set { depth = value; }
+  public float Width {
+    set {
+      NDalicPINVOKE.Vector3_Width_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Width_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    // User-defined conversion from Position to Vector3
-    public static implicit operator Vector3(Size3D size)
-    {
-      return new Vector3(size.width, size.height, size.depth);
+  public float Height {
+    set {
+      NDalicPINVOKE.Vector3_Height_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Height_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    public static implicit operator Size3D(Vector3 vec)
-    {
-      return new Size3D(vec.X, vec.Y, vec.Z);
+  public float Depth {
+    set {
+      NDalicPINVOKE.Vector3_Depth_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Depth_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
+
+
+  public static implicit operator Vector3(Size size)
+  {
+    return new Vector3(size.Width, size.Height, size.Depth);
+  }
 
+  public static implicit operator Size(Vector3 vec)
+  {
+    return new Size(vec.Width, vec.Height, vec.Depth);
   }
 
 }
+
+}
+
diff --git a/plugins/dali-swig/manual/csharp/Size2D.cs b/plugins/dali-swig/manual/csharp/Size2D.cs
new file mode 100755 (executable)
index 0000000..fb37d41
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali {
+
+public class Size2D : global::System.IDisposable {
+  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Size2D(global::System.IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+  }
+
+  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size2D obj) {
+    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~Size2D() {
+    DisposeQueue.Instance.Add(this);
+  }
+
+  public virtual void Dispose() {
+    if (!Stage.IsInstalled()) {
+      DisposeQueue.Instance.Add(this);
+      return;
+    }
+
+    lock(this) {
+      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          NDalicPINVOKE.delete_Vector2(swigCPtr);
+        }
+        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+      }
+      global::System.GC.SuppressFinalize(this);
+    }
+  }
+
+
+  public static Size2D operator+(Size2D arg1, Size2D arg2) {
+    return arg1.Add(arg2);
+  }
+
+  public static Size2D operator-(Size2D arg1, Size2D arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Size2D operator-(Size2D arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Size2D operator*(Size2D arg1, Size2D arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Size2D operator*(Size2D arg1, int arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Size2D operator/(Size2D arg1, Size2D arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public static Size2D operator/(Size2D arg1, int arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public float this[uint index]
+  {
+    get
+    {
+      return ValueOfIndex(index);
+    }
+  }
+
+  public static Size2D GetSize2DFromPtr(global::System.IntPtr cPtr) {
+    Size2D ret = new Size2D(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+       return ret;
+  }
+
+
+  public Size2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Size2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Size2D(Size size) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Size.getCPtr(size)), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  private Size2D Add(Size2D rhs) {
+    Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Size2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size2D Subtract(Size2D rhs) {
+    Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  private Size2D Multiply(Size2D rhs) {
+    Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size2D Multiply(int rhs) {
+    Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  private Size2D Divide(Size2D rhs) {
+    Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size2D Divide(int rhs) {
+    Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size2D Subtract() {
+    Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool EqualTo(Size2D rhs) {
+    bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Size2D.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool NotEqualTo(Size2D rhs) {
+    bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Size2D.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private int ValueOfIndex(uint index) {
+    int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  public int Width {
+    set {
+      NDalicPINVOKE.Vector2_Width_set(swigCPtr, (float)value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return (int)ret;
+    }
+  }
+
+  public int Height {
+    set {
+      NDalicPINVOKE.Vector2_Height_set(swigCPtr, (float)value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return (int)ret;
+    }
+  }
+
+  public static implicit operator Vector2(Size2D size)
+  {
+    return new Vector2((float)size.Width, (float)size.Height);
+  }
+
+  public static implicit operator Size2D(Vector2 vec)
+  {
+    return new Size2D((int)vec.X, (int)vec.Y);
+  }
+
+}
+
+}
+
old mode 100644 (file)
new mode 100755 (executable)
index b055a7d..a359297
@@ -492,12 +492,11 @@ namespace Dali
         }
         else if ( type.Equals (typeof(Size)) )
         {
-          // DALi sizes are Vector3
-          Vector3 value = new Vector3();
+          Size value = new Size();
           ok = propValue.Get( value );
           if ( ok )
           {
-            propertyInfo.SetValue(view, new Size(value.X,value.Y));
+            propertyInfo.SetValue(view, new Size(value.Width, value.Height, value.Depth));
           };
         }
         else if ( type.Equals (typeof(Color)) )
index 982c304..358a6bb 100644 (file)
@@ -110,11 +110,17 @@ namespace Dali
 
         ~ViewWrapperImpl()
         {
-            Dispose();
+            DisposeQueue.Instance.Add(this);
         }
 
         public override void Dispose()
         {
+            if (!Stage.IsInstalled())
+            {
+                DisposeQueue.Instance.Add(this);
+                return;
+            }
+
             lock(this)
             {
                 if (swigCPtr.Handle != global::System.IntPtr.Zero)