[dali_1.0.47] Merge branch 'devel/master' 97/42697/1
authorFerran Sole <ferran.sole@samsung.com>
Wed, 1 Jul 2015 13:19:23 +0000 (14:19 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Wed, 1 Jul 2015 13:19:23 +0000 (14:19 +0100)
Change-Id: I5f90be6c874f1abd592bea10456473c00397b9dd

222 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h [moved from automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.h with 54% similarity]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp [deleted file]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.h [new file with mode: 0644]
automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp [moved from automated-tests/src/dali-toolkit/utc-Dali-AccessibilityFocusManager.cpp with 80% similarity]
automated-tests/src/dali-toolkit/utc-Dali-BendyEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-BlindEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp
automated-tests/src/dali-toolkit/utc-Dali-Builder.cpp
automated-tests/src/dali-toolkit/utc-Dali-CarouselEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
automated-tests/src/dali-toolkit/utc-Dali-DisplacementEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-DissolveEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-DistanceFieldEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-IrisEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp
automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp
automated-tests/src/dali-toolkit/utc-Dali-OverlayEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-PageTurnEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-Ripple2DEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-RippleEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-Script.cpp [moved from automated-tests/src/dali-toolkit/utc-Dali-MaskEffect.cpp with 57% similarity]
automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/utc-Dali-ShearEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-SoftButtonEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-SpotEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-SquareDissolveEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-SwirlEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
automated-tests/src/dali-toolkit/utc-Dali-WaterEffect.cpp [deleted file]
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/dali-toolkit.h
dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.cpp
dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h
dali-toolkit/devel-api/file.list
dali-toolkit/devel-api/scripting/script-plugin.h
dali-toolkit/devel-api/scripting/script.cpp
dali-toolkit/devel-api/scripting/script.h
dali-toolkit/devel-api/shader-effects/alpha-discard-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h
dali-toolkit/devel-api/shader-effects/bendy-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/bendy-effect.h
dali-toolkit/devel-api/shader-effects/blind-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/blind-effect.h
dali-toolkit/devel-api/shader-effects/bouncing-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/bouncing-effect.h
dali-toolkit/devel-api/shader-effects/bubble-effect/bubble-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/bubble-effect/color-adjuster.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/bubble-effect/color-adjuster.h [deleted file]
dali-toolkit/devel-api/shader-effects/carousel-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/carousel-effect.h
dali-toolkit/devel-api/shader-effects/displacement-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/displacement-effect.h
dali-toolkit/devel-api/shader-effects/dissolve-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/dissolve-effect.h
dali-toolkit/devel-api/shader-effects/dissolve-local-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/dissolve-local-effect.h
dali-toolkit/devel-api/shader-effects/distance-field-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/distance-field-effect.h
dali-toolkit/devel-api/shader-effects/image-region-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/image-region-effect.h
dali-toolkit/devel-api/shader-effects/iris-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/iris-effect.h
dali-toolkit/devel-api/shader-effects/mask-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/mask-effect.h
dali-toolkit/devel-api/shader-effects/mirror-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/mirror-effect.h
dali-toolkit/devel-api/shader-effects/motion-blur-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/motion-blur-effect.h
dali-toolkit/devel-api/shader-effects/motion-stretch-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h
dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h
dali-toolkit/devel-api/shader-effects/overlay-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/overlay-effect.h
dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.h [deleted file]
dali-toolkit/devel-api/shader-effects/page-turn-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/page-turn-effect.h [deleted file]
dali-toolkit/devel-api/shader-effects/quadratic-bezier.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/quadratic-bezier.h
dali-toolkit/devel-api/shader-effects/ripple-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/ripple-effect.h
dali-toolkit/devel-api/shader-effects/ripple2d-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/ripple2d-effect.h
dali-toolkit/devel-api/shader-effects/shear-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/shear-effect.h
dali-toolkit/devel-api/shader-effects/soft-button-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/soft-button-effect.h
dali-toolkit/devel-api/shader-effects/spot-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/spot-effect.h
dali-toolkit/devel-api/shader-effects/square-dissolve-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/square-dissolve-effect.h
dali-toolkit/devel-api/shader-effects/swirl-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/swirl-effect.h
dali-toolkit/devel-api/shader-effects/water-effect.cpp [deleted file]
dali-toolkit/devel-api/shader-effects/water-effect.h [deleted file]
dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp [moved from dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.cpp with 61% similarity]
dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h [new file with mode: 0644]
dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp
dali-toolkit/internal/atlas-manager/atlas-manager-impl.h
dali-toolkit/internal/atlas-manager/atlas-manager.cpp
dali-toolkit/internal/atlas-manager/atlas-manager.h
dali-toolkit/internal/builder/builder-actor.cpp
dali-toolkit/internal/builder/builder-animations.cpp
dali-toolkit/internal/builder/builder-impl.cpp
dali-toolkit/internal/controls/bubble-effect/bubble-actor.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/bubble-effect/bubble-actor.h [moved from dali-toolkit/devel-api/shader-effects/bubble-effect/bubble-effect.h with 51% similarity]
dali-toolkit/internal/controls/bubble-effect/bubble-effect.h [new file with mode: 0644]
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h
dali-toolkit/internal/controls/bubble-effect/color-adjuster.h [new file with mode: 0644]
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.h
dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
dali-toolkit/internal/controls/buttons/check-box-button-impl.h
dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h [new file with mode: 0644]
dali-toolkit/internal/controls/page-turn-view/page-turn-effect.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h [new file with mode: 0644]
dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
dali-toolkit/internal/controls/scrollable/item-view/depth-layout.cpp
dali-toolkit/internal/controls/scrollable/item-view/depth-layout.h
dali-toolkit/internal/controls/scrollable/item-view/grid-layout.cpp
dali-toolkit/internal/controls/scrollable/item-view/grid-layout.h
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/item-view/spiral-layout.cpp
dali-toolkit/internal/controls/scrollable/item-view/spiral-layout.h
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h
dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/table-view/table-view-impl.cpp
dali-toolkit/internal/controls/table-view/table-view-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.h
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp
dali-toolkit/internal/file.list
dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h [deleted file]
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h
dali-toolkit/internal/scripting/script-impl.cpp
dali-toolkit/internal/scripting/script-impl.h
dali-toolkit/internal/scripting/script-plugin-proxy.cpp
dali-toolkit/internal/scripting/script-plugin-proxy.h
dali-toolkit/internal/shader-effects/page-turn-effect-impl.cpp [deleted file]
dali-toolkit/internal/shader-effects/page-turn-effect-impl.h [deleted file]
dali-toolkit/internal/shader-effects/water-effect-impl.cpp [deleted file]
dali-toolkit/internal/shader-effects/water-effect-impl.h [deleted file]
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/decorator/text-decorator.h
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.h
dali-toolkit/internal/text/rendering/basic/text-basic-renderer.cpp [deleted file]
dali-toolkit/internal/text/rendering/basic/text-basic-renderer.h [deleted file]
dali-toolkit/internal/text/rendering/shaders/text-basic-shader.cpp
dali-toolkit/internal/text/rendering/shaders/text-basic-shadow-shader.cpp
dali-toolkit/internal/text/rendering/shaders/text-basic-shadow-shader.h [deleted file]
dali-toolkit/internal/text/rendering/shaders/text-bgra-shader.cpp
dali-toolkit/internal/text/rendering/text-backend-impl.cpp
dali-toolkit/internal/text/rendering/text-renderer.h
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/public-api/accessibility-manager/accessibility-manager.cpp [new file with mode: 0644]
dali-toolkit/public-api/accessibility-manager/accessibility-manager.h [new file with mode: 0644]
dali-toolkit/public-api/controls/control-depth-index-ranges.h [moved from plugins/dali-script-v8/src/actors/mesh-actor-api.h with 59% similarity]
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h
dali-toolkit/public-api/controls/control.h
dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h
dali-toolkit/public-api/controls/table-view/table-view.cpp
dali-toolkit/public-api/controls/table-view/table-view.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/file.list
dali-toolkit/public-api/focus-manager/accessibility-focus-manager.cpp [deleted file]
dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h [deleted file]
dali-toolkit/public-api/focus-manager/keyboard-focus-manager.cpp
dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h
dali-toolkit/public-api/text/rendering-backend.h
docs/content/programming-guide/size-negotiation.h
packaging/dali-toolkit.spec
plugins/dali-script-v8/docs/content/actor.js
plugins/dali-script-v8/docs/content/renderable-actor.js [deleted file]
plugins/dali-script-v8/file.list
plugins/dali-script-v8/src/actors/actor-wrapper.cpp
plugins/dali-script-v8/src/actors/image-actor-api.cpp
plugins/dali-script-v8/src/actors/image-actor-api.h
plugins/dali-script-v8/src/actors/mesh-actor-api.cpp [deleted file]
plugins/dali-script-v8/src/actors/renderable-actor-api.cpp [deleted file]
plugins/dali-script-v8/src/actors/renderable-actor-api.h [deleted file]
plugins/dali-script-v8/src/constants/constants-wrapper.cpp
plugins/dali-script-v8/src/dali-script-v8.cpp
plugins/dali-script-v8/src/dali-script-v8.h
plugins/dali-script-v8/src/dali-wrapper.cpp
plugins/dali-script-v8/src/dali-wrapper.h
plugins/dali-script-v8/src/module-loader/module-loader.cpp
plugins/dali-script-v8/src/module-loader/module-loader.h
plugins/dali-script-v8/src/shader-effects/shader-effect-api.cpp
plugins/dali-script-v8/src/signals/signal-manager.cpp

index 9324e48..a3a263f 100644 (file)
@@ -16,7 +16,7 @@ SET(TC_SOURCES
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp
-   ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
index 803d2ed..aae9626 100644 (file)
@@ -8,65 +8,49 @@ SET(CAPI_LIB "dali-toolkit")
 # List of test case sources (Only these get parsed for test cases)
 SET(TC_SOURCES
    utc-Dali-Alignment.cpp
-   utc-Dali-BendyEffect.cpp
-   utc-Dali-BlindEffect.cpp
    utc-Dali-BloomView.cpp
    utc-Dali-BubbleEmitter.cpp
    utc-Dali-Builder.cpp
-   utc-Dali-CarouselEffect.cpp
    utc-Dali-CheckBoxButton.cpp
    utc-Dali-CubeTransitionEffect.cpp
-   utc-Dali-DisplacementEffect.cpp
-   utc-Dali-DistanceFieldEffect.cpp
    utc-Dali-EffectsView.cpp
    utc-Dali-GaussianBlurView.cpp
    utc-Dali-JsonParser.cpp
    utc-Dali-KeyInputFocusManager.cpp
-   utc-Dali-OverlayEffect.cpp
-   utc-Dali-PageTurnEffect.cpp
    utc-Dali-PageTurnView.cpp
+   utc-Dali-Script.cpp
    utc-Dali-ScrollBar.cpp
    utc-Dali-ScrollView.cpp
+   utc-Dali-ShaderEffects.cpp
    utc-Dali-ShadowView.cpp
-   utc-Dali-ShearEffect.cpp
    utc-Dali-Slider.cpp
-   utc-Dali-SoftButtonEffect.cpp
-   utc-Dali-SpotEffect.cpp
-   utc-Dali-SquareDissolveEffect.cpp
    utc-Dali-TableView.cpp
    utc-Dali-TextField.cpp
    utc-Dali-TextLabel.cpp
    utc-Dali-TextSelectionPopup.cpp
    utc-Dali-ToolBar.cpp
-   utc-Dali-WaterEffect.cpp
    utc-Dali-Button.cpp
    utc-Dali-Control.cpp
    utc-Dali-ControlImpl.cpp
    utc-Dali-DefaultControls.cpp
-   utc-Dali-DissolveEffect.cpp
-   utc-Dali-AccessibilityFocusManager.cpp
-   utc-Dali-IrisEffect.cpp
+   utc-Dali-AccessibilityManager.cpp
    utc-Dali-ItemLayout.cpp
    utc-Dali-ItemView.cpp
    utc-Dali-KeyboardFocusManager.cpp
    utc-Dali-Magnifier.cpp
-   utc-Dali-MaskEffect.cpp
    utc-Dali-NinePatchMaskEffect.cpp
    utc-Dali-Popup.cpp
    utc-Dali-PushButton.cpp
    utc-Dali-RadioButton.cpp
-   utc-Dali-Ripple2DEffect.cpp
-   utc-Dali-RippleEffect.cpp
    utc-Dali-ScrollViewEffect.cpp
    utc-Dali-StyleManager.cpp
    utc-Dali-SuperBlurView.cpp
-   utc-Dali-SwirlEffect.cpp
 )
 
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
    dali-toolkit-test-utils/test-harness.cpp
-   dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
+   dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
    dali-toolkit-test-utils/toolkit-application.cpp
    dali-toolkit-test-utils/toolkit-clipboard.cpp
    dali-toolkit-test-utils/toolkit-imf-manager.cpp
@@ -75,6 +59,7 @@ LIST(APPEND TC_SOURCES
    dali-toolkit-test-utils/toolkit-singleton-service.cpp
    dali-toolkit-test-utils/toolkit-timer.cpp
    dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
+   dali-toolkit-test-utils/toolkit-tts-player.cpp
    dali-toolkit-test-utils/dummy-control.cpp
    dali-toolkit-test-utils/dali-test-suite-utils.cpp
    dali-toolkit-test-utils/test-application.cpp
index b6b80a2..79668ff 100644 (file)
@@ -112,7 +112,7 @@ DummyControlImplOverride::~DummyControlImplOverride() { }
 
 
 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
-void DummyControlImplOverride::OnActivated() { activatedCalled = true; }
+bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
 {
   themeChangeCalled = change == StyleChange::THEME_CHANGE;
@@ -122,7 +122,7 @@ void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled
 void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
 void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
 void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
-void DummyControlImplOverride::OnStageConnection() { stageConnectionCalled = true; }
+void DummyControlImplOverride::OnStageConnection( unsigned int depth ) { stageConnectionCalled = true; }
 void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; }
 void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
 void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
index bcef6d1..6db3f8b 100644 (file)
@@ -102,7 +102,7 @@ private:
 private: // From Internal::Control
 
   virtual void OnInitialize();
-  virtual void OnActivated();
+  virtual bool OnAccessibilityActivated();
   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
   virtual void OnPinch(const PinchGesture& pinch);
   virtual void OnPan(const PanGesture& pan);
@@ -111,7 +111,7 @@ private: // From Internal::Control
 
 private: // From CustomActorImpl
 
-  virtual void OnStageConnection();
+  virtual void OnStageConnection( unsigned int depth );
   virtual void OnStageDisconnection();
   virtual void OnChildAdd(Actor& child);
   virtual void OnChildRemove(Actor& child);
index 36cb94b..516b366 100644 (file)
@@ -1548,6 +1548,30 @@ public: // TEST FUNCTIONS
   inline TraceCallStack& GetDrawTrace() { return mDrawTrace; }
 
   template <typename T>
+  inline bool GetUniformValue( const char* name, T& value ) const
+  {
+    for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+          program_it != mUniforms.end();
+          ++program_it )
+    {
+      const UniformIDMap &uniformIDs = program_it->second;
+
+      UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
+      if( uniform_it != uniformIDs.end() )
+      {
+        // found one matching uniform name, lets check the value...
+        GLuint programId = program_it->first;
+        GLint uniformId = uniform_it->second;
+
+        const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
+        return mProgramUniforms.GetUniformValue( programId, uniformId, value );
+      }
+    }
+    return false;
+  }
+
+
+  template <typename T>
   inline bool CheckUniformValue( const char* name, const T& value ) const
   {
     for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
new file mode 100644 (file)
index 0000000..9ba46ca
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2015 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 "toolkit-accessibility-adaptor.h"
+
+#include <dali/public-api/object/base-object.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Stub for the AccessibilityAdaptor
+ */
+class AccessibilityAdaptor : public BaseObject
+{
+public: // Creation & Destruction
+
+  static Dali::AccessibilityAdaptor Get();
+
+  AccessibilityAdaptor();
+  ~AccessibilityAdaptor();
+
+public:
+
+  bool IsEnabled() const;
+  void SetActionHandler(Dali::AccessibilityActionHandler& handler);
+  void SetGestureHandler(Dali::AccessibilityGestureHandler& handler);
+
+public: // Signals
+
+private:
+
+  bool mIsEnabled;
+  Dali::AccessibilityActionHandler* mActionHandler;
+  Dali::AccessibilityGestureHandler* mGestureHandler;
+
+  static Dali::AccessibilityAdaptor mToolkitAccessibilityAdaptor;
+};
+
+Dali::AccessibilityAdaptor AccessibilityAdaptor::mToolkitAccessibilityAdaptor;
+
+
+Dali::AccessibilityAdaptor AccessibilityAdaptor::Get()
+{
+  if( ! mToolkitAccessibilityAdaptor )
+  {
+    mToolkitAccessibilityAdaptor = Dali::AccessibilityAdaptor( new Dali::Internal::Adaptor::AccessibilityAdaptor() );
+  }
+  return mToolkitAccessibilityAdaptor;
+}
+
+AccessibilityAdaptor::AccessibilityAdaptor()
+: mIsEnabled(false)
+{
+}
+
+AccessibilityAdaptor::~AccessibilityAdaptor()
+{
+}
+
+bool AccessibilityAdaptor::IsEnabled() const
+{
+  return mIsEnabled;
+}
+
+void AccessibilityAdaptor::SetActionHandler(Dali::AccessibilityActionHandler& handler)
+{
+  mActionHandler = &handler;
+}
+
+void AccessibilityAdaptor::SetGestureHandler(Dali::AccessibilityGestureHandler& handler)
+{
+  mGestureHandler = &handler;
+}
+
+static Internal::Adaptor::AccessibilityAdaptor& GetImplementation(Dali::AccessibilityAdaptor& adaptor)
+{
+  BaseObject& handle = adaptor.GetBaseObject();
+  return static_cast<Internal::Adaptor::AccessibilityAdaptor&>(handle);
+}
+
+
+} // namespace Adaptor
+} // namespace Internal
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+AccessibilityAdaptor::AccessibilityAdaptor()
+{
+}
+
+AccessibilityAdaptor AccessibilityAdaptor::Get()
+{
+  return Internal::Adaptor::AccessibilityAdaptor::Get();
+}
+
+AccessibilityAdaptor::~AccessibilityAdaptor()
+{
+}
+
+Vector2 AccessibilityAdaptor::GetReadPosition() const
+{
+  //return Internal::Adaptor::GetImplementation(*this).GetReadPosition();
+  return Vector2::ZERO;
+}
+
+bool AccessibilityAdaptor::IsEnabled() const
+{
+  //return Internal::Adaptor::GetImplementation(*this).IsEnabled();
+  return false;
+}
+
+void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler)
+{
+  Internal::Adaptor::GetImplementation(*this).SetActionHandler(handler);
+}
+
+void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler)
+{
+  Internal::Adaptor::GetImplementation(*this).SetGestureHandler(handler);
+}
+
+bool AccessibilityAdaptor::HandleActionNextEvent()
+{
+  return true; //Internal::Adaptor::GetImplementation(*this).HandleActionNextEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionPreviousEvent()
+{
+  return true; //Internal::Adaptor::GetImplementation(*this).HandleActionPreviousEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionActivateEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionActivateEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y,  bool allowReadAgain)
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain);
+}
+
+bool AccessibilityAdaptor::HandleActionReadNextEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadNextEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionReadPreviousEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPreviousEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionUpEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionUpEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionDownEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionDownEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionClearFocusEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionClearFocusEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp)
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp);
+}
+
+bool AccessibilityAdaptor::HandleActionBackEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionBackEvent();
+}
+
+void AccessibilityAdaptor::HandleActionEnableEvent()
+{
+  //Internal::Adaptor::GetImplementation(*this).HandleActionEnableEvent();
+}
+
+void AccessibilityAdaptor::HandleActionDisableEvent()
+{
+  //Internal::Adaptor::GetImplementation(*this).HandleActionDisableEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionScrollUpEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollUpEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionScrollDownEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollDownEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionPageLeftEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageLeftEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionPageRightEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageRightEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionPageUpEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageUpEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionPageDownEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageDownEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionMoveToFirstEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionMoveToFirstEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionMoveToLastEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionMoveToLastEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionReadFromTopEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadFromTopEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionReadFromNextEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadFromNextEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionZoomEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionZoomEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadIndicatorInformationEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPauseResumeEvent();
+}
+
+bool AccessibilityAdaptor::HandleActionStartStopEvent()
+{
+  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionStartStopEvent();
+}
+
+AccessibilityAdaptor::AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor )
+: BaseHandle( adaptor )
+{
+}
+
+} // namespace Dali
@@ -1,11 +1,11 @@
-// Prevent normal accessibility manager declaration from loading
-#define __DALI_ACCESSIBILITY_MANAGER_H__
+// Prevent normal accessibility adaptor declaration from loading
+#define __DALI_ACCESSIBILITY_ADAPTOR_H__
 
-#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+#ifndef __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__
+#define __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
@@ -24,7 +24,6 @@
 // EXTERNAL INCLUDES
 #include <string>
 #include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/signals/dali-signal.h>
 #include <dali/public-api/events/touch-point.h>
 
 namespace Dali
@@ -33,7 +32,7 @@ namespace Internal
 {
 namespace Adaptor
 {
-class AccessibilityManager;
+class AccessibilityAdaptor;
 }
 }
 class AccessibilityActionHandler;
@@ -41,19 +40,16 @@ class AccessibilityGestureHandler;
 class TouchPoint;
 
 /**
- * This creates a stubbed AccessibilityManager so that internal Toolkit Adaptor calls work.
+ * This creates a stubbed AccessibilityAdaptor so that internal Toolkit Adaptor calls work.
  */
-class AccessibilityManager : public BaseHandle
+class AccessibilityAdaptor : public BaseHandle
 {
-public: // Typedefs
-  typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType;
-
 public: // Construction & Destruction
-  AccessibilityManager();
-  ~AccessibilityManager();
+  AccessibilityAdaptor();
+  ~AccessibilityAdaptor();
 
 public: // Getters
-  static AccessibilityManager Get();
+  static AccessibilityAdaptor Get();
   Vector2 GetReadPosition() const;
   bool IsEnabled() const;
   void SetActionHandler(AccessibilityActionHandler& handler);
@@ -71,24 +67,24 @@ public: // Getters
   bool HandleActionBackEvent();
   void HandleActionEnableEvent();
   void HandleActionDisableEvent();
+  bool HandleActionScrollUpEvent();
+  bool HandleActionScrollDownEvent();
+  bool HandleActionPageLeftEvent();
+  bool HandleActionPageRightEvent();
+  bool HandleActionPageUpEvent();
+  bool HandleActionPageDownEvent();
+  bool HandleActionMoveToFirstEvent();
+  bool HandleActionMoveToLastEvent();
+  bool HandleActionReadFromTopEvent();
+  bool HandleActionReadFromNextEvent();
+  bool HandleActionZoomEvent();
+  bool HandleActionReadIndicatorInformationEvent();
+  bool HandleActionReadPauseResumeEvent();
+  bool HandleActionStartStopEvent();
 
-public:  // Signals
-  AccessibilityActionSignalType& StatusChangedSignal();
-  AccessibilityActionSignalType& ActionNextSignal();
-  AccessibilityActionSignalType& ActionPreviousSignal();
-  AccessibilityActionSignalType& ActionActivateSignal();
-  AccessibilityActionSignalType& ActionReadSignal();
-  AccessibilityActionSignalType& ActionOverSignal();
-  AccessibilityActionSignalType& ActionReadNextSignal();
-  AccessibilityActionSignalType& ActionReadPreviousSignal();
-  AccessibilityActionSignalType& ActionUpSignal();
-  AccessibilityActionSignalType& ActionDownSignal();
-  AccessibilityActionSignalType& ActionClearFocusSignal();
-  AccessibilityActionSignalType& ActionBackSignal();
-
-  AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager );
+  AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor );
 };
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+#endif // __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
deleted file mode 100644 (file)
index 2f58788..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Copyright (c) 2014 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 "toolkit-accessibility-manager.h"
-
-#include <dali/public-api/object/base-object.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-/**
- * Stub for the AccessibilityManager
- */
-class AccessibilityManager : public BaseObject
-{
-public: // Creation & Destruction
-
-  static Dali::AccessibilityManager Get();
-
-  AccessibilityManager();
-  ~AccessibilityManager();
-
-public:
-
-  bool IsEnabled() const;
-  void SetActionHandler(Dali::AccessibilityActionHandler& handler);
-  void SetGestureHandler(Dali::AccessibilityGestureHandler& handler);
-
-public: // Signals
-
-  Dali::AccessibilityManager::AccessibilityActionSignalType& StatusChangedSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionNextSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionPreviousSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionActivateSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionReadSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionReadNextSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionReadPreviousSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionOverSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionUpSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionDownSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionClearFocusSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionBackSignal();
-  Dali::AccessibilityManager::AccessibilityActionSignalType& ActionControlPanelOpenSignal();
-
-private:
-
-  Dali::AccessibilityManager::AccessibilityActionSignalType mStatusChangedSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionNextSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionPreviousSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionActivateSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionReadSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionReadNextSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionReadPreviousSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionOverSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionUpSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionDownSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionClearFocusSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionBackSignal;
-  Dali::AccessibilityManager::AccessibilityActionSignalType mActionControlPanelOpenSignal;
-
-  bool mIsEnabled;
-  Dali::AccessibilityActionHandler* mActionHandler;
-  Dali::AccessibilityGestureHandler* mGestureHandler;
-
-  static Dali::AccessibilityManager mToolkitAccessibilityManager;
-};
-
-Dali::AccessibilityManager AccessibilityManager::mToolkitAccessibilityManager;
-
-
-Dali::AccessibilityManager AccessibilityManager::Get()
-{
-  if( ! mToolkitAccessibilityManager )
-  {
-    mToolkitAccessibilityManager = Dali::AccessibilityManager( new Dali::Internal::Adaptor::AccessibilityManager() );
-  }
-  return mToolkitAccessibilityManager;
-}
-
-AccessibilityManager::AccessibilityManager()
-: mIsEnabled(false)
-{
-}
-
-AccessibilityManager::~AccessibilityManager()
-{
-}
-
-bool AccessibilityManager::IsEnabled() const
-{
-  return mIsEnabled;
-}
-
-void AccessibilityManager::SetActionHandler(Dali::AccessibilityActionHandler& handler)
-{
-  mActionHandler = &handler;
-}
-
-void AccessibilityManager::SetGestureHandler(Dali::AccessibilityGestureHandler& handler)
-{
-  mGestureHandler = &handler;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::StatusChangedSignal()
-{
-  return mStatusChangedSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionNextSignal()
-{
-  return mActionNextSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPreviousSignal()
-{
-  return mActionPreviousSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionActivateSignal()
-{
-  return mActionActivateSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadSignal()
-{
-  return mActionReadSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadNextSignal()
-{
-  return mActionReadNextSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPreviousSignal()
-{
-  return mActionReadPreviousSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionOverSignal()
-{
-  return mActionOverSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionUpSignal()
-{
-  return mActionUpSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionDownSignal()
-{
-  return mActionDownSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionClearFocusSignal()
-{
-  return mActionClearFocusSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionBackSignal()
-{
-  return mActionBackSignal;
-}
-
-Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionControlPanelOpenSignal()
-{
-  return mActionControlPanelOpenSignal;
-}
-
-static Internal::Adaptor::AccessibilityManager& GetImplementation(Dali::AccessibilityManager& manager)
-{
-  BaseObject& handle = manager.GetBaseObject();
-  return static_cast<Internal::Adaptor::AccessibilityManager&>(handle);
-}
-
-
-} // namespace Adaptor
-} // namespace Internal
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-AccessibilityManager::AccessibilityManager()
-{
-}
-
-AccessibilityManager AccessibilityManager::Get()
-{
-  return Internal::Adaptor::AccessibilityManager::Get();
-}
-
-AccessibilityManager::~AccessibilityManager()
-{
-}
-
-Vector2 AccessibilityManager::GetReadPosition() const
-{
-  //return Internal::Adaptor::GetImplementation(*this).GetReadPosition();
-  return Vector2::ZERO;
-}
-
-bool AccessibilityManager::IsEnabled() const
-{
-  //return Internal::Adaptor::GetImplementation(*this).IsEnabled();
-  return false;
-}
-
-void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler)
-{
-  Internal::Adaptor::GetImplementation(*this).SetActionHandler(handler);
-}
-
-void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler)
-{
-  Internal::Adaptor::GetImplementation(*this).SetGestureHandler(handler);
-}
-
-bool AccessibilityManager::HandleActionNextEvent()
-{
-  return true; //Internal::Adaptor::GetImplementation(*this).HandleActionNextEvent();
-}
-
-bool AccessibilityManager::HandleActionPreviousEvent()
-{
-  return true; //Internal::Adaptor::GetImplementation(*this).HandleActionPreviousEvent();
-}
-
-bool AccessibilityManager::HandleActionActivateEvent()
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionActivateEvent();
-}
-
-bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y,  bool allowReadAgain)
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain);
-}
-
-bool AccessibilityManager::HandleActionReadNextEvent()
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadNextEvent();
-}
-
-bool AccessibilityManager::HandleActionReadPreviousEvent()
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPreviousEvent();
-}
-
-bool AccessibilityManager::HandleActionUpEvent()
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionUpEvent();
-}
-
-bool AccessibilityManager::HandleActionDownEvent()
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionDownEvent();
-}
-
-bool AccessibilityManager::HandleActionClearFocusEvent()
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionClearFocusEvent();
-}
-
-bool AccessibilityManager::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp)
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp);
-}
-
-bool AccessibilityManager::HandleActionBackEvent()
-{
-  return true;//Internal::Adaptor::GetImplementation(*this).HandleActionBackEvent();
-}
-
-void AccessibilityManager::HandleActionEnableEvent()
-{
-  //Internal::Adaptor::GetImplementation(*this).HandleActionEnableEvent();
-}
-
-void AccessibilityManager::HandleActionDisableEvent()
-{
-  //Internal::Adaptor::GetImplementation(*this).HandleActionDisableEvent();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::StatusChangedSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).StatusChangedSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionNextSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionNextSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPreviousSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionPreviousSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionActivateSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionActivateSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionOverSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionOverSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionReadSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadNextSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionReadNextSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPreviousSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionReadPreviousSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionUpSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionUpSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionDownSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionDownSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionClearFocusSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionClearFocusSignal();
-}
-
-AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionBackSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ActionBackSignal();
-}
-
-AccessibilityManager::AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager )
-: BaseHandle( manager )
-{
-}
-
-} // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
new file mode 100644 (file)
index 0000000..abd5f1c
--- /dev/null
@@ -0,0 +1,84 @@
+#include "toolkit-tts-player.h"
+
+/*
+ * Copyright (c) 2015 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 <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+
+TtsPlayer::TtsPlayer()
+{
+}
+
+TtsPlayer TtsPlayer::Get(Dali::TtsPlayer::Mode mode)
+{
+  TtsPlayer ttsPlayer;
+
+  return ttsPlayer;
+}
+
+TtsPlayer::~TtsPlayer()
+{
+}
+
+TtsPlayer::TtsPlayer(const TtsPlayer& handle)
+: BaseHandle(handle)
+{
+}
+
+TtsPlayer& TtsPlayer::operator=(const TtsPlayer& rhs)
+{
+  BaseHandle::operator=(rhs);
+  return *this;
+}
+
+void TtsPlayer::Play(const std::string& text)
+{
+  // GetImplementation(*this).Play(text);
+}
+
+void TtsPlayer::Stop()
+{
+  // GetImplementation(*this).Stop();
+}
+
+void TtsPlayer::Pause()
+{
+  // GetImplementation(*this).Pause();
+}
+
+void TtsPlayer::Resume()
+{
+  // GetImplementation(*this).Resume();
+}
+
+TtsPlayer::State TtsPlayer::GetState()
+{
+  return READY; // GetImplementation(*this).GetState();
+}
+
+TtsPlayer::StateChangedSignalType& TtsPlayer::StateChangedSignal()
+{
+  return mStateChangedSignal; // GetImplementation(*this).StateChangedSignal();
+}
+
+
+} // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.h
new file mode 100644 (file)
index 0000000..269039e
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef __DALI_TOOLKIT_TTS_PLAYER_H__
+#define __DALI_TOOLKIT_TTS_PLAYER_H__
+
+/*
+ * Copyright (c) 2015 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 <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+
+namespace Internal DALI_INTERNAL
+{
+namespace Adaptor
+{
+class TtsPlayer;
+}
+}
+
+class DALI_IMPORT_API TtsPlayer : public BaseHandle
+{
+public:
+
+  enum Mode
+  {
+    DEFAULT = 0,        ///< Default mode for normal application
+    NOTIFICATION,       ///< Notification mode
+    SCREEN_READER,      ///< Screen reader mode
+    MODE_NUM
+  };
+
+  enum State
+  {
+    UNAVAILABLE = 0,    ///< Player is not available
+    READY,              ///< Player is ready to play
+    PLAYING,            ///< Player is playing
+    PAUSED              ///< Player is paused
+  };
+
+  typedef Signal< void ( const Dali::TtsPlayer::State, const Dali::TtsPlayer::State ) > StateChangedSignalType;
+
+  TtsPlayer();
+  static TtsPlayer Get(Dali::TtsPlayer::Mode mode = Dali::TtsPlayer::DEFAULT);
+  ~TtsPlayer();
+
+  TtsPlayer(const TtsPlayer& handle);
+  TtsPlayer& operator=(const TtsPlayer& rhs);
+  void Play(const std::string& text);
+  void Stop();
+  void Pause();
+  void Resume();
+  State GetState();
+  Dali::TtsPlayer::StateChangedSignalType& StateChangedSignal();
+
+public:
+
+  // explicit DALI_INTERNAL TtsPlayer( Internal::Adaptor::TtsPlayer* ttsPlayer );
+
+private:
+
+  StateChangedSignalType mStateChangedSignal;
+};
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TTS_PLAYER_H__
@@ -28,12 +28,12 @@ using namespace Dali;
 using namespace Toolkit;
 
 
-void utc_dali_toolkit_accessibility_focus_manager_startup(void)
+void utc_dali_toolkit_accessibility_manager_startup(void)
 {
   test_return_value = TET_UNDEF;
 }
 
-void utc_dali_toolkit_accessibility_focus_manager_cleanup(void)
+void utc_dali_toolkit_accessibility_manager_cleanup(void)
 {
   test_return_value = TET_PASS;
 }
@@ -90,11 +90,11 @@ public:
   FocusOvershotCallback(bool& signalReceived)
   : mSignalVerified(signalReceived),
     mCurrentFocusedActor(),
-    mFocusOvershotDirection(Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT)
+    mFocusOvershotDirection(Toolkit::AccessibilityManager::OVERSHOT_NEXT)
   {
   }
 
-  void Callback(Actor currentFocusedActor, Toolkit::AccessibilityFocusManager::FocusOvershotDirection direction)
+  void Callback(Actor currentFocusedActor, Toolkit::AccessibilityManager::FocusOvershotDirection direction)
   {
     tet_infoline("Verifying FocusOvershotCallback()");
 
@@ -111,7 +111,7 @@ public:
 
   bool& mSignalVerified;
   Actor mCurrentFocusedActor;
-  Toolkit::AccessibilityFocusManager::FocusOvershotDirection mFocusOvershotDirection;
+  Toolkit::AccessibilityManager::FocusOvershotDirection mFocusOvershotDirection;
 };
 
 // Functor to test whether focused actor activated signal is emitted.
@@ -131,13 +131,13 @@ public:
 } // namespace
 
 
-int UtcDaliAccessibilityFocusManagerGet(void)
+int UtcDaliAccessibilityManagerGet(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerGet");
+  tet_infoline(" UtcDaliAccessibilityManagerGet");
 
-  AccessibilityFocusManager manager;
+  AccessibilityManager manager;
 
   //Ensure object is created by checking if it's registered
   ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
@@ -146,46 +146,46 @@ int UtcDaliAccessibilityFocusManagerGet(void)
   gObjectCreatedCallBackCalled = false;
   registry.ObjectCreatedSignal().Connect( &TestCallback );
   {
-    manager = AccessibilityFocusManager::Get();
+    manager = AccessibilityManager::Get();
     DALI_TEST_CHECK(manager);
   }
   DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
 
-  AccessibilityFocusManager newManager = AccessibilityFocusManager::Get();
+  AccessibilityManager newManager = AccessibilityManager::Get();
   DALI_TEST_CHECK(newManager);
 
-  // Check that focus manager is a singleton
+  // Check that accessibility manager is a singleton
   DALI_TEST_CHECK(manager == newManager);
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerSetAndGetAccessibilityAttribute(void)
+int UtcDaliAccessibilityManagerSetAndGetAccessibilityAttribute(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetAccessibilityAttribute");
+  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetAccessibilityAttribute");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   Actor actor = Actor::New();
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "");
 
-  manager.SetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "Description");
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "Description");
+  manager.SetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL, "Description");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "Description");
 
-  manager.SetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "New description");
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "New description");
+  manager.SetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL, "New description");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "New description");
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder(void)
+int UtcDaliAccessibilityManagerSetAndGetFocusOrder(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder");
+  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusOrder");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   Actor first = Actor::New();
@@ -195,59 +195,59 @@ int UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder(void)
 
   // Set the focus order and description for the first actor
   manager.SetFocusOrder(first, 1);
-  manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
+  manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Set the focus order and description for the second actor
   manager.SetFocusOrder(second, 2);
-  manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
+  manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // check that the focus order of the first actor is changed
   manager.SetFocusOrder(first, 2);
   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 2);
   // make sure the change of focus order doesn't affect the actor's description
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // check that the focus order of the second actor is increased to 3
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 3);
   // make sure the change of focus order doesn't affect the actor's description
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // check that the focus order of the second actor is changed to 1
   manager.SetFocusOrder(second, 1);
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 1);
   // make sure the change of focus order doesn't affect the actor's description
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // Set the focus order and description for the third actor
   Actor third = Actor::New();
   manager.SetFocusOrder(third, 1);
-  manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third");
+  manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // check that the focus order of the second actor is increased to 2.
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
   // make sure the change of focus order doesn't affect the actor's description
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // check that the focus order of the first actor is increased to 3.
   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 3);
   // make sure the change of focus order doesn't affect the actor's description
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder(void)
+int UtcDaliAccessibilityManagerGenerateNewFocusOrder(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder");
+  tet_infoline(" UtcDaliAccessibilityManagerGenerateNewFocusOrder");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
@@ -258,7 +258,7 @@ int UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder(void)
 
   // Set the focus order for the first actor
   manager.SetFocusOrder(first, 1);
-  manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
+  manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
 
   //Test for new focus order
@@ -266,18 +266,18 @@ int UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder(void)
 
   // Set the focus order for the first actor
   manager.SetFocusOrder(second, 2);
-  manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
+  manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerGetActorByFocusOrder(void)
+int UtcDaliAccessibilityManagerGetActorByFocusOrder(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerGetActorByFocusOrder");
+  tet_infoline(" UtcDaliAccessibilityManagerGetActorByFocusOrder");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   // Create the actors and set their focus orders
@@ -321,13 +321,13 @@ int UtcDaliAccessibilityFocusManagerGetActorByFocusOrder(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor(void)
+int UtcDaliAccessibilityManagerSetAndGetCurrentFocusActor(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor");
+  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetCurrentFocusActor");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   // Create the first actor and add it to the stage
@@ -412,13 +412,13 @@ int UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup(void)
+int UtcDaliAccessibilityManagerGetCurrentFocusGroup(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup");
+  tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusGroup");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   // Create an actor with two child actors and add it to the stage
@@ -479,13 +479,13 @@ int UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder(void)
+int UtcDaliAccessibilityManagerGetCurrentFocusOrder(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder");
+  tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusOrder");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   Actor first = Actor::New();
@@ -499,21 +499,21 @@ int UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder(void)
 
   // Set the focus order and description for the first actor
   manager.SetFocusOrder(first, 1);
-  manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
+  manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Set the focus order and description for the second actor
   manager.SetFocusOrder(second, 2);
-  manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
+  manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // Set the focus order and description for the second actor
   manager.SetFocusOrder(third, 3);
-  manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third");
+  manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Check that no actor is being focused yet.
   DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
@@ -536,13 +536,13 @@ int UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
+int UtcDaliAccessibilityManagerMoveFocusForward(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerMoveFocusForward");
+  tet_infoline(" UtcDaliAccessibilityManagerMoveFocusForward");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   Actor first = Actor::New();
@@ -556,21 +556,21 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
 
   // Set the focus order and description for the first actor
   manager.SetFocusOrder(first, 1);
-  manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
+  manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Set the focus order and description for the second actor
   manager.SetFocusOrder(second, 2);
-  manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
+  manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // Set the focus order and description for the second actor
   manager.SetFocusOrder(third, 3);
-  manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third");
+  manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Check that no actor is being focused yet.
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
@@ -578,7 +578,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
   // Set the focus on the first actor
   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Test the non-wrapped move first
   manager.SetWrapMode(false);
@@ -587,19 +587,19 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
   // Move the focus forward to the second actor
   manager.MoveFocusForward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // Move the focus forward to the third actor
   manager.MoveFocusForward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Check that it will fail to move the focus forward again as the third actor is the last
   // focusable actor in the focus chain
   manager.MoveFocusForward();
   // The focus should still be set on the third actor
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Now test the wrapped move
   manager.SetWrapMode(true);
@@ -608,7 +608,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
   // Move the focus forward recursively and this time the first actor should be focused
   manager.MoveFocusForward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Make the second actor not focusable
   Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
@@ -621,7 +621,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
   // the third actor should be focused now.
   manager.MoveFocusForward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Make the first actor invisible
   first.SetVisible(false);
@@ -634,7 +634,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
   // so the focus will still be on the third actor
   manager.MoveFocusForward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Make the third actor invisible so that no actor can be focused.
   third.SetVisible(false);
@@ -645,17 +645,17 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
   // Check that the focus move is failed as all the three actors can not be focused
   manager.MoveFocusForward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
+int UtcDaliAccessibilityManagerMoveFocusBackward(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerMoveFocusBackward");
+  tet_infoline(" UtcDaliAccessibilityManagerMoveFocusBackward");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   Actor first = Actor::New();
@@ -669,21 +669,21 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
 
   // Set the focus order and description for the first actor
   manager.SetFocusOrder(first, 1);
-  manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
+  manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Set the focus order and description for the second actor
   manager.SetFocusOrder(second, 2);
-  manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
+  manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // Set the focus order and description for the second actor
   manager.SetFocusOrder(third, 3);
-  manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third");
+  manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Check that no actor is being focused yet.
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
@@ -691,7 +691,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
   // Set the focus on the third actor
   DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Test the non-wrapped move first
   manager.SetWrapMode(false);
@@ -700,19 +700,19 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
   // Move the focus backward to the second actor
   manager.MoveFocusBackward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "second");
 
   // Move the focus backward to the first actor
   manager.MoveFocusBackward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Check that it will fail to move the focus backward again as the first actor is the first
   // focusable actor in the focus chain
   manager.MoveFocusBackward();
   // The focus should still be set on the first actor
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Now test the wrapped move
   manager.SetWrapMode(true);
@@ -721,7 +721,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
   // Move the focus backward recursively and this time the third actor should be focused
   manager.MoveFocusBackward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
 
   // Make the second actor not focusable
   Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
@@ -734,7 +734,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
   // the first actor should be focused now.
   manager.MoveFocusBackward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Make the third actor invisible
   third.SetVisible(false);
@@ -747,7 +747,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
   // so the focus will still be on the first actor
   manager.MoveFocusBackward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
 
   // Make the first actor invisible so that no actor can be focused.
   first.SetVisible(false);
@@ -758,17 +758,17 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
   // Check that the focus move is failed as all the three actors can not be focused
   manager.MoveFocusBackward();
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
+  DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerClearFocus(void)
+int UtcDaliAccessibilityManagerClearFocus(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerClearFocus");
+  tet_infoline(" UtcDaliAccessibilityManagerClearFocus");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   // Create the first actor and add it to the stage
@@ -800,13 +800,13 @@ int UtcDaliAccessibilityFocusManagerClearFocus(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerReset(void)
+int UtcDaliAccessibilityManagerReset(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerReset");
+  tet_infoline(" UtcDaliAccessibilityManagerReset");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   // Create the first actor and add it to the stage
@@ -840,13 +840,13 @@ int UtcDaliAccessibilityFocusManagerReset(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerFocusGroup(void)
+int UtcDaliAccessibilityManagerFocusGroup(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerFocusGroup");
+  tet_infoline(" UtcDaliAccessibilityManagerFocusGroup");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   // Create an actor with two child actors and add it to the stage
@@ -937,13 +937,13 @@ int UtcDaliAccessibilityFocusManagerFocusGroup(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator(void)
+int UtcDaliAccessibilityManagerSetAndGetFocusIndicator(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator");
+  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusIndicator");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
@@ -955,13 +955,13 @@ int UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerSignalFocusChanged(void)
+int UtcDaliAccessibilityManagerSignalFocusChanged(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusChanged");
+  tet_infoline(" UtcDaliAccessibilityManagerSignalFocusChanged");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   bool signalVerified = false;
@@ -1002,13 +1002,13 @@ int UtcDaliAccessibilityFocusManagerSignalFocusChanged(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerSignalFocusOvershot(void)
+int UtcDaliAccessibilityManagerSignalFocusOvershot(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusOvershot");
+  tet_infoline(" UtcDaliAccessibilityManagerSignalFocusOvershot");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   bool signalVerified = false;
@@ -1038,7 +1038,7 @@ int UtcDaliAccessibilityFocusManagerSignalFocusOvershot(void)
 
   // Check that the forward focus movement is overshot.
   callback.mCurrentFocusedActor = second;
-  callback.mFocusOvershotDirection = Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT;
+  callback.mFocusOvershotDirection = Toolkit::AccessibilityManager::OVERSHOT_NEXT;
   DALI_TEST_CHECK(manager.MoveFocusForward() == false);
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
   DALI_TEST_CHECK(signalVerified);
@@ -1059,20 +1059,20 @@ int UtcDaliAccessibilityFocusManagerSignalFocusOvershot(void)
 
   // Check that the backward focus movement is overshot.
   callback.mCurrentFocusedActor = first;
-  callback.mFocusOvershotDirection = Toolkit::AccessibilityFocusManager::OVERSHOT_PREVIOUS;
+  callback.mFocusOvershotDirection = Toolkit::AccessibilityManager::OVERSHOT_PREVIOUS;
   DALI_TEST_CHECK(manager.MoveFocusBackward() == false);
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
   DALI_TEST_CHECK(signalVerified);
   END_TEST;
 }
 
-int UtcDaliAccessibilityFocusManagerSignalFocusedActorActivated(void)
+int UtcDaliAccessibilityManagerSignalFocusedActorActivated(void)
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusedActorActivated");
+  tet_infoline(" UtcDaliAccessibilityManagerSignalFocusedActorActivated");
 
-  AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
+  AccessibilityManager manager = AccessibilityManager::Get();
   DALI_TEST_CHECK(manager);
 
   FocusedActorActivatedCallback callback;
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-BendyEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-BendyEffect.cpp
deleted file mode 100644 (file)
index 6d58693..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/bendy-effect.h>
-
-
-using namespace Dali;
-
-
-void bendy_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void bendy_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliBendyUninitializedEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BendyEffect effect;
-
-  try
-  {
-    // New() must be called to create a BendyEffect or it wont be valid.
-    effect.SetRadius( 2.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliBendyPropertyNamesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BendyEffect effect = Toolkit::BendyEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetDirectionPropertyName(), "uDirection", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliBendyDefaultValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BendyEffect effect = Toolkit::BendyEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  Vector2 topLeft( Stage::GetCurrent().GetSize() * 0.5f );
-  topLeft.y = -topLeft.y;
-
-  // Gets converted to opengl view space
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          topLeft ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetDirectionPropertyName().c_str(),
-          Vector2(0.0f, 0.0f) ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRadiusPropertyName().c_str(),
-          0.0f ) );
-  END_TEST;
-}
-
-int UtcDaliBendyCustomValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BendyEffect effect = Toolkit::BendyEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  Vector2 direction(1.0f, 1.0f);
-  effect.SetCenter( Vector2(480.0f, 800.0f) );
-  effect.SetDirection( direction );
-  effect.SetRadius( 2.0f );
-
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  Vector2 bottomRight( Stage::GetCurrent().GetSize() * 0.5f );
-  bottomRight.x = -bottomRight.x;
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          bottomRight ) );
-
-  direction.Normalize();
-  direction.x *= -1.0f;
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetDirectionPropertyName().c_str(),
-          direction ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRadiusPropertyName().c_str(),
-          2.0f ) );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-BlindEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-BlindEffect.cpp
deleted file mode 100644 (file)
index d6756de..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/blind-effect.h>
-
-
-using namespace Dali;
-
-
-void blind_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void blind_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliBlindEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BlindEffect effect;
-
-  try
-  {
-    // New() must be called to create a BlindEffect or it wont be valid.
-    effect.SetStep( 2.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliBlindEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BlindEffect effect = Toolkit::BlindEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliBlindEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BlindEffect effect = Toolkit::BlindEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetStepPropertyName().c_str(),
-          0.0f ) );
-  END_TEST;
-}
-
-int UtcDaliBlindEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::BlindEffect effect = Toolkit::BlindEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  effect.SetStep( 2.0f );
-
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetStepPropertyName().c_str(),
-          2.0f ) );
-  END_TEST;
-}
index e25d8d5..2140f2a 100644 (file)
@@ -23,9 +23,8 @@
 #include <dali-toolkit-test-suite-utils.h>
 
 #include <dali.h>
+#include <dali/devel-api/rendering/renderer.h>
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali/devel-api/actors/mesh-actor.h>
-#include <dali/devel-api/modeling/material.h>
 #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
 
 using namespace Dali;
@@ -141,13 +140,40 @@ int UtcDaliBubbleEmitterNew(void)
   END_TEST;
 }
 
+int UtcDaliBubbleEmitterDownCast01(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline(" UtcDaliBubbleEmitterDownCast01 ");
+
+  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+
+  BaseHandle handle(emitter);
+  BubbleEmitter emitter2 = BubbleEmitter::DownCast(handle);
+  DALI_TEST_EQUALS( (bool)emitter2, true, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliBubbleEmitterDownCast02(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline(" UtcDaliBubbleEmitterDownCast02 ");
+
+  Handle handle = Handle::New(); // Create a custom object
+  BubbleEmitter emitter = BubbleEmitter::DownCast(handle);
+  DALI_TEST_EQUALS( (bool)emitter, false, TEST_LOCATION );
+  END_TEST;
+}
+
 int UtcDaliBubbleEmitterGetRootActor(void)
 {
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterGetRootActor " );
 
   Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 270, Vector2( 5.f, 10.f ));
 
   Actor root = emitter.GetRootActor();
   DALI_TEST_CHECK( root );
@@ -176,56 +202,44 @@ int UtcDaliBubbleEmitterSetBackground(void)
   END_TEST;
 }
 
-int UtcDaliBubbleEmitterSetShapeImage(void)
+//TODO: test case for BubbleEmitter::SetShapeImage(Image)
+// To test that the bubble-shape image is successfully switched in the sampler
+/*int UtcDaliBubbleEmitterSetShapeImage(void)
 {
-  ToolkitTestApplication application;
-  tet_infoline( " UtcDaliBubbleEmitterSetShapeImage " );
-
-  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
-
-  Actor root = emitter.GetRootActor();
-  MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
-  Material material = bubbleMesh.GetMaterial();
-
-  DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage1 );
-
-  Image shapeImage2 = CreateSolidColorImage( application, Color::RED, 8, 8 );
-  emitter.SetShapeImage( shapeImage2 );
-
-  DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage2 );
-  END_TEST;
-}
+}*/
 
 int UtcDaliBubbleEmitterSetBubbleScale(void)
 {
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterSetBubbleScale " );
 
-  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
-
+  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 150, Vector2( 5.f, 10.f ));
+  DALI_TEST_CHECK(emitter);
   Actor root = emitter.GetRootActor();
-  MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
-  ShaderEffect effect = bubbleMesh.GetShaderEffect();
-  DALI_TEST_CHECK( effect );
+  Stage::GetCurrent().Add( root );
+  root.SetPosition( Vector3::ZERO );
+  root.SetParentOrigin( ParentOrigin::CENTER );
+  root.SetAnchorPoint( AnchorPoint::CENTER );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  Wait(application);
 
-  Property::Index scalePropertyIndex = effect.GetPropertyIndex( "uDynamicScale" );
   float scaleValue;
-  (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
-  DALI_TEST_EQUALS(scaleValue, 1.f, TEST_LOCATION );
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uDynamicScale", scaleValue ) );
+  DALI_TEST_EQUALS( scaleValue, 1.f, TEST_LOCATION );
 
   emitter.SetBubbleScale( 2.f );
-  application.SendNotification();
-  application.Render();
-  (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
-  DALI_TEST_EQUALS(scaleValue, 2.f, TEST_LOCATION );
+  Wait(application);
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uDynamicScale", scaleValue ) );
+  DALI_TEST_EQUALS( scaleValue, 2.f, TEST_LOCATION );
 
   emitter.SetBubbleScale( 0.5f );
-  application.SendNotification();
-  application.Render();
-  (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
-  DALI_TEST_EQUALS(scaleValue, 0.5f, TEST_LOCATION );
+  Wait(application);
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uDynamicScale", scaleValue ) );
+  DALI_TEST_EQUALS( scaleValue, 0.5f, TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -234,8 +248,8 @@ int UtcDaliBubbleEmitterSetBubbleDensity01(void)
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " );
 
-  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
 
   try
   {
@@ -255,8 +269,8 @@ int UtcDaliBubbleEmitterSetBubbleDensity02(void)
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " );
 
-  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
 
   try
   {
@@ -275,27 +289,36 @@ int UtcDaliBubbleEmitterSetBlendMode(void)
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterSetBlendMode " );
 
-  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
-
+  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 150, Vector2( 5.f, 10.f ));
+  DALI_TEST_CHECK(emitter);
   Actor root = emitter.GetRootActor();
-  MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
-
-  BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
+  Stage::GetCurrent().Add( root );
+  root.SetPosition( Vector3::ZERO );
+  root.SetParentOrigin( ParentOrigin::CENTER );
+  root.SetAnchorPoint( AnchorPoint::CENTER );
+
+  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+  Wait(application);
+  DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
 
   emitter.SetBlendMode( true );
-  bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-  DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
-  DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE );
-  DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ZERO );
-  DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE );
+  Wait(application);
+  DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ZERO, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
 
   emitter.SetBlendMode( false );
-  bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-  DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
-  DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
-  DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
-  DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE_MINUS_SRC_ALPHA );
+  Wait(application);
+  DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
+  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -308,103 +331,94 @@ int UtcDaliBubbleEmitterEmitBubble(void)
   BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
 
   Actor root = emitter.GetRootActor();
-  MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
-  ShaderEffect effect = bubbleMesh.GetShaderEffect();
-  DALI_TEST_CHECK( effect );
+  Actor bubbleMesh = root.GetChildAt( 0 );
+  Stage::GetCurrent().Add( root );
+  DALI_TEST_CHECK( bubbleMesh );
 
-  Property::Index propertyIndex0 = effect.GetPropertyIndex( "uPercentage[0]" );
-  Property::Index propertyIndex1 = effect.GetPropertyIndex( "uPercentage[1]" );
+  Property::Index propertyIndex0 = bubbleMesh.GetPropertyIndex( "uPercentage[0]" );
+  Property::Index propertyIndex1 = bubbleMesh.GetPropertyIndex( "uPercentage[1]" );
   float value0, value1;
 
   Animation animation = Animation::New( 0.5f );
   emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
   emitter.EmitBubble( animation, Vector2(10.f,10.f), Vector2(5.f,5.f), Vector2(30.f,30.f) );
-  (effect.GetProperty(propertyIndex0)).Get( value0 );
-  (effect.GetProperty(propertyIndex1)).Get( value1 );
+  (bubbleMesh.GetProperty(propertyIndex0)).Get( value0 );
+  (bubbleMesh.GetProperty(propertyIndex1)).Get( value1 );
   DALI_TEST_EQUALS(value0, 0.f, TEST_LOCATION );
   DALI_TEST_EQUALS(value1, 0.f, TEST_LOCATION );
 
   animation.Play();
 
   Wait(application, 300);
-  (effect.GetProperty(propertyIndex0)).Get( value0 );
-  (effect.GetProperty(propertyIndex1)).Get( value1 );
+  propertyIndex0 = bubbleMesh.GetPropertyIndex( "uPercentage[0]" );
+  propertyIndex1 = bubbleMesh.GetPropertyIndex( "uPercentage[1]" );
+  (bubbleMesh.GetProperty(propertyIndex0)).Get( value0 );
+  (bubbleMesh.GetProperty(propertyIndex1)).Get( value1 );
   DALI_TEST_CHECK( value0 >= 0.6f );
   DALI_TEST_CHECK( value1 >= 0.6f );
 
-  Wait(application, 600);
-  (effect.GetProperty(propertyIndex0)).Get( value0 );
-  (effect.GetProperty(propertyIndex1)).Get( value1 );
+  Wait(application,500);
+  (bubbleMesh.GetProperty(propertyIndex0)).Get( value0 );
+  (bubbleMesh.GetProperty(propertyIndex1)).Get( value1 );
   DALI_TEST_EQUALS(value0, 1.f, TEST_LOCATION );
   DALI_TEST_EQUALS(value1, 1.f, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliBubbleEmitterStartExplosion(void)
+int UtcDaliBubbleEmitterRestore(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( " UtcDaliBubbleEmitterStartExplosion " );
+  tet_infoline( " UtcDaliBubbleEmitterRestore " );
 
-  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 90, Vector2( 5.f, 10.f ));
   Actor root = emitter.GetRootActor();
-  MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
-  ShaderEffect effect = bubbleMesh.GetShaderEffect();
-  DALI_TEST_CHECK( effect );
-
-  Property::Index propertyIndex = effect.GetPropertyIndex( "uMagnification" );
-  float value;
-  (effect.GetProperty(propertyIndex)).Get( value );
-  DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION );
-
-  emitter.StartExplosion( 0.4, 4.f );
+  Stage::GetCurrent().Add( root );
+  root.SetPosition( Vector3::ZERO );
+  root.SetParentOrigin( ParentOrigin::CENTER );
+  root.SetAnchorPoint( AnchorPoint::CENTER );
 
-  Wait(application, 200); // 0.2s
-  (effect.GetProperty(propertyIndex)).Get( value );
-  DALI_TEST_CHECK( value >= 2.f );
+  Actor bubbleMesh = root.GetChildAt( 0 );
+  Renderer renderer = bubbleMesh.GetRendererAt( 0 );
+  DALI_TEST_CHECK( renderer );
 
-  Wait(application, 100); // 0.3s
-  (effect.GetProperty(propertyIndex)).Get( value );
-  DALI_TEST_CHECK( value >= 3.f );
+  TestGlAbstraction& gl = application.GetGlAbstraction();
 
-  Wait(application, 100); // 0.4s
-  (effect.GetProperty(propertyIndex)).Get( value );
-  DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION );
-  END_TEST;
-}
+  float percentageValue;
+  Vector4 startEndPosValue;
 
-int UtcDaliBubbleEmitterRestore(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( " UtcDaliBubbleEmitterRestore " );
+  Animation animation = Animation::New( 0.5f );
+  emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
 
-  Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
-  Actor root = emitter.GetRootActor();
-  MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
-  ShaderEffect effect = bubbleMesh.GetShaderEffect();
-  DALI_TEST_CHECK( effect );
+  Wait(application);
 
-  Property::Index percentagePropertyIndex = effect.GetPropertyIndex( "uPercentage[0]" );
-  float percentage;
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uPercentage[0]", percentageValue ) );
+  DALI_TEST_EQUALS( percentageValue, 0.f, TEST_LOCATION );
 
-  Animation animation = Animation::New( 0.5f );
-  emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
-  (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
-  DALI_TEST_EQUALS(percentage, 0.f, TEST_LOCATION );
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
+  DALI_TEST_EQUALS( startEndPosValue.x, 40.f, TEST_LOCATION );
+  DALI_TEST_EQUALS( startEndPosValue.y, 40.f, TEST_LOCATION );
 
   animation.Play();
   Wait(application, 200);
   animation.Clear();
 
-  (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
-  DALI_TEST_CHECK( percentage < 0.5f && percentage >= 0.4);
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uPercentage[0]", percentageValue ) );
+  DALI_TEST_CHECK( percentageValue < 0.5f && percentageValue >= 0.4);
+
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
+  DALI_TEST_EQUALS( startEndPosValue.x, 40.f, TEST_LOCATION );
+  DALI_TEST_EQUALS( startEndPosValue.y, 40.f, TEST_LOCATION );
 
   emitter.Restore();
   application.SendNotification();
   application.Render();
 
-  (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
-  DALI_TEST_EQUALS(percentage, 1.f, TEST_LOCATION );
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uPercentage[0]", percentageValue ) );
+  DALI_TEST_EQUALS( percentageValue, 0.f, TEST_LOCATION );
+
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
+  DALI_TEST_EQUALS( startEndPosValue,  Vector4::ZERO, TEST_LOCATION );
+
   END_TEST;
 }
index 6d8ddff..164ab9e 100644 (file)
@@ -115,6 +115,10 @@ int UtcDaliBuilderAnimationP(void)
   // JSON with a quit event when the actor is touched
   std::string json(
         "{"
+        "   \"constants\":"
+        "   {"
+        "     \"ALPHA_FUNCTION\":\"EASE_IN_OUT\""
+        "   },"
         "   \"paths\":"
         "   {"
         "     \"path0\":"
@@ -133,7 +137,7 @@ int UtcDaliBuilderAnimationP(void)
         "        \"actor\": \"greeting\","
         "        \"property\": \"position\","
         "        \"value\": [300, 300, -1000],"
-        "        \"alpha-function\": \"EASE_IN_OUT\","
+        "        \"alpha-function\": \"{ALPHA_FUNCTION}\","
         "        \"relative\": true,"
         "        \"time-period\": {"
         "          \"delay\": 0,"
@@ -248,6 +252,12 @@ int UtcDaliBuilderAnimationP(void)
 
   DALI_TEST_CHECK( anim );
 
+  Property::Map map;
+  map["ALPHA_FUNCTION"] = "EASE_IN_SQUARE";
+  anim = builder.CreateAnimation("animate", map);
+
+  DALI_TEST_CHECK( anim );
+
   anim = builder.CreateAnimation("path-animation");
 
   DALI_TEST_CHECK( anim );
@@ -273,6 +283,11 @@ int UtcDaliBuilderAnimationN(void)
   // JSON with a quit event when the actor is touched
   std::string json(
         "{"
+        "   \"constants\":"
+        "   {"
+        "     \"TEXT\": \"Touch Me\","
+        "     \"NAME\": \"greeting\" "
+        "   },"
         "   \"paths\":"
         "   {"
         "     \"path0\":"
@@ -288,7 +303,7 @@ int UtcDaliBuilderAnimationN(void)
         "      \"disconnect-action\": \"BAKE\","
         "      \"properties\":"
         "      [{"
-        "        \"actor\": \"greeting\","
+        "        \"actor\": \"{NAME}\","
         "        \"property\": \"positioninvalid\","
         "        \"value\": [300, 300, -1000],"
         "        \"alpha-function\": \"EASE_IN_OUT\","
@@ -306,7 +321,7 @@ int UtcDaliBuilderAnimationN(void)
         "      \"disconnect-action\": \"BAKE\","
         "      \"properties\":"
         "      [{"
-        "        \"actor\": \"greeting\","
+        "        \"actor\": \"{NAME}\","
         "        \"property\": \"positioninvalid\","
         "        \"value\": [300, 300, -1000],"
         "        \"alpha-function\": \"EGGS_OVER_EASY\","
@@ -347,6 +362,11 @@ int UtcDaliBuilderAnimationN(void)
         "      \"action\": \"play\","
         "      \"animation\": \"animate\""
         "    }]"
+        "  },"
+        "  {"
+        "    \"name\": \"greeting2\","
+        "    \"type\": \"TextLabel\","
+        "    \"text\": \"Touch me\""
         "  }]"
         "}");
 
@@ -359,12 +379,28 @@ int UtcDaliBuilderAnimationN(void)
 
   // log warning line coverage
   anim = builder.CreateAnimation("path-animation");
+  DALI_TEST_CHECK(anim);
 
   anim = builder.CreateAnimation("animate");
+  DALI_TEST_CHECK(anim);
 
   anim = builder.CreateAnimation("animate2");
+  DALI_TEST_CHECK(anim);
+
+  // create referencing a different actor aka animation templates
+  Property::Map map;
+  map["NAME"] = "greeting2";
+  anim = builder.CreateAnimation("animate2", map);
+  DALI_TEST_CHECK(anim);
+
+  // alternative actor to use for FindChildByName
+  anim = builder.CreateAnimation("animate2", Dali::Stage::GetCurrent().GetRootLayer());
+  DALI_TEST_CHECK(anim);
+
+  // alternative actor to use for FindChildByName
+  anim = builder.CreateAnimation("animate2", map, Dali::Stage::GetCurrent().GetRootLayer());
+  DALI_TEST_CHECK(anim);
 
-  DALI_TEST_CHECK(true);
 
   END_TEST;
 
@@ -387,6 +423,7 @@ int UtcDaliBuilderConstantsP(void)
       "\"stage\":"
       "[{"
       "  \"type\": \"ImageActor\","
+      "  \"name\": \"{NAME}\","
       "  \"size\": [100,100,1],"
       "  \"parent-origin\": \"TOP_LEFT\","
       "  \"anchor-point\": \"{ANCHOR}\","
@@ -403,9 +440,29 @@ int UtcDaliBuilderConstantsP(void)
 
   Builder builder = Builder::New();
   builder.LoadFromString( json );
+
+  builder.AddConstant( "NAME", "image" );
+
+  Property::Map map = builder.GetConstants();
+
+  Dali::Property::Value* pValue = map.Find( "NAME" );
+
+  DALI_TEST_CHECK( pValue );
+
+  pValue = map.Find( "IMAGE_PATH" );
+
+  DALI_TEST_CHECK( pValue );
+
+  Dali::Property::Value value = builder.GetConstant( "WIDTH" );
+
+  DALI_TEST_CHECK( value.GetType() != Property::NONE );
+
   builder.AddActors ( Stage::GetCurrent().GetRootLayer() );
   DALI_TEST_CHECK( builder );
 
+  Actor actor = Stage::GetCurrent().GetRootLayer().FindChildByName("image");
+  DALI_TEST_CHECK( actor );
+
   END_TEST;
 }
 
@@ -416,6 +473,10 @@ int UtcDaliBuilderTemplatesAndStylesP(void)
   // JSON with a quit event when the actor is touched
   std::string json(
       "{\n"
+      "\"constants\":"
+      "{"
+      "  \"SIZE\": [10,20,30]"
+      "},"
       "\"styles\":\n"
       "{\n"
       "  \"image-style\": \n"
@@ -434,7 +495,7 @@ int UtcDaliBuilderTemplatesAndStylesP(void)
       "    \"type\": \"ImageActor\",\n"
       "    \"styles\": [\"image-style\"],\n"
       "    \"name\": \"image\",\n"
-      "    \"size\": [100,100,1],\n"
+      "    \"size\": \"{SIZE}\",\n"
       "    \"signals\": [{\n"
       "      \"name\": \"touched\",\n"
       "      \"action\": \"quit\"\n"
@@ -446,19 +507,67 @@ int UtcDaliBuilderTemplatesAndStylesP(void)
       "      }\n"
       "    ]\n"
       "  }\n"
-      "}\n"
+      "},\n"
+      "\"stage\":"
+      "[{"
+      "  \"type\": \"image-tree\","
+      "  \"size\": [100,100,1]"
+      "}]"
       "}\n"
   );
 
+  std::string stylejson(
+    "{\n"
+    " \"color\": [1,0,0,1],\n"
+    " \"actors\": {\n"
+    "   \"child-image\": {\n"
+    "     \"color\": [0,1,0,1]\n"
+    "   }\n"
+    " }\n"
+    "}\n"
+    );
+
+  std::string templatejson(
+    "{ \n"
+    "  \"type\": \"ImageActor\",\n"
+    "  \"styles\": [\"image-style\"],\n"
+    "  \"name\": \"image\",\n"
+    "  \"size\": \"{SIZE}\",\n"
+    "  \"signals\": [{\n"
+    "    \"name\": \"touched\",\n"
+    "    \"action\": \"quit\"\n"
+    "  }],\n"
+    "  \"actors\": [\n"
+    "    {\n"
+    "      \"type\":\"ImageActor\",\n"
+    "      \"name\":\"child-image\" \n"
+    "    }\n"
+    "  ]\n"
+    "}\n"
+    );
+
   Builder builder = Builder::New();
   builder.LoadFromString( json );
 
   ImageActor actor = ImageActor::DownCast( builder.Create( "image-tree" ) );
   DALI_TEST_CHECK( actor );
 
+  Dali::Property::Map map;
+  map["SIZE"] = Vector3(100,100,1);
+  actor = ImageActor::DownCast( builder.Create( "image-tree", map ) );
+  DALI_TEST_CHECK( actor );
+
+  // create from json snippet
+  actor = ImageActor::DownCast( builder.CreateFromJson( templatejson ) );
+  DALI_TEST_CHECK( actor );
+
+
   // NB: already applied in create
   DALI_TEST_CHECK( builder.ApplyStyle( "image-style", actor ) );
 
+  // apply from json snippet
+  DALI_TEST_CHECK( builder.ApplyFromJson( actor, stylejson ) );
+
   END_TEST;
 }
 
@@ -732,3 +841,617 @@ int UtcDaliBuilderPropertyNotificationP(void)
 
   END_TEST;
 }
+
+int UtcDaliBuilderCustomPropertyP(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+      "{\n"
+      "\"templates\":\n"
+      "{\n"
+      "  \"image-tree\": { \n"
+      "    \"type\": \"ImageActor\",\n"
+      "    \"name\": \"image\",\n"
+      "    \"size\": [100,100,1],\n"
+      "    \"signals\": [{\n"
+      "      \"name\": \"touched\",\n"
+      "      \"action\": \"quit\"\n"
+      "    }],\n"
+      "    \"custom-properties\": {\n"
+      "      \"newproperty\": true\n"
+      "    },\n"
+      "    \"actors\": [\n"
+      "      {\n"
+      "        \"type\":\"ImageActor\",\n"
+      "        \"name\":\"child-image\" \n"
+      "      }\n"
+      "    ]\n"
+      "  }\n"
+      "}\n"
+      "}\n"
+  );
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+
+  ImageActor actor = ImageActor::DownCast( builder.Create( "image-tree" ) );
+  DALI_TEST_CHECK( actor );
+
+  // NB: already applied in create
+  Property::Index index = actor.GetPropertyIndex("newproperty");
+  DALI_TEST_CHECK( Property::INVALID_INDEX != index );
+  Property::Value value = actor.GetProperty(index);
+  DALI_TEST_CHECK( value.Get<bool>() == true );
+
+  END_TEST;
+}
+
+int UtcDaliBuilderShaderEffectP(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+    "{\n"
+    "  \"stage\": [\n"
+    "    {\n"
+    "      \"type\": \"ImageActor\",\n"
+    "      \"name\": \"Image1\",\n"
+    "      \"position\": [\n"
+    "        0.40461349487305,\n"
+    "        0.9150390625,\n"
+    "        0.0\n"
+    "      ],\n"
+    "      \"parent-origin\": [0.5, 0.5, 0.5],\n"
+    "      \"size\": [200, 200, 0],\n"
+    "      \"effect\": \"Ripple2D\",\n"
+    "      \"image\": {\n"
+    "        \"filename\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\",\n"
+    "        \"width\": 200,\n"
+    "        \"height\": 80,\n"
+    "        \"load-policy\": \"IMMEDIATE\",\n"
+    "        \"release-policy\": \"NEVER\"\n"
+    "      },\n"
+    "      \"signals\": [\n"
+    "        {\n"
+    "          \"name\": \"on-stage\",\n"
+    "          \"action\": \"play\",\n"
+    "          \"animation\": \"Animation_1\"\n"
+    "        }\n"
+    "      ]\n"
+    "    }\n"
+    "  ],\n"
+    "  \"paths\": {},\n"
+    "  \"animations\": {\n"
+    "    \"Animation_1\": {\n"
+    "      \"loop\":true,\n"
+    "      \"properties\": [\n"
+    "        {\n"
+    "          \"actor\": \"Image1\",\n"
+    "          \"property\": \"uTime\",\n"
+    "          \"value\": 10.0,\n"
+    "          \"alpha-function\": \"LINEAR\",\n"
+    "          \"time-period\": {\n"
+    "            \"delay\": 0,\n"
+    "            \"duration\": 10.0\n"
+    "          },\n"
+    "          \"gui-builder-timeline-color\": \"#8dc0da\"\n"
+    "        }\n"
+    "      ]\n"
+    "    }\n"
+    "  },\n"
+    "  \"shader-effects\": {\n"
+    "    \"Ripple2D\": {\n"
+    "      \"program\": {\n"
+    "        \"vertexPrefix\": \"\",\n"
+    "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
+    "        \"fragmentPrefix\": \"\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"geometry-type\": \"GEOMETRY_TYPE_IMAGE\"\n"
+    "      },\n"
+    "      \"geometry-hints\": \"HINT_NONE\",\n"
+    "      \"grid-density\": 0,\n"
+    "      \"loop\": true,\n"
+    "      \"uAmplitude\": 0.02,\n"
+    "      \"uTime\": 0.0\n"
+    "    }\n"
+    "  }\n"
+    "}\n"
+
+  );
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+
+  ShaderEffect effect = builder.GetShaderEffect("Ripple2D");
+
+  // coverage
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+
+int UtcDaliBuilderLoadFromStringN(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+      "asdfsadf dsf asdf asdf {"
+         "\"stage\":"
+         "[{"
+           "\"type\": \"Actor\","
+           "\"size\": [100,100,1],"
+           "\"parent-origin\": \"TOP_LEFT\","
+           "\"anchor-point\": \"TOP_LEFT\","
+           "\"signals\": [{"
+             "\"name\": \"touched\","
+             "\"action\": \"quit\""
+           "}]"
+         "}]"
+      "}"
+  );
+  Builder builder = Builder::New();
+
+  bool assert1 = false;
+
+  try
+  {
+    builder.LoadFromString( json );
+  }
+  catch( Dali::DaliException& e )
+  {
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "!\"Cannot parse JSON\"", TEST_LOCATION);
+    assert1 = true;
+  }
+
+  DALI_TEST_CHECK( assert1 );
+
+  END_TEST;
+}
+
+int UtcDaliBuilderShaderEffect2P(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+    "{\n"
+    "\"templates\":\n"
+    "{\n"
+    "  \"image-tree\": { \n"
+    "    \"type\": \"ImageActor\",\n"
+    "    \"size\": [100,100,1],\n"
+    "    \"parent-origin\": [0.5, 0.5, 0.5],\n"
+    "    \"position\": [\n"
+    "      0.40461349487305,\n"
+    "      0.9150390625,\n"
+    "      0.0\n"
+    "    ],\n"
+    "    \"signals\": [{\n"
+    "      \"name\": \"touched\",\n"
+    "      \"action\": \"quit\"\n"
+    "    }],\n"
+    "    \"actors\": [\n"
+    "      {\n"
+    "        \"type\":\"ImageActor\",\n"
+    "        \"name\":\"child-image\" \n"
+    "      }\n"
+    "    ]\n"
+    "  }\n"
+    "},\n"
+    "  \"stage\": [\n"
+    "    {\n"
+    "      \"type\": \"image-tree\",\n"
+    "      \"name\": \"Image1\",\n"
+    "      \"effect\": \"Ripple2D\",\n"
+    "      \"image\": \"offscreen\""
+    "    }\n"
+    "  ],\n"
+    "  \"shader-effects\": {\n"
+    "    \"Ripple2D\": {\n"
+    "      \"program\": {\n"
+    "        \"vertexPrefix\": \"\",\n"
+    "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
+    "        \"fragmentPrefix\": \"\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"geometry-type\": \"GEOMETRY_TYPE_IMAGE\"\n"
+    "      },\n"
+    "      \"geometry-hints\": \"HINT_NONE\",\n"
+    "      \"grid-density\": 0,\n"
+    "      \"loop\": true,\n"
+    "      \"uAmplitude\": 0.02,\n"
+    "      \"uTime\": 0.0\n"
+    "    }\n"
+    "  },\n"
+    "  \"frame-buffer-images\": {\n"
+    "    \"offscreen\": {\n"
+    "      \"type\": \"FrameBufferImage\","
+    "      \"pixel-format\":\"RGBA8888\","
+    "      \"width\": 400,"
+    "      \"height\": 400"
+    "    }"
+    "   }"
+    "}\n"
+
+  );
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+
+  // coverage
+  DALI_TEST_CHECK( true );
+
+  END_TEST;
+}
+
+int UtcDaliBuilderAddActorsP(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+      "{\n"
+      "  \"arbitarysection\":\n"
+      "  [{\n"
+      "    \"type\": \"Actor\",\n"
+      "    \"name\": \"actor\",\n"
+      "    \"size\": [100,100,1],\n"
+      "    \"parent-origin\": \"TOP_LEFT\",\n"
+      "    \"anchor-point\": \"TOP_LEFT\",\n"
+      "    \"actors\": [{\n"
+      "      \"type\": \"Actor\",\n"
+      "      \"name\": \"sub-actor\",\n"
+      "      \"visible\": false\n"
+      "    }],\n"
+      "    \"signals\": [{\n"
+      "      \"name\": \"touched\",\n"
+      "      \"action\": \"hide\",\n"
+      "      \"actor\": \"actor\",\n"
+      "      \"child-actor\": \"sub-actor\"\n"
+      "    }]\n"
+      "  }]\n"
+      "}\n"
+  );
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+  builder.AddActors ( "arbitarysection", Stage::GetCurrent().GetRootLayer() );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  Actor actor = Stage::GetCurrent().GetRootLayer().FindChildByName("sub-actor");
+  DALI_TEST_CHECK( actor );
+
+  DALI_TEST_CHECK( !actor.IsVisible() );
+
+  END_TEST;
+}
+
+int UtcDaliBuilderFrameBufferP(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+    "{\n"
+    "  \"constants\":\n"
+    "  {\n"
+    "    \"FB_WIDTH\": 200.0,\n"
+    "    \"FB_HEIGHT\": 200.0,\n"
+    "    \"FB_SIZE\": [200,200],\n"
+    "    \"FB_ASPECT_RATIO\": 1\n"
+    "  },\n"
+    "  \"stage\": [\n"
+    "    {\n"
+    "      \"type\": \"ImageActor\",\n"
+    "      \"name\": \"fbOnStage\",\n"
+    "      \"position\": [\n"
+    "        0.40461349487305,\n"
+    "        0.9150390625,\n"
+    "        0.0\n"
+    "      ],\n"
+    "      \"parent-origin\": [0.5, 0.5, 0.5],\n"
+    "      \"size\": [300, 300, 0],\n"
+    "      \"image\": \"fb0\",\n"
+    "      \"clear-color\": [1,0,0,1]\n"
+    "    },\n"
+    "    {\n"
+    "      \"type\": \"ImageActor\",\n"
+    "      \"name\": \"Image1\",\n"
+    "      \"size\": [200, 200, 0],\n"
+    "      \"parent-origin\": [0.5, 0.5, 0.5],\n"
+    "      \"effect\": \"Ripple2D\",\n"
+    "      \"image\": {\n"
+    "        \"filename\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\",\n"
+    "        \"width\": 200,\n"
+    "        \"height\": 80,\n"
+    "        \"load-policy\": \"IMMEDIATE\",\n"
+    "        \"release-policy\": \"NEVER\"\n"
+    "      },\n"
+    "      \"signals\": [\n"
+    "        {\n"
+    "          \"name\": \"on-stage\",\n"
+    "          \"action\": \"play\",\n"
+    "          \"animation\": \"Animation_1\"\n"
+    "        }\n"
+    "      ]\n"
+    "    },\n"
+    "    {\n"
+    "      \"type\":\"CameraActor\",\n"
+    "      \"name\":\"fbCam\",\n"
+    "      \"aspect-ratio\": \"{FB_ASPECT_RATIO}\",\n"
+    "      \"projection-mode\": \"PERSPECTIVE_PROJECTION\",\n"
+    "      \"field-of-view\": 0.785,\n"
+    "      \"invert-y-axis\": true\n"
+    "    }\n"
+    "  ],\n"
+    "  \"frame-buffer-images\":\n"
+    "  {\n"
+    "    \"fb0\":\n"
+    "    {\n"
+    "      \"type\": \"FrameBufferImage\",\n"
+    "      \"width\": { \"type-cast\":\"float\", \"value\":\"{FB_WIDTH}\" },\n"
+    "      \"height\": { \"type-cast\":\"float\", \"value\":\"{FB_HEIGHT}\" }\n"
+    "    }\n"
+    "  },\n"
+    "  \"render-tasks\":\n"
+    "  {\n"
+    "    \"stage\":\n"
+    "    [\n"
+    "      {\n"
+    "        \"source-actor\": \"fbOnStage\"\n"
+    "      },\n"
+    "      {\n"
+    "        \"source-actor\": \"Image1\",\n"
+    "        \"target-frame-buffer\": \"fb0\",\n"
+    "        \"viewport-size\":\"{FB_SIZE}\",\n"
+    "        \"camera-actor\":\"fbCam\"\n"
+    "      }\n"
+    "    ]\n"
+    "  },\n"
+    "  \"paths\": {},\n"
+    "  \"animations\": {\n"
+    "    \"Animation_1\": {\n"
+    "      \"loop\":true,\n"
+    "      \"properties\": [\n"
+    "        {\n"
+    "          \"actor\": \"Image1\",\n"
+    "          \"property\": \"uTime\",\n"
+    "          \"value\": 10.0,\n"
+    "          \"alpha-function\": \"LINEAR\",\n"
+    "          \"time-period\": {\n"
+    "            \"delay\": 0,\n"
+    "            \"duration\": 10.0\n"
+    "          },\n"
+    "          \"gui-builder-timeline-color\": \"#8dc0da\"\n"
+    "        }\n"
+    "      ]\n"
+    "    }\n"
+    "  },\n"
+    "  \"shader-effects\": {\n"
+    "    \"Ripple2D\": {\n"
+    "      \"program\": {\n"
+    "        \"vertexPrefix\": \"\",\n"
+    "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
+    "        \"fragmentPrefix\": \"\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"geometry-type\": \"GEOMETRY_TYPE_IMAGE\"\n"
+    "      },\n"
+    "      \"geometry-hints\": \"HINT_NONE\",\n"
+    "      \"grid-density\": 0,\n"
+    "      \"loop\": true,\n"
+    "      \"uAmplitude\": 0.02,\n"
+    "      \"uTime\": 0.0\n"
+    "    }\n"
+    "  }\n"
+    "}\n");
+
+  Builder builder = Builder::New();
+
+  // frame buffer coverage
+  builder.LoadFromString( json );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  Dali::FrameBufferImage frameBuffer = builder.GetFrameBufferImage( "fb0" );
+  DALI_TEST_CHECK( frameBuffer );
+
+  Dali::FrameBufferImage frameBuffer2 = builder.GetFrameBufferImage( "fb0" );
+  DALI_TEST_CHECK( frameBuffer2 );
+  DALI_TEST_CHECK( frameBuffer == frameBuffer2 );
+
+  DALI_TEST_CHECK( true );
+
+  END_TEST;
+}
+
+int UtcDaliBuilderPathConstraintsP(void)
+{
+  ToolkitTestApplication application;
+
+  // JSON with a quit event when the actor is touched
+  std::string json(
+    "{\n"
+    "  \"constants\":\n"
+    "  {\n"
+    "    \"FB_WIDTH\": 200.0,\n"
+    "    \"FB_HEIGHT\": 200.0,\n"
+    "    \"FB_SIZE\": [200,200],\n"
+    "    \"FB_ASPECT_RATIO\": 1\n"
+    "  },\n"
+    "  \"stage\": [\n"
+    "    {\n"
+    "      \"type\": \"ImageActor\",\n"
+    "      \"name\": \"Image1\",\n"
+    "      \"size\": [200, 200, 0],\n"
+    "      \"parent-origin\": [0.5, 0.5, 0.5],\n"
+    "      \"effect\": \"Ripple2D\",\n"
+    "      \"image\": {\n"
+    "        \"filename\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\",\n"
+    "        \"width\": 200,\n"
+    "        \"height\": 80,\n"
+    "        \"load-policy\": \"IMMEDIATE\",\n"
+    "        \"release-policy\": \"NEVER\"\n"
+    "      },\n"
+    "      \"signals\": [\n"
+    "        {\n"
+    "          \"name\": \"on-stage\",\n"
+    "          \"action\": \"play\",\n"
+    "          \"animation\": \"path-animation\"\n"
+    "        },\n"
+    "        {\n"
+    "          \"name\": \"on-stage\",\n"
+    "          \"action\": \"applyConstraint\",\n"
+    "          \"constrainer\": \"constrainer0\",\n"
+    "          \"properties\":\n"
+    "          [\n"
+    "            {\n"
+    "              \"source\": \"Image1\",\n"
+    "              \"sourceProperty\": \"position-x\",\n"
+    "              \"target\": \"Image1\",\n"
+    "              \"targetProperty\": \"color-red\",\n"
+    "              \"range\": [-300,300]\n"
+    "            }\n"
+    "          ]\n"
+    "        },\n"
+    "        {\n"
+    "          \"name\": \"on-stage\",\n"
+    "          \"action\": \"applyConstraint\",\n"
+    "          \"constrainer\": \"constrainer1\",\n"
+    "          \"properties\":\n"
+    "          [\n"
+    "            {\n"
+    "              \"source\": \"Image1\",\n"
+    "              \"sourceProperty\": \"position-x\",\n"
+    "              \"target\": \"Image1\",\n"
+    "              \"targetProperty\": \"color-blue\",\n"
+    "              \"range\": [-300,300]\n"
+    "            }\n"
+    "          ]\n"
+    "        }\n"
+    "      ]\n"
+    "    }\n"
+    "  ],\n"
+    "  \"paths\":\n"
+    "  {\n"
+    "    \"path0\":\n"
+    "    {\n"
+    "      \"points\":[ [-150, -50, 0], [0.0,70.0,0.0], [190.0,-150.0,0.0] ],\n"
+    "      \"curvature\":0.35\n"
+    "    }\n"
+    "  },\n"
+    "  \"constrainers\":\n"
+    "  {\n"
+    "    \"constrainer0\":\n"
+    "    {\n"
+    "      \"type\": \"PathConstrainer\",\n"
+    "      \"points\": [ [0, 0, 0], [0,0,0], [0,0,0] ],\n"
+    "      \"control-points\": [ [0, 0, 0], [0,0,0], [0,0,0] ]\n"
+    "    },\n"
+    "    \"constrainer1\":\n"
+    "    {\n"
+    "      \"type\": \"LinearConstrainer\",\n"
+    "      \"value\": [ 0, 0, 0 ]\n"
+    "    }\n"
+    "  },\n"
+    "  \"animations\": {\n"
+    "    \"path-animation\": {\n"
+    "      \"duration\": 3.0,\n"
+    "      \"properties\":\n"
+    "      [{\n"
+    "        \"actor\": \"Image1\",\n"
+    "        \"path\":\"path0\",\n"
+    "        \"forward\":[1,0,0],\n"
+    "        \"alpha-function\": \"EASE_IN_OUT\",\n"
+    "        \"time-period\": {\n"
+    "          \"delay\": 0,\n"
+    "          \"duration\": 3\n"
+    "        }\n"
+    "      },\n"
+    "       {\n"
+    "         \"actor\": \"Image1\",\n"
+    "         \"property\": \"uTime\",\n"
+    "         \"value\": 10.0,\n"
+    "         \"alpha-function\": \"LINEAR\",\n"
+    "         \"time-period\": {\n"
+    "           \"delay\": 0,\n"
+    "           \"duration\": 10.0\n"
+    "         },\n"
+    "         \"gui-builder-timeline-color\": \"#8dc0da\"\n"
+    "       }]\n"
+    "    },\n"
+    "    \"Animation_1\": {\n"
+    "      \"loop\":true,\n"
+    "      \"properties\": [\n"
+    "        {\n"
+    "          \"actor\": \"Image1\",\n"
+    "          \"property\": \"uTime\",\n"
+    "          \"value\": 10.0,\n"
+    "          \"alpha-function\": \"LINEAR\",\n"
+    "          \"time-period\": {\n"
+    "            \"delay\": 0,\n"
+    "            \"duration\": 10.0\n"
+    "          },\n"
+    "          \"gui-builder-timeline-color\": \"#8dc0da\"\n"
+    "        }\n"
+    "      ]\n"
+    "    }\n"
+    "  },\n"
+    "  \"shader-effects\": {\n"
+    "    \"Ripple2D\": {\n"
+    "      \"program\": {\n"
+    "        \"vertexPrefix\": \"\",\n"
+    "        \"vertex\": \"void main(void)\\n{\\n  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\\n  vTexCoord = aTexCoord;\\n}\\n\\n\",\n"
+    "        \"fragmentPrefix\": \"\",\n"
+    "        \"fragment\": \"precision mediump float;\\nuniform float uAmplitude; // 0.02; (< 1)\\nuniform float uTime;\\nvoid main()\\n{\\n  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\\n  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\\n  highp float len = length(pos);\\n  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \\n  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\\n}\\n\\n\\n\",\n"
+    "        \"geometry-type\": \"GEOMETRY_TYPE_IMAGE\"\n"
+    "      },\n"
+    "      \"geometry-hints\": \"HINT_NONE\",\n"
+    "      \"grid-density\": 0,\n"
+    "      \"loop\": true,\n"
+    "      \"uAmplitude\": 0.02,\n"
+    "      \"uTime\": 0.0\n"
+    "    }\n"
+    "  }\n"
+    "}\n");
+
+  Builder builder = Builder::New();
+
+  // frame buffer coverage
+  builder.LoadFromString( json );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  Dali::Path path =  builder.GetPath( "path0" );
+  DALI_TEST_CHECK( path );
+
+  Dali::Path path2 =  builder.GetPath( "path0" );
+  DALI_TEST_CHECK( path2 );
+  DALI_TEST_CHECK( path == path2 );
+
+  Dali::PathConstrainer constrainer0 = builder.GetPathConstrainer( "constrainer0" );
+  DALI_TEST_CHECK( constrainer0 );
+
+  Dali::PathConstrainer constrainer0_2 = builder.GetPathConstrainer( "constrainer0" );
+  DALI_TEST_CHECK( constrainer0_2 );
+  DALI_TEST_CHECK( constrainer0 == constrainer0_2 );
+
+  Dali::LinearConstrainer constrainer1 = builder.GetLinearConstrainer( "constrainer1" );
+  DALI_TEST_CHECK( constrainer1 );
+
+  Dali::LinearConstrainer constrainer1_2 = builder.GetLinearConstrainer( "constrainer1" );
+  DALI_TEST_CHECK( constrainer1 == constrainer1_2 );
+
+  END_TEST;
+}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-CarouselEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-CarouselEffect.cpp
deleted file mode 100644 (file)
index cc11a4f..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/carousel-effect.h>
-
-using namespace Dali;
-
-
-void carousel_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void carousel_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliCarouselEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::CarouselEffect effect;
-
-  try
-  {
-    // New() must be called to create a CarouselEffect or it wont be valid.
-    effect.SetRadius( 100.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliCarouselEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New();
-
-  // Check the names, these names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetAnglePerUnitPropertyName(), "uAnglePerUnit", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliCarouselEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  const float radiusValue(0.0f);
-  const Vector2 centerValue(0.0f, 0.0f);
-  const Vector2 anglePerUnitValue(0.0f, 0.0f);
-
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAnglePerUnitPropertyName().c_str(), anglePerUnitValue ) );
-  END_TEST;
-}
-
-int UtcDaliCarouselEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::CarouselEffect effect = Toolkit::CarouselEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  const float radiusValue(100.0f);
-  const Vector2 centerValue(150.0f, 200.0f);
-  const Vector2 anglePerUnitValue(0.1f, 0.25f);
-
-  effect.SetRadius( radiusValue );
-  effect.SetCenter( centerValue );
-  effect.SetAnglePerUnit( anglePerUnitValue );
-
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAnglePerUnitPropertyName().c_str(), anglePerUnitValue ) );
-  END_TEST;
-}
index f3aa937..daac903 100644 (file)
@@ -922,7 +922,7 @@ int UtcDaliControlImplOnAccessibilityActivatedP(void)
   DALI_TEST_CHECK( handle );
 
   Property::Map attributes;
-  DALI_TEST_EQUALS( false, handle.DoAction("control-activated", attributes), TEST_LOCATION );
+  DALI_TEST_EQUALS( false, handle.DoAction("accessibility-activated", attributes), TEST_LOCATION );
 
   END_TEST;
 }
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DisplacementEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DisplacementEffect.cpp
deleted file mode 100644 (file)
index 773cb14..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/displacement-effect.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-namespace
-{
-const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
-} // namespace
-
-
-void utc_displacement_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_displacement_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-// Negative test case for a method
-int UtcDaliDisplacementEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliDisplacementEffectUninitialized");
-
-  Toolkit::DisplacementEffect effect;
-
-  try
-  {
-    // New() must be called to create a GaussianBlurView or it wont be valid.
-    effect.SetStateProperty( 1.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliDisplacementEffectNew(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliDisplacementEffectNew");
-
-  Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED);
-  DALI_TEST_CHECK( effect );
-
-  Toolkit::DisplacementEffect effect2 = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::FIXED);
-  DALI_TEST_CHECK( effect2 );
-  END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliDisplacementEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliDisplacementEffectPropertyNames");
-
-  Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED);
-  DALI_TEST_CHECK( effect );
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetLightDirectionPropertyName(), "uLightDirection", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetAmbientLightColorPropertyName(), "uAmbientLightColor", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetDiffuseLightColorPropertyName(), "uDiffuseLightColor", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetLightingMultiplierPropertyName(), "uLightMultiplier", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetStatePropertyName(), "uState", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetHeightScalePropertyName(), "uHightScale", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetFixedNormalPropertyName(), "uFixedNormal", TEST_LOCATION );
-  END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliDisplacementEffectTestSetProperty(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliDisplacementEffectTestSetProperty");
-
-  Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED);
-  DALI_TEST_CHECK( effect );
-
-  ImageActor actor = ImageActor::New( ResourceImage::New(TEST_IMAGE_FILE_NAME) );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  Toolkit::DisplacementEffect effect2 = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::FIXED);
-  DALI_TEST_CHECK( effect );
-
-  ImageActor actor2 = ImageActor::New( ResourceImage::New(TEST_IMAGE_FILE_NAME) );
-  actor2.SetSize( 100.0f, 100.0f );
-  actor2.SetShaderEffect( effect2 );
-  Stage::GetCurrent().Add( actor2 );
-
-  Vector3 testVector3 = Vector3(45.0f, 55.0f, 65.0f);
-  float testFloat = 0.623f;
-  effect.SetLightDirection(testVector3);
-  effect.SetAmbientLightColorProperty(testVector3);
-  effect.SetDiffuseLightColorProperty(testVector3);
-  effect.SetStateProperty(testFloat);
-  effect.SetLightingMultiplierProperty(testFloat);
-  effect.SetHeightScaleProperty(testFloat);
-
-  effect2.SetFixedNormalProperty(testVector3);
-
-  application.SendNotification();
-  application.Render(0);
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightDirectionPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetAmbientLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetDiffuseLightColorPropertyName() ) ).Get<Vector3>(), testVector3, TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetStatePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetLightingMultiplierPropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetProperty( effect.GetPropertyIndex( effect.GetHeightScalePropertyName().c_str() ) ).Get<float>(), testFloat, TEST_LOCATION );
-
-  Vector3 normalizedVector3(testVector3);
-  normalizedVector3.Normalize();
-  DALI_TEST_EQUALS( effect2.GetProperty( effect2.GetPropertyIndex( effect2.GetFixedNormalPropertyName() ) ).Get<Vector3>(), normalizedVector3, TEST_LOCATION );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DissolveEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DissolveEffect.cpp
deleted file mode 100644 (file)
index eebbbf2..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2014 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>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/dissolve-effect.h>
-
-
-using namespace Dali;
-
-void utc_dali_toolkit_dissolve_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_dissolve_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliDissolveUninitializedEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DissolveEffect effect;
-
-  try
-  {
-    // New() must be called to create a DissolveEffect or it wont be valid.
-    effect.SetDistortion( 2.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliDissolvePropertyNamesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DissolveEffect effectHighPrecision = Toolkit::DissolveEffect::New();
-  Toolkit::DissolveEffect effectMediumPrecision = Toolkit::DissolveEffect::New( false );
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effectHighPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION );
-  DALI_TEST_EQUALS( effectMediumPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliDissolveDefaultValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  effect.SetCentralLine( Vector2(0.0,0.5), Vector2(1.0, -0.1) );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
-  float value;
-  (effect.GetProperty(index)).Get( value );
-  DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliDissolveCustomValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  effect.SetDistortion( 0.5f );
-
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
-  float value;
-  (effect.GetProperty(index)).Get( value );
-  DALI_TEST_EQUALS(value, 0.5f, TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliSetEffectImageEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  Image effectImage = CreateBufferImage();
-  effect.SetEffectImage(effectImage);
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
-  float value;
-  (effect.GetProperty(index)).Get( value );
-  DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DistanceFieldEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DistanceFieldEffect.cpp
deleted file mode 100644 (file)
index b56034a..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>
-
-using namespace Dali;
-
-void utc_distance_field_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_distance_field_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-namespace
-{
-// Create buffer image
-BufferImage CreateDistanceField()
-{
-  BufferImage image = BufferImage::New(256, 256, Pixel::RGBA8888);
-  BufferImage distanceFieldImage = BufferImage::New(256, 256, Pixel::L8);
-
-  PixelBuffer* pixbuf = image.GetBuffer();
-
-  for(size_t i=0; i<16; i++)
-  {
-    pixbuf[i*4+0] = 0xFF;
-    pixbuf[i*4+1] = 0xFF;
-    pixbuf[i*4+2] = 0xFF;
-    pixbuf[i*4+3] = 0xFF;
-  }
-
-  // GenerateDistanceFieldMap(distanceFieldImage.GetBuffer(), Size(256, 256), pixbuf, Size(256, 256), 8, 4);
-
-  return distanceFieldImage;
-}
-}
-
-int UtcDaliDistanceFieldEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DistanceFieldEffect effect;
-
-  try
-  {
-    // New() must be called to create a DistanceField effect or it wont be valid.
-    effect.SetShadow( true );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliDistanceFieldEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetColorPropertyName(), "uColor", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetSmoothingPropertyName(), "uSmoothing", TEST_LOCATION );
-
-  // control flags
-  DALI_TEST_EQUALS( effect.GetOutlineEnablePropertyName(), "uDoOutline", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetGlowEnablePropertyName(), "uDoGlow", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetShadowEnablePropertyName(), "uDoShadow", TEST_LOCATION );
-
-  DALI_TEST_EQUALS( effect.GetGlowBoundaryPropertyName(), "uGlowBoundary", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetGlowColorPropertyName(), "uGlowColor", TEST_LOCATION );
-
-  DALI_TEST_EQUALS( effect.GetOutlineColorPropertyName(), "uOutlineColor", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetOutlineSizePropertyName(), "uOutlineParams", TEST_LOCATION );
-
-  DALI_TEST_EQUALS( effect.GetShadowColorPropertyName(), "uShadowColor", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetShadowOffsetPropertyName(), "uShadowOffset", TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliDistanceFieldEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateDistanceField();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetOutlineEnablePropertyName().c_str(),
-          0.0f ));
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetGlowEnablePropertyName().c_str(),
-          0.0f ));
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetShadowEnablePropertyName().c_str(),
-          0.0f ));
-  END_TEST;
-}
-
-int UtcDaliDistanceFieldEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateDistanceField();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  effect.SetShadowColor(Color::YELLOW);
-  effect.SetGlowColor(Color::BLUE);
-
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetShadowColorPropertyName().c_str(),
-          Color::YELLOW ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetGlowColorPropertyName().c_str(),
-          Color::BLUE ) );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-IrisEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-IrisEffect.cpp
deleted file mode 100644 (file)
index 9fad2c8..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2014 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>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/iris-effect.h>
-
-using namespace Dali;
-
-void utc_dali_toolkit_iris_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_iris_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliIrisEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::IrisEffect effect;
-
-  try
-  {
-    // New() must be called to create a IrisEffect or it wont be valid.
-    effect.SetRadius( 2.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliIrisEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::IrisEffect effect = Toolkit::IrisEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetBlendFactorPropertyName(), "uBlendFactor", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliIrisEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::IrisEffect effect = Toolkit::IrisEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  const float radiusValue(0.0f);
-  const Vector2 centerValue(0.5f, 0.5f);
-  const float blendFactorValue(100.0f);
-
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetBlendFactorPropertyName().c_str(), blendFactorValue ) );
-  END_TEST;
-}
-
-int UtcDaliIrisEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::IrisEffect effect = Toolkit::IrisEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  const float radiusValue(23.0f);
-  const Vector2 centerValue(0.2f, 0.7f);
-  const float blendFactorValue(10.0f);
-
-  effect.SetRadius( radiusValue );
-  effect.SetCenter( centerValue );
-  effect.SetBlendFactor( blendFactorValue );
-
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetRadiusPropertyName().c_str(), radiusValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), centerValue ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetBlendFactorPropertyName().c_str(), blendFactorValue ) );
-  END_TEST;
-}
index 67a2287..68938b9 100644 (file)
@@ -186,18 +186,6 @@ public: // From ItemLayout
   }
 
   /**
-   * Retrieve the resize animation in the layout.
-   *
-   * @param[in] animation The resize animation, not owned by the layout
-   * @param[in] actor The actor to animate
-   * @param [in] size The target size.
-   * @param [in] durationSeconds The duration of the resizing.
-   */
-  virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
-  {
-  }
-
-  /**
    * @brief Query the scroll direction of the layout.
    * @return The scroll direction in degrees.
    */
index e902ec0..95a6eb5 100644 (file)
@@ -594,7 +594,7 @@ int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void)
 
   bool focusedActorActivatedSignalVerified = false;
   FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
-  manager.FocusedActorActivatedSignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
+  manager.FocusedActorEnterKeySignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
 
   Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
 
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-OverlayEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-OverlayEffect.cpp
deleted file mode 100644 (file)
index 744af83..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/overlay-effect.h>
-
-
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-void overlay_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void overlay_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliOverlayConstructor(void)
-{
-  ToolkitTestApplication application;
-
-  BufferImage image = CreateBufferImage();
-
-  Toolkit::OverlayEffect effect = Toolkit::OverlayEffect::New( image );
-  DALI_TEST_CHECK( effect );
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  END_TEST;
-}
-
-int UtcDaliOverlayUninitializedEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::OverlayEffect effect;
-
-  try
-  {
-    BufferImage image = CreateBufferImage();
-
-    // New() must be called to create a OverlayEffect or it wont be valid.
-    effect.SetEffectImage( image );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnEffect.cpp
deleted file mode 100644 (file)
index e1924c6..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/page-turn-effect.h>
-
-using namespace Dali;
-
-void page_turn_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void page_turn_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliPageTurnEffectApply(void)
-{
-  ToolkitTestApplication application;
-
-  BufferImage image = CreateBufferImage();
-
-  Toolkit::PageTurnEffect pageTurnEffect = Toolkit::PageTurnEffect::New();
-  Toolkit::PageTurnEffect pageTurnEffect2 = Toolkit::PageTurnEffect::New(false);
-
-  ImageActor pageActor = ImageActor::New( image );
-  ImageActor backPageActor = ImageActor::New( image );
-  pageActor.Add( backPageActor );
-
-  pageTurnEffect.SetIsTurningBack( true );
-  pageTurnEffect.SetShadowWidth( 0.0f );
-  pageTurnEffect.SetSpineShadowParameter( Vector2( 0.0f, 0.0f ) );
-
-  pageActor.SetShaderEffect( pageTurnEffect );
-  Stage::GetCurrent().Add( pageActor );
-
-  application.SendNotification();
-  application.Render();
-
-  const Vector2 pageSize( 0.0f, 0.0f );
-  pageTurnEffect.SetPageSize( pageSize );
-
-  const Vector2 originalCenter( 0.0f, 0.0f );
-  pageTurnEffect.SetOriginalCenter( originalCenter );
-
-  const Vector2 currentCenter( 0.0f, 0.0f );
-  pageTurnEffect.SetCurrentCenter( currentCenter );
-
-  application.SendNotification();
-  application.Render();
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetPageSizePropertyName().c_str(), pageSize ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetOriginalCenterPropertyName().c_str(), originalCenter ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( pageTurnEffect.GetCurrentCenterPropertyName().c_str(), currentCenter ) );
-  END_TEST;
-}
-
-int UtcDaliPageTurnEffectConstruct(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::PageTurnEffect* effect = new Toolkit::PageTurnEffect();
-  delete effect;
-
-  DALI_TEST_CHECK( true );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Ripple2DEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Ripple2DEffect.cpp
deleted file mode 100644 (file)
index 263a5d1..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2014 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>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/ripple2d-effect.h>
-
-using namespace Dali;
-
-
-void utc_dali_toolkit_ripple_2d_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_ripple_2d_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-int UtcDaliRipple2DEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::Ripple2DEffect effect;
-
-  try
-  {
-    // New() must be called to create a Ripple2DEffect or it wont be valid.
-    effect.SetAmplitude( 0.5f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliRipple2DEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetAmplitudePropertyName(), "uAmplitude", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetTimePropertyName(), "uTime", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliRipple2DEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetAmplitudePropertyName().c_str(),
-          0.0f ) );
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetTimePropertyName().c_str(),
-          0.0f ) );
-  END_TEST;
-}
-
-int UtcDaliRipple2DEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-
-  effect.SetAmplitude( 5.0f );
-  effect.SetTime( 2.0f );
-
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetAmplitudePropertyName().c_str(),
-          5.0f ) );
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetTimePropertyName().c_str(),
-          2.0f ) );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RippleEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RippleEffect.cpp
deleted file mode 100644 (file)
index 0ba33d7..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2014 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>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/ripple-effect.h>
-
-
-using namespace Dali;
-
-void utc_dali_toolkit_ripple_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_ripple_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliRippleUninitializedEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::RippleEffect effect;
-
-  try
-  {
-    // New() must be called to create a RippleEffect or it wont be valid.
-    effect.SetAmplitude( 0.5f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliRipplePropertyNamesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::RippleEffect effect = Toolkit::RippleEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetAmplitudePropertyName(), "uAmplitude", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetTimePropertyName(), "uTime", TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliRippleDefaultValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::RippleEffect effect = Toolkit::RippleEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetAmplitudePropertyName().c_str(),
-          0.0f ) );
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          Vector2( 0.0f, 0.0f ) ) );
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetTimePropertyName().c_str(),
-          0.0f ) );
-  END_TEST;
-}
-
-int UtcDaliRippleCustomValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::RippleEffect effect = Toolkit::RippleEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  effect.SetAmplitude( 0.5f );
-  effect.SetCenter( Vector2( 10.0f, 10.0f ) );
-  effect.SetTime( 2.0f );
-
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetAmplitudePropertyName().c_str(),
-          0.5f ) );
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          Vector2( 10.0f, 10.0f ) ) );
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetTimePropertyName().c_str(),
-          2.0f ) );
-  END_TEST;
-}
 
 #include <iostream>
 #include <stdlib.h>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
 #include <dali-toolkit-test-suite-utils.h>
-
-#include <dali.h>
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/mask-effect.h>
+#include <dali-toolkit/devel-api/scripting/script.h>
 
 using namespace Dali;
+using namespace Dali::Toolkit;
 
-void utc_dali_toolkit_mask_effect_startup(void)
+void dali_script_startup(void)
 {
   test_return_value = TET_UNDEF;
 }
 
-void utc_dali_toolkit_mask_effect_cleanup(void)
+void dali_script_cleanup(void)
 {
   test_return_value = TET_PASS;
 }
 
-
-int UtcDaliMaskEffectCreateEffect(void)
+int UtcDaliScriptExecuteFileN(void)
 {
   ToolkitTestApplication application;
+  tet_infoline(" UtcDaliScriptExecuteFileN");
 
-  BufferImage image = CreateBufferImage();
-
-  ShaderEffect effect = Toolkit::MaskEffect::New( image );
-  DALI_TEST_CHECK( effect );
-  END_TEST;
-}
+  Script script = Script::New();
 
-int UtcDaliMaskEffectDestructor(void)
-{
-  ToolkitTestApplication application;
+  bool ok = script.ExecuteFile("non-existing file");
 
-  Toolkit::MaskEffect* effect = new Toolkit::MaskEffect();
-  delete effect;
+  DALI_TEST_CHECK( !ok );
 
-  DALI_TEST_CHECK( true );
   END_TEST;
 }
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp
new file mode 100644 (file)
index 0000000..cc5195d
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2015 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 <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/bendy-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/blind-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/bouncing-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/carousel-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/displacement-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/dissolve-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/dissolve-local-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/iris-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/mask-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/mirror-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/overlay-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/quadratic-bezier.h>
+#include <dali-toolkit/devel-api/shader-effects/ripple-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/ripple2d-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/shear-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/soft-button-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/spot-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/square-dissolve-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/swirl-effect.h>
+
+using namespace Dali;
+
+int UtcDaliCreateAlphaDiscardEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateAlphaDiscardEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateBendyEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateBendyEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateBlindEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateBlindEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateBouncingEffect(void)
+{
+  ToolkitTestApplication application;
+
+  Vector4 color(1.0f,1.0f,1.0f,1.0f);
+
+  ShaderEffect effect = Toolkit::CreateBouncingEffect(color);
+  DALI_TEST_CHECK( effect );
+
+  Property::Value value = effect.GetProperty( effect.GetPropertyIndex("uAssignedColor"));
+  DALI_TEST_EQUALS( value.Get<Vector4>(), color, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliCreateCarouselEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateCarouselEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateDisplacementEffectDisplaced(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateDisplacementEffect(Toolkit::DISPLACEMENT_EFFECT_DISPLACED);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateDisplacementEffectFixed(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateDisplacementEffect(Toolkit::DISPLACEMENT_EFFECT_FIXED);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateDissolveEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateDissolveEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateDissolveEffectMediumPrecision(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateDissolveEffect(false);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateDissolveLocalEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateDissolveLocalEffect(0);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateDistanceFieldEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateDistanceFieldEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateImageRegionEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateImageRegionEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateIrisEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateIrisEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateMaskEffect(void)
+{
+  ToolkitTestApplication application;
+
+  BufferImage image = CreateBufferImage();
+  ShaderEffect effect = Toolkit::CreateMaskEffect(image);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateMirrorEffect(void)
+{
+  ToolkitTestApplication application;
+
+  BufferImage image = CreateBufferImage();
+  ShaderEffect effect = Toolkit::CreateMirrorEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateMotionBlurEffect(void)
+{
+  ToolkitTestApplication application;
+
+  unsigned int sampleCount(4);
+  ShaderEffect effect = Toolkit::CreateMotionBlurEffect(sampleCount);
+  DALI_TEST_CHECK( effect );
+
+  Property::Value value = effect.GetProperty( effect.GetPropertyIndex("uNumSamples"));
+  DALI_TEST_EQUALS( value.Get<float>(), (float)sampleCount, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliCreateMotionStretchEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateMotionStretchEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateOverlayEffect(void)
+{
+  ToolkitTestApplication application;
+
+  BufferImage image = CreateBufferImage();
+  ShaderEffect effect = Toolkit::CreateOverlayEffect(image);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateQuadraticBezier(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateQuadraticBezier(3,false);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateQuadraticBezierFilled(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateQuadraticBezier(3,true);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateRipple2DEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateRipple2DEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateRippleEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateRippleEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateShearEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateShearEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliSoftButtonEffectElliptical(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateSoftButtonEffect(Toolkit::SOFT_BUTTON_ELLIPTICAL);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliSoftButtonEffectRectangular(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateSoftButtonEffect(Toolkit::SOFT_BUTTON_RECTANGULAR);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliSoftButtonEffectFixed(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateSoftButtonEffect(Toolkit::SOFT_BUTTON_FIXED);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateSpotEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateSpotEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliCreateSquareDissolveEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateSquareDissolveEffect();
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliSwirlEffect(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateSwirlEffect(false);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
+
+int UtcDaliSwirlEffectWrap(void)
+{
+  ToolkitTestApplication application;
+
+  ShaderEffect effect = Toolkit::CreateSwirlEffect(true);
+  DALI_TEST_CHECK( effect );
+
+  END_TEST;
+}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ShearEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ShearEffect.cpp
deleted file mode 100644 (file)
index b79af6f..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/shear-effect.h>
-
-using namespace Dali;
-
-void shear_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void shear_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-int UtcDaliShearEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::ShearEffect effect;
-
-  try
-  {
-    // New() must be called to create a ShearEffect or it wont be valid.
-    effect.SetAngleXAxis( 45.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliShearEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::ShearEffect effect = Toolkit::ShearEffect::New();
-
-  // Check the names, these names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetAngleXAxisPropertyName(), "uAngleXAxis", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetAngleYAxisPropertyName(), "uAngleYAxis", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
-  END_TEST;
-}
-
-namespace
-{
-
-/**
- * Converts value to screen position in the same way that
- * the core does under COORDINATE_TYPE_SCREEN_POSITION
- *
- * @param[in] value the input position value.
- * @return The translated position value ready for gl.
- */
-Vector2 ToScreenPosition(Vector2 value)
-{
-  Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
-  value.x = stageSize.x * 0.5f - value.x;
-  value.y = value.y - stageSize.y * 0.5f;
-
-  return value;
-}
-
-}// namespace
-
-int UtcDaliShearEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::ShearEffect effect = Toolkit::ShearEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  const float angleXAxis(0.0f);
-  const float angleYAxis(0.0f);
-  const Vector2 centerValue(0.0f, 0.0f);
-
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleXAxisPropertyName().c_str(), angleXAxis ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleYAxisPropertyName().c_str(), angleYAxis ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), ToScreenPosition(centerValue) ) );
-  END_TEST;
-}
-
-int UtcDaliShearEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::ShearEffect effect = Toolkit::ShearEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  const float angleXAxis(10.0f);
-  const float angleYAxis(22.5f);
-  const Vector2 centerValue(50.0f, 100.0f);
-
-  effect.SetAngleXAxis( angleXAxis );
-  effect.SetAngleYAxis( angleYAxis );
-  effect.SetCenter( centerValue );
-
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleXAxisPropertyName().c_str(), angleXAxis ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetAngleYAxisPropertyName().c_str(), angleYAxis ) );
-  DALI_TEST_CHECK( gl.CheckUniformValue( effect.GetCenterPropertyName().c_str(), ToScreenPosition(centerValue) ) );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SoftButtonEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SoftButtonEffect.cpp
deleted file mode 100644 (file)
index e2bcc25..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/soft-button-effect.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-void soft_button_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void soft_button_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-// Negative test case for a method
-int UtcDaliSoftButtonEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliSoftButtonEffectUninitialized");
-
-  Toolkit::SoftButtonEffect effect;
-
-  // New() must be called to create a SoftButtonEffect or it wont be valid.
-
-  DALI_TEST_CHECK(!effect);
-  END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliSoftButtonEffectNew(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliGaussianBlurViewNew");
-
-  Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL);
-  DALI_TEST_CHECK( effect );
-  END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliSoftButtonEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliSoftButtonEffectPropertyNames");
-
-  Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL);
-  DALI_TEST_CHECK( effect );
-
-  // Check the names, this names are used in the shader code,
-  // if they change in the shader code, then it has to be updated here.
-  DALI_TEST_EQUALS( effect.GetLightingIndentationAmountPropertyName(), "uLightingIndentationAmount", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetTextureDistortionAmountPropertyName(), "uTextureDistortAmount", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetAmbientLightAmountPropertyName(), "uAmbientLight", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetDiffuseLightPropertyName(), "uDiffuseLight", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetLightingMultiplierPropertyName(), "uLightMultiplier", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetInsideShapeSizeScalePropertyName(), "uInsideCircleSizeScale", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetOutsideShapeDepthPropertyName(), "uOutsideCircleDepth", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetEffectPixelAreaPropertyName(), "uEffectRegion", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetRectangleSizeScalePropertyName(), "uRectangleSizeScale", TEST_LOCATION );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SpotEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SpotEffect.cpp
deleted file mode 100644 (file)
index a6aee80..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/spot-effect.h>
-
-
-using namespace Dali;
-
-void spot_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void spot_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliSpotUninitializedEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SpotEffect effect;
-
-  try
-  {
-    // New() must be called to create a SpotEffect or it wont be valid.
-    effect.SetRadius( 0.5f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliSpotPropertyNamesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SpotEffect effect = Toolkit::SpotEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliSpotDefaultValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SpotEffect effect = Toolkit::SpotEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          Vector2(0.0f, 0.0f) ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRadiusPropertyName().c_str(),
-          0.0f ) );
-  END_TEST;
-}
-
-int UtcDaliSpotCustomValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SpotEffect effect = Toolkit::SpotEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  effect.SetCenter( Vector2(480.0f, 800.0f) );
-  effect.SetRadius( 5.0f );
-
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          Vector2(480.0f, 800.0f) ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRadiusPropertyName().c_str(),
-          5.0f ) );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SquareDissolveEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SquareDissolveEffect.cpp
deleted file mode 100644 (file)
index 625ffe8..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/square-dissolve-effect.h>
-
-
-using namespace Dali;
-
-void square_dissolve_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void square_dissolve_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-int UtcDaliSquareDissolveEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SquareDissolveEffect effect;
-
-  try
-  {
-    // New() must be called to create a SquareDissolveEffect or it wont be valid.
-    effect.SetStep( 2.0f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliSquareDissolveEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetRowsPropertyName(), "uRows", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetColumnsPropertyName(), "uColumns", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetTexSizePropertyName(), "texSize", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliSquareDissolveEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetStepPropertyName().c_str(),
-          0.1f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRowsPropertyName().c_str(),
-          25.0f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetColumnsPropertyName().c_str(),
-          25.0f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetTexSizePropertyName().c_str(),
-          Vector2(1.0f, 1.0f) ) );
-  END_TEST;
-}
-
-int UtcDaliSquareDissolveEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  effect.SetStep( 2.0f );
-  effect.SetRows( 3.0f );
-  effect.SetColumns( 4.0f );
-  effect.SetTextureSize( Vector2(12.0f, 13.0f) );
-
-  actor.SetShaderEffect(effect);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetStepPropertyName().c_str(),
-          2.0f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRowsPropertyName().c_str(),
-          3.0f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetColumnsPropertyName().c_str(),
-          4.0f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetTexSizePropertyName().c_str(),
-          Vector2(12.0f, 13.0f) ) );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SwirlEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SwirlEffect.cpp
deleted file mode 100644 (file)
index f9b6487..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2014 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>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/swirl-effect.h>
-
-
-using namespace Dali;
-
-
-void utc_dali_toolkit_swirl_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_swirl_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-int UtcDaliSwirlUninitializedEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SwirlEffect effect;
-
-  try
-  {
-    // New() must be called to create a SwirlEffect or it wont be valid.
-    effect.SetRadius( 0.5f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliSwirlPropertyNamesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false);
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetAnglePropertyName(), "uAngle", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliSwirlDefaultValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(true);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetAnglePropertyName().c_str(),
-          0.0f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          Vector2(0.5f, 0.5f) ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRadiusPropertyName().c_str(),
-          1.0f ) );
-  END_TEST;
-}
-
-int UtcDaliSwirlCustomValuesEffect(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-
-  effect.SetAngle( 1.0f );
-  effect.SetCenter( Vector2(0.3f, 0.7f) );
-  effect.SetRadius( 2.0f );
-
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // Gets converted to opengl viewport coordinates
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetAnglePropertyName().c_str(),
-          1.0f ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName().c_str(),
-          Vector2(0.3f, 0.7f) ) );
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetRadiusPropertyName().c_str(),
-          2.0f ) );
-  END_TEST;
-}
index 6254e7a..9c1e054 100644 (file)
@@ -693,13 +693,14 @@ int UtcDaliTableViewCustomProperties(void)
 
   // Create a 10x10 table-view
   TableView tableView = TableView::New(10,10);
-  Constraint constraint = Constraint::New<Vector3>( tableView, Actor::Property::SIZE, Constraint100() );
-  constraint.Apply();
+  Stage::GetCurrent().Add( tableView );
+  tableView.SetSize( Dali::Vector2( 100.0f, 100.0f ) );
+
   DALI_TEST_CHECK( tableView );
 
   // Create a child actor with the custom properties
   Actor child1 = Actor::New();
-  child1.RegisterProperty( TableView::CELL_INDICES_PROPERTY_NAME, Vector2( 3, 4 ) );
+  child1.RegisterProperty( "cell-index", Vector2( 3, 4 ), Property::READ_WRITE );
   tableView.Add( child1 );
   // Check for actors at actual positions.
   DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(3,4)) == child1);
@@ -708,9 +709,9 @@ int UtcDaliTableViewCustomProperties(void)
   Actor child2 = Actor::New();
   float rowSpan = 3.f;
   float columnSpan = 2.f;
-  child2.RegisterProperty( TableView::CELL_INDICES_PROPERTY_NAME, Vector2( 6, 1 ) );
-  child2.RegisterProperty( TableView::ROW_SPAN_PROPERTY_NAME, rowSpan );
-  child2.RegisterProperty( TableView::COLUMN_SPAN_PROPERTY_NAME, columnSpan );
+  child2.RegisterProperty( "cell-index", Vector2( 6, 1 ), Property::READ_WRITE );
+  child2.RegisterProperty( "row-span", rowSpan, Property::READ_WRITE );
+  child2.RegisterProperty( "column-span", columnSpan, Property::READ_WRITE );
   tableView.Add( child2 );
   // Check for actors at actual positions.
   for( int i=0; i<rowSpan; i++ )
@@ -721,6 +722,22 @@ int UtcDaliTableViewCustomProperties(void)
     }
   }
 
+  // Create a third child actor with the cell alignment properties
+  Actor child3 = Actor::New();
+  child3.SetSize( 5.f,5.f );
+  child3.RegisterProperty( "cell-horizontal-alignment", "center", Property::READ_WRITE );
+  child3.RegisterProperty( "cell-vertical-alignment", "bottom", Property::READ_WRITE );
+  tableView.Add( child3 );
+
+  // store the actor in the first available cell
+  DALI_TEST_CHECK( tableView.GetChildAt(TableView::CellPosition(0,0)) == child3)
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( child3.GetCurrentAnchorPoint(), AnchorPoint::TOP_LEFT, TEST_LOCATION );
+  DALI_TEST_EQUALS( child3.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
+  DALI_TEST_EQUALS( child3.GetCurrentPosition(), Vector3(2.5f, 5.0f, 0.0f), TEST_LOCATION );
+
   END_TEST;
 }
 
index 2d8a983..8597e4b 100644 (file)
@@ -17,9 +17,9 @@
 
 #include <iostream>
 #include <stdlib.h>
+#include <dali/devel-api/rendering/renderer.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/tap-gesture-event.h>
-#include <dali/devel-api/actors/mesh-actor.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/styling/style-manager.h>
@@ -293,8 +293,8 @@ int UtcDaliTextFieldSetPropertyP(void)
   DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::SELECTION_HIGHLIGHT_COLOR ), LIGHT_BLUE, TEST_LOCATION );
 
   // Check the render backend property.
-  field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_BASIC );
-  DALI_TEST_EQUALS( field.GetProperty<unsigned int>( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_BASIC, TEST_LOCATION );
+  field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
+  DALI_TEST_EQUALS( field.GetProperty<unsigned int>( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
 
   // Check text property.
   field.SetProperty( TextField::Property::TEXT, "Setting Text" );
@@ -387,34 +387,6 @@ int UtcDaliTextFieldSetPropertyP(void)
   END_TEST;
 }
 
-// Positive Basic Text Renderer test
-int utcDaliTextFieldBasicRenderP(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("UtcDaliToolkitTextFieldBasicRenderP");
-  TextField field = TextField::New();
-  DALI_TEST_CHECK( field );
-
-  field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
-
-  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
-
-  Stage::GetCurrent().Add( field );
-
-  try
-  {
-    // Render some text with the basic backend
-    field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_BASIC );
-    application.SendNotification();
-    application.Render();
-  }
-  catch( ... )
-  {
-    tet_result(TET_FAIL);
-  }
-  END_TEST;
-}
-
 // Positive Atlas Text Renderer test
 int utcDaliTextFieldAtlasRenderP(void)
 {
@@ -696,7 +668,7 @@ int utcDaliTextFieldEvent02(void)
   CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
   DALI_TEST_CHECK( camera );
 
-  RenderableActor renderer = RenderableActor::DownCast( offscreenRoot.GetChildAt( 1u ) );
+  Renderer renderer = offscreenRoot.GetChildAt( 1u ).GetRendererAt( 0u );
   DALI_TEST_CHECK( renderer );
 
   // Move the cursor and check the position changes.
@@ -763,7 +735,7 @@ int utcDaliTextFieldEvent02(void)
   // Cursor position should be the same than position2.
   Vector3 position6 = cursor.GetCurrentPosition();
 
-  DALI_TEST_EQUALS( Vector3( 0.f, position2.y, position2.z ), position6, TEST_LOCATION ); // TODO Should be in the same position2.
+  DALI_TEST_EQUALS( position2, position6, TEST_LOCATION );// Should be in the same position2.
 
   // Should not be renderer.
   DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor only.
@@ -818,10 +790,10 @@ int utcDaliTextFieldEvent03(void)
   CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
   DALI_TEST_CHECK( camera );
 
-  RenderableActor renderer = RenderableActor::DownCast( offscreenRoot.GetChildAt( 1u ) );
+  Renderer renderer = offscreenRoot.GetChildAt( 1u ).GetRendererAt( 0u );
   DALI_TEST_CHECK( renderer );
 
-  MeshActor highlight = MeshActor::DownCast( offscreenRoot.GetChildAt( 2u ) );
+  Renderer highlight = offscreenRoot.GetChildAt( 2u ).GetRendererAt( 0u );
   DALI_TEST_CHECK( highlight );
 
   END_TEST;
index dd5d091..21b3c8b 100644 (file)
@@ -177,8 +177,8 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::UNDERLINE_COLOR ), Color::BLACK, TEST_LOCATION );
   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::UNDERLINE_HEIGHT ), 0.0f, TEST_LOCATION );
 
-  label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_BASIC );
-  DALI_TEST_EQUALS( label.GetProperty<unsigned int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_BASIC, TEST_LOCATION );
+  label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
+  DALI_TEST_EQUALS( label.GetProperty<unsigned int>( TextLabel::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
 
   // Check that text can be correctly reset
   label.SetProperty( TextLabel::Property::TEXT, "Setting Text" );
@@ -229,35 +229,6 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   END_TEST;
 }
 
-int UtcDaliToolkitTextlabelBasicRenderP(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliToolkitTextLabelBasicRenderP");
-  TextLabel label = TextLabel::New("Test Text");
-  DALI_TEST_CHECK( label );
-
-  // Avoid a crash when core load gl resources.
-  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
-
-  Stage::GetCurrent().Add( label );
-
-  label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
-  label.SetProperty( TextLabel::Property::MULTI_LINE, true );
-
-  try
-  {
-    // Render some text with the basic backend
-    label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Text::RENDERING_BASIC );
-    application.SendNotification();
-    application.Render();
-  }
-  catch( ... )
-  {
-    tet_result(TET_FAIL);
-  }
-  END_TEST;
-}
-
 int UtcDaliToolkitTextlabelAtlasRenderP(void)
 {
   ToolkitTestApplication application;
@@ -289,6 +260,7 @@ int UtcDaliToolkitTextlabelAtlasRenderP(void)
   {
     tet_result(TET_FAIL);
   }
+
   END_TEST;
 }
 
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-WaterEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-WaterEffect.cpp
deleted file mode 100644 (file)
index ca77428..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 2014 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 <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/water-effect.h>
-
-using namespace Dali;
-
-void dali_water_effect_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void dali_water_effect_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-
-
-int UtcDaliWaterEffectUninitialized(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect;
-
-  try
-  {
-    // New() must be called to create a RippleEffect or it wont be valid.
-    effect.SetAmplitude( 0, 0.5f );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK(!effect);
-  }
-  END_TEST;
-}
-
-int UtcDaliWaterEffectPropertyNames(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  // Check the names, this names are used in the shaders code,
-  // if they change the shader code has to be updated
-  DALI_TEST_EQUALS( effect.GetAmplitudePropertyName( 0 ), "uDrops[0].amplitude", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetCenterPropertyName( 0 ), "uDrops[0].center", TEST_LOCATION );
-  DALI_TEST_EQUALS( effect.GetPropagationPropertyName( 0 ), "uDrops[0].radius", TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliWaterEffectOutOfBounds(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  try
-  {
-    // the highest index acceptable is (GetNumberOfWaves() - 1)
-    effect.SetAmplitude( effect.GetNumberOfWaves(), 0 );
-    DALI_TEST_CHECK( false );
-  }
-  catch (Dali::DaliException& e)
-  {
-    // Tests that a negative test of an assertion succeeds
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_CHECK( true );
-  }
-  END_TEST;
-}
-
-int UtcDaliWaterEffectDefaultValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  // Check that the effect has the number of waves it was requested
-  DALI_TEST_CHECK( effect.GetNumberOfWaves() == 4 );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  Vector2 topLeft( Stage::GetCurrent().GetSize() * 0.5f );
-  topLeft.y = -topLeft.y;
-
-  for ( unsigned int i = 0; i < effect.GetNumberOfWaves(); ++i )
-  {
-    DALI_TEST_CHECK(
-        application.GetGlAbstraction().CheckUniformValue(
-            effect.GetAmplitudePropertyName(i).c_str(),
-            0.0f ) );
-    DALI_TEST_CHECK(
-        application.GetGlAbstraction().CheckUniformValue(
-            effect.GetCenterPropertyName(i).c_str(),
-            topLeft ) );
-    DALI_TEST_CHECK(
-        application.GetGlAbstraction().CheckUniformValue(
-            effect.GetPropagationPropertyName(i).c_str(),
-            0.0f ) );
-  }
-  END_TEST;
-}
-
-int UtcDaliWaterEffectCustomValues(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  effect.SetAmplitude( 0, 0.5f );
-  effect.SetCenter( 0, Vector2 ( 10.0f, 10.0f ) );
-  effect.SetPropagation( 0, 2.0f );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetAmplitudePropertyName(0).c_str(),
-          0.5f ) );
-
-  Vector2 centerPoint( Stage::GetCurrent().GetSize() * 0.5f );
-  centerPoint.y = -centerPoint.y;
-
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetCenterPropertyName(0).c_str(),
-          Vector2( centerPoint.x - 10.0f, centerPoint.y + 10.0f ) ) );
-  DALI_TEST_CHECK(
-      application.GetGlAbstraction().CheckUniformValue(
-          effect.GetPropagationPropertyName(0).c_str(),
-          2.0f ) );
-  END_TEST;
-}
-
-int UtcDaliWaterEffectGetAmplitudePositive(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  float amplitude(0.5f);
-  DALI_TEST_CHECK(effect.GetAmplitude(0) != amplitude);
-  effect.SetAmplitude( 0, amplitude );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS(amplitude, effect.GetAmplitude(0), TEST_LOCATION);
-  END_TEST;
-}
-
-int UtcDaliWaterEffectGetAmplitudeNegative(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  try
-  {
-    effect.GetAmplitude(9999);
-    tet_result(TET_FAIL);
-  }
-  catch(DaliException& e)
-  {
-    DALI_TEST_ASSERT(e, "index < mNumberOfWaves", TEST_LOCATION );
-  }
-  END_TEST;
-}
-
-int UtcDaliWaterEffectGetCenterPositive(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  Vector2 center(10.0f, 20.0f);
-  DALI_TEST_CHECK(effect.GetCenter(0) != center);
-  effect.SetCenter( 0, center );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS(center, effect.GetCenter(0), TEST_LOCATION);
-  END_TEST;
-}
-
-int UtcDaliWaterEffectGetCenterNegative(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  try
-  {
-    effect.GetCenter(9999);
-    tet_result(TET_FAIL);
-  }
-  catch(DaliException& e)
-  {
-    DALI_TEST_ASSERT(e, "index < mNumberOfWaves", TEST_LOCATION );
-  }
-  END_TEST;
-}
-
-int UtcDaliWaterEffectGetPropagationPositive(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  float propagation(0.5f);
-  DALI_TEST_CHECK(effect.GetPropagation(0) != propagation);
-  effect.SetPropagation( 0, propagation );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS(propagation, effect.GetPropagation(0), TEST_LOCATION);
-  END_TEST;
-}
-
-int UtcDaliWaterEffectGetPropagationNegative(void)
-{
-  ToolkitTestApplication application;
-
-  Toolkit::WaterEffect effect = Toolkit::WaterEffect::New(4);
-  DALI_TEST_CHECK( effect );
-
-  BufferImage image = CreateBufferImage();
-
-  ImageActor actor = ImageActor::New( image );
-  actor.SetSize( 100.0f, 100.0f );
-  actor.SetShaderEffect( effect );
-  Stage::GetCurrent().Add( actor );
-
-  try
-  {
-    effect.GetPropagation(9999);
-    tet_result(TET_FAIL);
-  }
-  catch(DaliException& e)
-  {
-    DALI_TEST_ASSERT(e, "index < mNumberOfWaves", TEST_LOCATION );
-  }
-  END_TEST;
-}
index 0319ac1..9ef6afb 100644 (file)
@@ -96,7 +96,6 @@ develapishadowviewdir =         $(develapicontrolsdir)/shadow-view
 develapisuperblurviewdir =      $(develapicontrolsdir)/super-blur-view
 develapifocusmanagerdir =       $(develapidir)/focus-manager
 develapiscriptingdir =          $(develapidir)/scripting
-develapibubbleeffectdir =       $(develapidir)/shader-effects/bubble-effect
 develapishadereffectsdir =      $(develapidir)/shader-effects
 develapitransitioneffectsdir =  $(develapidir)/transition-effects
 develapistylingdir =            $(develapidir)/styling
@@ -106,7 +105,6 @@ develapitextselectionpopupdir = $(develapicontrolsdir)/text-controls
 # devel headers
 develapibloomview_HEADERS =         $(devel_api_bloom_view_header_files)
 develapibubbleemitter_HEADERS =     $(devel_api_bubble_emitter_header_files)
-develapibubbleeffect_HEADERS =      $(devel_api_bubble_effect_header_files)
 develapibuilder_HEADERS =           $(devel_api_builder_header_files)
 develapieffectsview_HEADERS =       $(devel_api_effects_view_header_files)
 develapifocusmanager_HEADERS =      $(devel_api_focus_manager_header_files)
@@ -124,34 +122,36 @@ develapitransitioneffects_HEADERS = $(devel_api_transition_effects_header_files)
 develapitextselectionpopup_HEADERS = $(devel_api_text_selection_popup_header_files)
 
 # public api source
-publicapidir =                  $(topleveldir)/public-api
-publicapicontrolsdir =          $(publicapidir)/controls
-publicapialignmentdir =         $(publicapicontrolsdir)/alignment
-publicapibuttonsdir =           $(publicapicontrolsdir)/buttons
-publicapidefaultcontrolsdir =   $(publicapicontrolsdir)/default-controls
-publicapigaussianblurviewdir =  $(publicapicontrolsdir)/gaussian-blur-view
-publicapiscrollbardir =         $(publicapicontrolsdir)/scroll-bar
-publicapiscrollabledir =        $(publicapicontrolsdir)/scrollable
-publicapiscrollviewdir =        $(publicapicontrolsdir)/scrollable/scroll-view
-publicapiitemviewdir =          $(publicapicontrolsdir)/scrollable/item-view
-publicapitableviewdir =         $(publicapicontrolsdir)/table-view
-publicapitextcontrolsdir =      $(publicapicontrolsdir)/text-controls
-publicapifocusmanagerdir =      $(publicapidir)/focus-manager
-publicapirenderingbackenddir =  $(publicapidir)/text
+publicapidir =                    $(topleveldir)/public-api
+publicapicontrolsdir =            $(publicapidir)/controls
+develapiaccessibilitymanagerdir = $(publicapidir)/accessibility-manager
+publicapialignmentdir =           $(publicapicontrolsdir)/alignment
+publicapibuttonsdir =             $(publicapicontrolsdir)/buttons
+publicapidefaultcontrolsdir =     $(publicapicontrolsdir)/default-controls
+publicapigaussianblurviewdir =    $(publicapicontrolsdir)/gaussian-blur-view
+publicapiscrollbardir =           $(publicapicontrolsdir)/scroll-bar
+publicapiscrollabledir =          $(publicapicontrolsdir)/scrollable
+publicapiscrollviewdir =          $(publicapicontrolsdir)/scrollable/scroll-view
+publicapiitemviewdir =            $(publicapicontrolsdir)/scrollable/item-view
+publicapitableviewdir =           $(publicapicontrolsdir)/table-view
+publicapitextcontrolsdir =        $(publicapicontrolsdir)/text-controls
+publicapifocusmanagerdir =        $(publicapidir)/focus-manager
+publicapirenderingbackenddir =    $(publicapidir)/text
 
 # public api headers
-publicapi_HEADERS =                 $(public_api_header_files)
-publicapicontrols_HEADERS =         $(public_api_controls_header_files)
-publicapialignment_HEADERS =        $(public_api_alignment_header_files)
-publicapibuttons_HEADERS =          $(public_api_buttons_header_files)
-publicapidefaultcontrols_HEADERS =  $(public_api_default_controls_header_files)
-publicapigaussianblurview_HEADERS = $(public_api_gaussian_blur_view_header_files)
-publicapiitemview_HEADERS =         $(public_api_item_view_header_files)
-publicapiscrollbar_HEADERS =        $(public_api_scroll_bar_header_files)
-publicapiscrollable_HEADERS =       $(public_api_scrollable_header_files)
-publicapiscrollview_HEADERS =       $(public_api_scroll_view_header_files)
-publicapitableview_HEADERS =        $(public_api_table_view_header_files)
-publicapitextcontrols_HEADERS =     $(public_api_text_controls_header_files)
-publicapifocusmanager_HEADERS =     $(public_api_focus_manager_header_files)
-publicapirenderingbackend_HEADERS = $(public_api_rendering_backend_header_files)
+publicapi_HEADERS =                    $(public_api_header_files)
+publicapicontrols_HEADERS =            $(public_api_controls_header_files)
+develapiaccessibilitymanager_HEADERS = $(public_api_accessibility_manager_header_files)
+publicapialignment_HEADERS =           $(public_api_alignment_header_files)
+publicapibuttons_HEADERS =             $(public_api_buttons_header_files)
+publicapidefaultcontrols_HEADERS =     $(public_api_default_controls_header_files)
+publicapigaussianblurview_HEADERS =    $(public_api_gaussian_blur_view_header_files)
+publicapiitemview_HEADERS =            $(public_api_item_view_header_files)
+publicapiscrollbar_HEADERS =           $(public_api_scroll_bar_header_files)
+publicapiscrollable_HEADERS =          $(public_api_scrollable_header_files)
+publicapiscrollview_HEADERS =          $(public_api_scroll_view_header_files)
+publicapitableview_HEADERS =           $(public_api_table_view_header_files)
+publicapitextcontrols_HEADERS =        $(public_api_text_controls_header_files)
+publicapifocusmanager_HEADERS =        $(public_api_focus_manager_header_files)
+publicapirenderingbackend_HEADERS =    $(public_api_rendering_backend_header_files)
 
index 9fdece3..74229e8 100644 (file)
@@ -43,7 +43,7 @@
 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-field.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/public-api/dali-toolkit-version.h>
index c450637..da3a099 100644 (file)
@@ -109,11 +109,6 @@ void BubbleEmitter::EmitBubble( Animation& animation, const Vector2& emitPositio
   GetImpl(*this).EmitBubble( animation, emitPosition, direction, displacement );
 }
 
-void BubbleEmitter::StartExplosion( float duration, float multiple )
-{
-  GetImpl(*this).StartExplosion( duration, multiple );
-}
-
 void BubbleEmitter::Restore()
 {
   GetImpl(*this).Restore();
index 0141454..461e564 100644 (file)
@@ -131,9 +131,9 @@ public:
   /**
    * @brief Set the density of the bubble.
    *
-   * Ideally every bubble's moving track is controlled by different uniforms in BubbleEffect shaders.
+   * Ideally every bubble's moving track is controlled by different uniforms in shader.
    * To increase the density, 'density' number of bubbles are sharing one group of uniforms, but with random offsets between these bubbles.
-   * The available density is one to nine. The default density is five.
+   * The available densities are one to nine only. The default value is five.
    * By set the density bigger than one, instead of emit one bubble each time, a 'density' number of bubbles are emitted.
    * @param[in] density The density of the bubble.
    */
@@ -158,14 +158,6 @@ public:
   void EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
 
   /**
-   * @brief Start an animation to enlarge every activated bubble's size and moving speed.
-   *
-   * @param[in] duration The duration of the animation
-   * @param[in] multiple The bubble size and moving speed will be increased gradually to multiple speed during the animation.
-   */
-  void StartExplosion( float duration, float multiple );
-
-  /**
    * @brief Reset all the parameters controlling the bubbles after animation.
    */
   void Restore();
index d669daf..71202e2 100755 (executable)
@@ -22,36 +22,6 @@ devel_api_src_files = \
   $(devel_api_src_dir)/focus-manager/keyinput-focus-manager.cpp \
   $(devel_api_src_dir)/styling/style-manager.cpp \
   $(devel_api_src_dir)/scripting/script.cpp \
-  $(devel_api_src_dir)/shader-effects/bubble-effect/bubble-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/bubble-effect/color-adjuster.cpp \
-  $(devel_api_src_dir)/shader-effects/alpha-discard-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/bendy-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/blind-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/bouncing-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/carousel-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/displacement-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/dissolve-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/dissolve-local-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/distance-field-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/image-region-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/iris-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/mask-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/mirror-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/motion-blur-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/motion-stretch-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/nine-patch-mask-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/overlay-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/page-turn-book-spine-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/page-turn-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/quadratic-bezier.cpp \
-  $(devel_api_src_dir)/shader-effects/ripple-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/ripple2d-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/shear-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/soft-button-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/spot-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/square-dissolve-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/swirl-effect.cpp \
-  $(devel_api_src_dir)/shader-effects/water-effect.cpp \
   $(devel_api_src_dir)/transition-effects/cube-transition-cross-effect.cpp \
   $(devel_api_src_dir)/transition-effects/cube-transition-effect.cpp \
   $(devel_api_src_dir)/transition-effects/cube-transition-fold-effect.cpp \
@@ -62,10 +32,6 @@ devel_api_src_files = \
 devel_api_bloom_view_header_files = \
   $(devel_api_src_dir)/controls/bloom-view/bloom-view.h
 
-devel_api_bubble_effect_header_files =  \
-  $(devel_api_src_dir)/shader-effects/bubble-effect/bubble-effect.h \
-  $(devel_api_src_dir)/shader-effects/bubble-effect/color-adjuster.h
-
 devel_api_bubble_emitter_header_files = \
   $(devel_api_src_dir)/controls/bubble-effect/bubble-emitter.h
 
@@ -123,8 +89,6 @@ devel_api_shader_effects_header_files = \
   $(devel_api_src_dir)/shader-effects/motion-stretch-effect.h \
   $(devel_api_src_dir)/shader-effects/nine-patch-mask-effect.h \
   $(devel_api_src_dir)/shader-effects/overlay-effect.h \
-  $(devel_api_src_dir)/shader-effects/page-turn-book-spine-effect.h \
-  $(devel_api_src_dir)/shader-effects/page-turn-effect.h \
   $(devel_api_src_dir)/shader-effects/quadratic-bezier.h \
   $(devel_api_src_dir)/shader-effects/ripple-effect.h \
   $(devel_api_src_dir)/shader-effects/ripple2d-effect.h \
@@ -132,8 +96,7 @@ devel_api_shader_effects_header_files = \
   $(devel_api_src_dir)/shader-effects/soft-button-effect.h \
   $(devel_api_src_dir)/shader-effects/spot-effect.h \
   $(devel_api_src_dir)/shader-effects/square-dissolve-effect.h \
-  $(devel_api_src_dir)/shader-effects/swirl-effect.h \
-  $(devel_api_src_dir)/shader-effects/water-effect.h
+  $(devel_api_src_dir)/shader-effects/swirl-effect.h
 
 devel_api_super_blur_view_header_files = \
   $(devel_api_src_dir)/controls/super-blur-view/super-blur-view.h
index 428d82f..f3e049b 100644 (file)
@@ -66,15 +66,18 @@ public:
    * Exec buffer contents as a script
    * @param buffer script file contents
    * @param filename a nominal name for the buffer contents.
-   * (NB filename extension may be used to disambiguate script language)
+   * filename extension may be used to disambiguate script language
+   * @return true on success, false on failure
+   *
    */
-  virtual void ExecuteBuffer(const std::string& buffer, const std::string& filename) = 0;
+  virtual bool ExecuteBuffer(const std::string& buffer, const std::string& filename) = 0;
 
   /**
    * Exec file as a script
    * @param filename the filename to read and execute
+   * @return true on success, false on failure
    */
-  virtual void ExecuteFile(const std::string& filename) = 0;
+  virtual bool ExecuteFile(const std::string& filename) = 0;
 
 }; // class ScriptPlugin
 
index fb846f9..7fdf5e4 100644 (file)
@@ -46,9 +46,9 @@ Script::Script(Internal::Script *impl)
 {
 }
 
-void Script::ExecuteFile( const std::string &filename )
+bool Script::ExecuteFile( const std::string &filename )
 {
-  GetImpl(*this).ExecuteFile( filename );
+  return GetImpl(*this).ExecuteFile( filename );
 }
 
 } // namespace Toolkit
index e49a0d7..8eed33b 100644 (file)
@@ -75,8 +75,10 @@ public:
    * Executes the contents of filename in a scripted environment.
    * @pre A Dali Application object exists
    * @param filename A filename of a script file to execute
+   * @return true on success, false on failure
+   *
    */
-  void ExecuteFile( const std::string& filename );
+  bool ExecuteFile( const std::string& filename );
 
 private:
 
diff --git a/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.cpp b/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.cpp
deleted file mode 100644 (file)
index 1c6be01..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-AlphaDiscardEffect::AlphaDiscardEffect()
-{
-}
-
-AlphaDiscardEffect::~AlphaDiscardEffect()
-{
-}
-
-AlphaDiscardEffect AlphaDiscardEffect::New()
-{
-  const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE =
-      "void main()                                                    \n"
-      "{                                                              \n"
-      "  mediump vec4 color = texture2D( sTexture, vTexCoord );       \n"
-      "  if(color.a <= 0.0001)                                        \n"
-      "  {                                                            \n"
-      "    discard;                                                   \n"
-      "  }                                                            \n"
-      "  gl_FragColor = color * uColor;                               \n"
-      "}                                                              \n";
-
-  ShaderEffect shader = ShaderEffect::New( "", // Use default
-                                           ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE );
-  return AlphaDiscardEffect( shader );
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-AlphaDiscardEffect::AlphaDiscardEffect( ShaderEffect handle )
-: ShaderEffect( handle )
-{
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index c96f143..4d1e40a 100644 (file)
@@ -28,41 +28,35 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new Alpha discard effect
+ *
  * Alpha discard effect is used to discard fragments when the alpha colour value is below a threshold.
  * This is useful for stenciling.
  *
  * Usage example:
  *
  *   ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) );
- *   AlphaDiscardEffect alphaDiscardEffect = AlphaDiscardEffect::New();
+ *   ShaderEffect alphaDiscardEffect = CreateAlphaDiscardEffect();
  *   actor.SetShaderEffect( alphaDiscardEffect );
+ *
+ * @return A handle to a newly allocated ShaderEffect.
  */
-class DALI_IMPORT_API AlphaDiscardEffect : public ShaderEffect
+inline ShaderEffect CreateAlphaDiscardEffect()
 {
-public:
-
-  /**
-   * Create an empty AlphaDiscardEffect handle.
-   */
-  AlphaDiscardEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~AlphaDiscardEffect();
-
-  /**
-   * Create a AlphaDiscardEffect.
-   * @return A handle to a newly allocated AlphaDiscardEffect.
-   */
-  static AlphaDiscardEffect New();
-
-private: // Not intended for application developers
+  const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE =
+      "void main()                                                    \n"
+      "{                                                              \n"
+      "  mediump vec4 color = texture2D( sTexture, vTexCoord );       \n"
+      "  if(color.a <= 0.0001)                                        \n"
+      "  {                                                            \n"
+      "    discard;                                                   \n"
+      "  }                                                            \n"
+      "  gl_FragColor = color * uColor;                               \n"
+      "}                                                              \n";
 
-  DALI_INTERNAL AlphaDiscardEffect( ShaderEffect handle );
-};
+  return ShaderEffect::New( "", // Use default
+                            ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE );
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/bendy-effect.cpp b/dali-toolkit/devel-api/shader-effects/bendy-effect.cpp
deleted file mode 100644 (file)
index 29bf267..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/bendy-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string CENTER_PROPERTY_NAME( "uCenter" );
-const std::string DIRECTION_PROPERTY_NAME( "uDirection" );
-const std::string RADIUS_PROPERTY_NAME( "uRadius" );
-
-} // namespace
-
-BendyEffect::BendyEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-BendyEffect::BendyEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-BendyEffect::~BendyEffect()
-{
-}
-
-
-BendyEffect BendyEffect::New()
-{
-  // append the default version
-  std::string vertextShader(
-              "uniform mediump   vec2  uCenter;\n"
-              "uniform mediump   vec2  uDirection;\n"
-              "uniform mediump   float uRadius;\n"
-              "\n"
-              "varying mediump   float vShade;\n"
-              "\n"
-              "void main()\n"
-              "{\n"
-                  " mediump float lighting = 0.25;\n"
-                  " mediump vec4 position = uModelView * vec4(aPosition,1.0);\n"
-                  "\n"
-                  " mediump vec2 d = position.xy - uCenter;\n"
-                  " mediump float dist = max( 0.0, dot(d,uDirection) );\n"
-                  " mediump float radius = max(0.0, uRadius - dist * 0.01);\n"
-                  "\n"
-                  " mediump float cs = cos(dist / radius / 2.0);\n"
-                  " mediump float sn = sin(dist / radius / 2.0);\n"
-                  "\n"
-                  "position.xy = position.xy - uDirection * dist;\n"
-                  "\n"
-                  "position.xy += uDirection * sn * radius;\n"
-                  "position.z += (1.0 - cs) * radius;\n"
-                  "\n"
-                  "gl_Position = uProjection * position;\n"
-                  "\n"
-                  "vShade = 1.0 - abs(sn) * lighting;\n"
-                  "\n"
-                  "vTexCoord = aTexCoord;\n"
-              "}" );
-
-  std::string fragmentShader(
-              "varying mediump float  vShade;\n"
-              "\n"
-              "void main()\n"
-              "{\n"
-              "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(vShade,vShade,vShade,1.0);\n"
-              "}" );
-
-  // Create the implementation, temporarily owned on stack,
-  Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      vertextShader,
-      fragmentShader,
-      GeometryType( GEOMETRY_TYPE_IMAGE ),
-      ShaderEffect::GeometryHints( HINT_GRID | HINT_DEPTH_BUFFER ));
-
-  /* Pass ownership to BendyEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::BendyEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( CENTER_PROPERTY_NAME, Vector2(0.0f, 0.0f), COORDINATE_TYPE_VIEWPORT_POSITION );
-  handle.SetUniform( DIRECTION_PROPERTY_NAME, Vector2(0.0f, 0.0f), COORDINATE_TYPE_VIEWPORT_DIRECTION );
-  handle.SetUniform( RADIUS_PROPERTY_NAME, 0.0f );
-
-  return handle;
-}
-
-void BendyEffect::SetCenter( const Vector2& center )
-{
-  SetUniform( CENTER_PROPERTY_NAME, center, ShaderEffect::COORDINATE_TYPE_VIEWPORT_POSITION );
-}
-
-void BendyEffect::SetDirection( const Vector2& direction )
-{
-  Vector2 temp(direction);
-  temp.Normalize();
-
-  Vector2 newDirection(temp.x, temp.y);
-
-  SetUniform( DIRECTION_PROPERTY_NAME, newDirection, ShaderEffect::COORDINATE_TYPE_VIEWPORT_DIRECTION );
-}
-
-void BendyEffect::SetRadius( float radius )
-{
-  SetUniform( RADIUS_PROPERTY_NAME, radius );
-}
-
-const std::string& BendyEffect::GetCenterPropertyName() const
-{
-  return CENTER_PROPERTY_NAME;
-}
-
-const std::string& BendyEffect::GetDirectionPropertyName() const
-{
-  return DIRECTION_PROPERTY_NAME;
-}
-
-const std::string& BendyEffect::GetRadiusPropertyName() const
-{
-  return RADIUS_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 0fd1374..71ed07c 100644 (file)
@@ -28,73 +28,72 @@ namespace Toolkit
 {
 
 /**
+ * Creates a new Bendy effect
+ *
  * BendyEffect is a custom shader effect to achieve bendy effects in Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uCenter"    - The center point of the bendy effect
+ *  "uDirection" - The direction of the bendy effect
+ *  "uRadius"    - The radius of the bendy effect
+ *
+ * @return A handle to a newly allocated ShaderEffect.
  */
-class DALI_IMPORT_API BendyEffect : public ShaderEffect
+inline ShaderEffect CreateBendyEffect()
 {
-public:
-
-  /**
-   * Create an uninitialized BendyEffect; this can be initialized with BendyEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  BendyEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~BendyEffect();
-
-  /**
-   * Create an initialized BendyEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static BendyEffect New();
-
-  /**
-   * Set the center point of the bendy effect.
-   * @param [in] center The new center point.
-   */
-  void SetCenter(const Vector2& center);
-
-  /**
-   * Set the direction of the bendy effect.
-   * @param [in] direction The new direction.
-   */
-  void SetDirection(const Vector2& direction);
-
-  /**
-   * Set the radius of the bendy effect.
-   * @param [in] radius The new radius.
-   */
-  void SetRadius(float radius);
-
-  /**
-   * Get the name for the center property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCenterPropertyName() const;
-
-  /**
-   * Get the name for the direction property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetDirectionPropertyName() const;
-
-  /**
-   * Get the name for the radius property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetRadiusPropertyName() const;
-
-
-private: // Not intended for application developers
-  DALI_INTERNAL BendyEffect(ShaderEffect handle);
-};
+  // append the default version
+  std::string vertextShader(
+      "uniform mediump   vec2  uCenter;\n"
+      "uniform mediump   vec2  uDirection;\n"
+      "uniform mediump   float uRadius;\n"
+      "\n"
+      "varying mediump   float vShade;\n"
+      "\n"
+      "void main()\n"
+      "{\n"
+      " mediump float lighting = 0.25;\n"
+      " mediump vec4 position = uModelView * vec4(aPosition,1.0);\n"
+      "\n"
+      " mediump vec2 d = position.xy - uCenter;\n"
+      " mediump float dist = max( 0.0, dot(d,uDirection) );\n"
+      " mediump float radius = max(0.0, uRadius - dist * 0.01);\n"
+      "\n"
+      " mediump float cs = cos(dist / radius / 2.0);\n"
+      " mediump float sn = sin(dist / radius / 2.0);\n"
+      "\n"
+      "position.xy = position.xy - uDirection * dist;\n"
+      "\n"
+      "position.xy += uDirection * sn * radius;\n"
+      "position.z += (1.0 - cs) * radius;\n"
+      "\n"
+      "gl_Position = uProjection * position;\n"
+      "\n"
+      "vShade = 1.0 - abs(sn) * lighting;\n"
+      "\n"
+      "vTexCoord = aTexCoord;\n"
+      "}" );
+
+  std::string fragmentShader(
+      "varying mediump float  vShade;\n"
+      "\n"
+      "void main()\n"
+      "{\n"
+      "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(vShade,vShade,vShade,1.0);\n"
+      "}" );
+
+  // Create the implementation, temporarily owned on stack,
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      vertextShader,
+      fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER ));
+
+  shaderEffect.SetUniform( "uCenter", Vector2(0.0f, 0.0f), ShaderEffect::COORDINATE_TYPE_VIEWPORT_POSITION );
+  shaderEffect.SetUniform( "uDirection", Vector2(0.0f, 0.0f), ShaderEffect::COORDINATE_TYPE_VIEWPORT_DIRECTION );
+  shaderEffect.SetUniform( "uRadius", 0.0f );
+
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/blind-effect.cpp b/dali-toolkit/devel-api/shader-effects/blind-effect.cpp
deleted file mode 100644 (file)
index d133283..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/blind-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string STEP_PROPERTY_NAME( "uStep" );
-
-} // namespace
-
-BlindEffect::BlindEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-BlindEffect::BlindEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-BlindEffect::~BlindEffect()
-{
-}
-
-
-BlindEffect BlindEffect::New()
-{
-  std::string fragmentShader(
-    "uniform mediump float uStep;                                                        \n"
-    "void main()                                                                         \n"
-    "{                                                                                   \n"
-    "    mediump vec4 alphaColor;                                                        \n"
-    "    mediump vec4 baseColor;                                                         \n"
-    "    baseColor = texture2D( sTexture, vTexCoord);                                    \n"
-    "    alphaColor = vec4(0.1,0.1,0.1,1.0);                                             \n"
-    "    lowp float index = 0.0;                                                         \n"
-    "    index = floor(vTexCoord.y/0.1);                                                 \n"
-    "    if((vTexCoord.y < (index * 0.1 + uStep * 0.005)) && (vTexCoord.y > index * 0.1))\n"
-    "    {                                                                               \n"
-    "      gl_FragColor = alphaColor;                                                    \n"
-    "    }                                                                               \n"
-    "    else                                                                            \n"
-    "    {                                                                               \n"
-    "      gl_FragColor = baseColor;                                                     \n"
-    "    }                                                                               \n"
-    "    gl_FragColor*=uColor;                                                           \n"
-    "}                                                                                   \n"
-  );
-
-  Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      "",
-      fragmentShader,
-      Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
-      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
-
-  Dali::Toolkit::BlindEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( STEP_PROPERTY_NAME, 0.0f );
-
-  return handle;
-}
-
-void BlindEffect::SetStep(float step)
-{
-  SetUniform( STEP_PROPERTY_NAME, step );
-}
-
-const std::string& BlindEffect::GetStepPropertyName() const
-{
-  return STEP_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 4c7405a..8b68860 100644 (file)
@@ -28,48 +28,47 @@ namespace Toolkit
 {
 
 /**
- * BlindEffect is a custom shader effect to achieve blind effects in Image actors
+ * @brief BlindEffect is a custom shader effect to achieve blind effects in Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uStep" - The step of the blind effect.
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API BlindEffect : public ShaderEffect
-{
-public:
-
-  /**
-   * Create an uninitialized BlindEffect; this can be initialized with BlindEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  BlindEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~BlindEffect();
-
-  /**
-   * Create an initialized ~BlindEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static BlindEffect New();
 
+inline ShaderEffect CreateBlindEffect()
+{
+  std::string fragmentShader(
+      "uniform mediump float uStep;                                                        \n"
+      "void main()                                                                         \n"
+      "{                                                                                   \n"
+      "    mediump vec4 alphaColor;                                                        \n"
+      "    mediump vec4 baseColor;                                                         \n"
+      "    baseColor = texture2D( sTexture, vTexCoord);                                    \n"
+      "    alphaColor = vec4(0.1,0.1,0.1,1.0);                                             \n"
+      "    lowp float index = 0.0;                                                         \n"
+      "    index = floor(vTexCoord.y/0.1);                                                 \n"
+      "    if((vTexCoord.y < (index * 0.1 + uStep * 0.005)) && (vTexCoord.y > index * 0.1))\n"
+      "    {                                                                               \n"
+      "      gl_FragColor = alphaColor;                                                    \n"
+      "    }                                                                               \n"
+      "    else                                                                            \n"
+      "    {                                                                               \n"
+      "      gl_FragColor = baseColor;                                                     \n"
+      "    }                                                                               \n"
+      "    gl_FragColor*=uColor;                                                           \n"
+      "}                                                                                   \n"
+  );
 
-  /**
-   * Set the step of the blind effect.
-   * @param [in] step The step
-   */
-  void SetStep(float step);
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      "",
+      fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
 
-  /**
-   * Get the name for the step property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetStepPropertyName() const;
+  shaderEffect.SetUniform( "uStep", 0.0f );
 
-private: // Not intended for application developers
-  DALI_INTERNAL BlindEffect(ShaderEffect handle);
-};
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/bouncing-effect.cpp b/dali-toolkit/devel-api/shader-effects/bouncing-effect.cpp
deleted file mode 100644 (file)
index 444aae0..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/bouncing-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-#define MAKE_STRING(A)#A
-
-const std::string PROGRESS_RATE_PROPERTY_NAME( "uProgressRate" );
-
-} // namespace
-
-BouncingEffect::BouncingEffect()
-{
-}
-
-BouncingEffect::BouncingEffect( ShaderEffect handle )
-:ShaderEffect( handle )
-{
-}
-
-BouncingEffect::~BouncingEffect()
-{
-}
-
-BouncingEffect BouncingEffect::New( const Vector4& color )
-{
-  std::string fragmentShader = MAKE_STRING(
-      precision mediump float;\n
-      uniform float uProgressRate;\n
-      uniform vec4 uAssignedColor;\n
-      void main()\n
-      {\n
-        float progressRate = abs(uProgressRate)*0.5;\n
-        float amplitude = 0.15 - progressRate*0.15 ;\n
-        float x1 = 7.5 * (vTexCoord.x - progressRate);\n
-        float x2 = 7.5 * (vTexCoord.x - 1.0 + progressRate);\n
-        float height1 = max(0.00001, 0.3 - amplitude * ( exp(x1) + exp(-x1) ) );\n
-        float height2 = max(0.00001, 0.3 - amplitude * ( exp(x2) + exp(-x2) ) );\n
-        float height3 = max(0.00001, 1.0 - 3.0 * amplitude * ( exp(x1*0.5) + exp(-x1*0.5) ) );\n
-        float height4 = max(0.00001, 1.0 - 3.0 * amplitude * ( exp(x2*0.5) + exp(-x2*0.5) ) );\n
-        vec4 fragColor = vec4(0.0);\n
-        float y = vTexCoord.y/(height1+height2);\n
-        float y2 = vTexCoord.y/max(height3,height4);\n
-        float coef = max(height1,height2)*5.0/( 1.0+exp(y*12.0-6.0) );\n
-        float alpha = pow( max(0.0,(1.0-y2))*(1.0-min(abs(x1),abs(x2))/5.0), 2.0);\n
-        if( vTexCoord.y < 0.075 )\n
-        {\n
-          fragColor= mix(uAssignedColor, vec4(1.0), coef);\n
-          fragColor += (vec4(1.0)-fragColor) * alpha;\n
-        }\n
-        else if (y2<1.0)\n
-        {\n
-          fragColor =vec4(1.0,1.0,1.0, alpha + (1.0-alpha)*coef);\n
-          fragColor.rgb -= ( vec3(1.0)-uAssignedColor.rgb )*min(clamp(y*1.2-0.3, 0.0, 0.3),clamp(0.9-y*1.2,0.0,0.3));\n
-        }\n
-        fragColor.a *= 10.0*min(min(vTexCoord.x, 1.0-vTexCoord.x),0.1)*min(1.0, progressRate/0.2);\n
-        gl_FragColor =  fragColor;\n
-      }
-  );
-
-  ShaderEffect shaderEffect;
-  shaderEffect = ShaderEffect::New( "", fragmentShader,
-                                    GeometryType( GEOMETRY_TYPE_IMAGE),
-                                    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
-  BouncingEffect handle( shaderEffect );
-
-  handle.SetUniform( "uAssignedColor", color );
-  handle.SetProgressRate( 0.f );
-
-  return handle;
-}
-
-void BouncingEffect::SetProgressRate( float progress )
-{
-  SetUniform( PROGRESS_RATE_PROPERTY_NAME, progress );
-}
-
-const std::string& BouncingEffect::GetProgressRatePropertyName() const
-{
-  return PROGRESS_RATE_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 655f0c6..fc9d718 100644 (file)
@@ -28,69 +28,79 @@ namespace Toolkit
 {
 
 /**
- * @brief BouncingEffect is a custom overscroll effect with two waves appearing at two sides then moving towards center and overlapping.
+ * @brief Creates a new bouncing effect
+ *
+ * BouncingEffect is a custom overscroll effect with two waves appearing at two sides then moving towards center and overlapping.
  *
  * Usage Example:
  *
  *  // Create the an imageActor, set shader effect, and add it to the stage
  *  ImageActor imageActor = ImageActor::New( BufferImage::New( 1, 1 ) );
  *  imageActor.SetSize(720.f,58.f);
- *  Toolkit::BouncingEffect bouncingEffect = Toolkit::BouncingEffect::New( Vector4(0.f,1.f,1.f,0.5f) );
+ *  Toolkit::ShaderEffect bouncingEffect = CreateBouncingEffect( Vector4(0.f,1.f,1.f,0.5f) );
  *  imageActor.SetShaderEffect( bouncingEffect );
  *  imageActor.SetParentOrigin( ParentOrigin::CENTER );
  *  Stage::GetCurrent().Add( imageActor );
  *
  *   // Start the animation
  *   Animation animation = Animation::New(1.f);
- *   animation.AnimateTo( Property( bouncingEffect, bouncingEffect.GetProgressRatePropertyName() ),
+ *   animation.AnimateTo( Property( bouncingEffect,"uProgressRate" ),
  *                        1.f, AlphaFunction::BOUNCE );
  *   animation.Play();
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uProgressRate" - The progress rate to the effect
+ *
+ * @param[in] color The color used on the bouncing stripe
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API BouncingEffect : public ShaderEffect
-{
-public:
-
-  /**
-   * @brief Creates an empty BouncingEffect handle
-   */
-  BouncingEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~BouncingEffect();
 
-  /**
-   * @brief Create a BouncingEffect object
-   *
-   * @param[in] color The color used on the bouncing stripe
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static BouncingEffect New( const Vector4& color );
-
-  /**
-   * @brief Set the progress rate to the effect.
-   *
-   * The whole progress ( with progress rate from 0.0 to 1.0 ):
-   *      two waves appear at two sides; move towards center and overlap.
-   * @param[in] progressRate The progress rate value.
-   */
-  void SetProgressRate( float progressRate );
-
-  /**
-   * @brief Get the name for the progress rate property.
-   *
-   * @return A std::string containing the property name.
-   */
-  const std::string& GetProgressRatePropertyName() const;
-
-
-private: // Not intended for application developers
-  DALI_INTERNAL BouncingEffect( ShaderEffect handle );
+inline ShaderEffect CreateBouncingEffect(const Vector4& color)
+{
+  std::string fragmentShader = DALI_COMPOSE_SHADER(
+      precision mediump float;\n
+      uniform float uProgressRate;\n
+      uniform vec4 uAssignedColor;\n
+      void main()\n
+      {\n
+        float progressRate = abs(uProgressRate)*0.5;\n
+        float amplitude = 0.15 - progressRate*0.15 ;\n
+        float x1 = 7.5 * (vTexCoord.x - progressRate);\n
+        float x2 = 7.5 * (vTexCoord.x - 1.0 + progressRate);\n
+        float height1 = max(0.00001, 0.3 - amplitude * ( exp(x1) + exp(-x1) ) );\n
+        float height2 = max(0.00001, 0.3 - amplitude * ( exp(x2) + exp(-x2) ) );\n
+        float height3 = max(0.00001, 1.0 - 3.0 * amplitude * ( exp(x1*0.5) + exp(-x1*0.5) ) );\n
+        float height4 = max(0.00001, 1.0 - 3.0 * amplitude * ( exp(x2*0.5) + exp(-x2*0.5) ) );\n
+        vec4 fragColor = vec4(0.0);\n
+        float y = vTexCoord.y/(height1+height2);\n
+        float y2 = vTexCoord.y/max(height3,height4);\n
+        float coef = max(height1,height2)*5.0/( 1.0+exp(y*12.0-6.0) );\n
+        float alpha = pow( max(0.0,(1.0-y2))*(1.0-min(abs(x1),abs(x2))/5.0), 2.0);\n
+        if( vTexCoord.y < 0.075 )\n
+        {\n
+          fragColor= mix(uAssignedColor, vec4(1.0), coef);\n
+          fragColor += (vec4(1.0)-fragColor) * alpha;\n
+        }\n
+        else if (y2<1.0)\n
+        {\n
+          fragColor =vec4(1.0,1.0,1.0, alpha + (1.0-alpha)*coef);\n
+          fragColor.rgb -= ( vec3(1.0)-uAssignedColor.rgb )*min(clamp(y*1.2-0.3, 0.0, 0.3),clamp(0.9-y*1.2,0.0,0.3));\n
+        }\n
+        fragColor.a *= 10.0*min(min(vTexCoord.x, 1.0-vTexCoord.x),0.1)*min(1.0, progressRate/0.2);\n
+        gl_FragColor =  fragColor;\n
+      }
+  );
+
+  ShaderEffect shaderEffect;
+  shaderEffect = ShaderEffect::New( "", fragmentShader,
+                                    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+
+  shaderEffect.SetUniform( "uAssignedColor", color );
+  shaderEffect.SetUniform( "uProgressRate", 0.0f );
+
+  return shaderEffect;
+}
 
-};
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/bubble-effect/bubble-effect.cpp b/dali-toolkit/devel-api/shader-effects/bubble-effect/bubble-effect.cpp
deleted file mode 100644 (file)
index 2a4f043..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 2015 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 "bubble-effect.h"
-
-// EXTERNAL HEADERS
-#include <sstream>
-#include <dali/public-api/common/stage.h>
-#include <dali/public-api/images/image.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string MAGNIFICATIOB_PROPERTY_NAME( "uMagnification" );
-const float EACH_WIDTH_PER_SHAPE(32.0f);
-
-} // namespace
-
-BubbleEffect::BubbleEffect()
-: mNumberOfBubbles(0)
-{
-}
-
-BubbleEffect::BubbleEffect( ShaderEffect handle )
-: ShaderEffect( handle ),
-  mNumberOfBubbles(0)
-{
-}
-
-BubbleEffect::~BubbleEffect()
-{
-}
-
-BubbleEffect BubbleEffect::New( unsigned int numberOfBubble)
-{
-  std::ostringstream vertexShaderStringStream;
-  vertexShaderStringStream << "#define NUMBER_OF_BUBBLE "<< numberOfBubble << "\n";
-  std::string vertexShader(
-    "  precision mediump float;\n"
-    // the gravity applied to the y direction
-    "  uniform float uGravity; \n"
-    // xy: the emit position of the bubble; zw: the destinationof the bubble.
-    // The bubble is moving from (xy) to (zw plus the y drop influenced by gravity).
-    "  uniform vec4 uStartAndEndPos[NUMBER_OF_BUBBLE];\n"
-    // The undergoing percentage of the bubble movement. 0.0: start from emit position, 1.0: reach the destination
-    "  uniform float uPercentage[NUMBER_OF_BUBBLE];\n"
-    "  uniform vec2 uInvertedMovementArea; \n"
-    // The bubble number is restricted by the available uniform num.
-    // To increase the displayed bubble, every uStartAndEndPos and uPercentage uniform is applied to a small bunch of bubbles (9 here)
-    // The offset defines the random offset between bubbles within the bunch.
-    "  uniform vec2 offset[9]; \n"
-    // This uniform is specially for increase part of the bubble size and spread the bubble to the whole screen when unlock to home screen
-    "  uniform float uMagnification; \n"
-    // This uniform is used to change the bubble size during running time
-    "  uniform float uDynamicScale; \n"
-    "  varying float vPercentage;\n"
-    "  varying vec2  vEffectTexCoord;\n"
-    "  void main()\n"
-    "  {\n"
-    "    mediump vec4 position = vec4( aPosition.xy, 0.0, 1.0 );\n"
-    // The Z coordinate is used to record the bubble index within current mesh actor
-    "    int zCoord = int(aPosition.z); \n"
-    // for some i between 0 ~ NUMBER_OF_BUBBLE-1: i,i+NUMBER_OF_BUBBLE, i+NUMBER_OF_BUBBLE*2, ... (up to i+NUMBER_OF_BUBBLE*8) belongs to the same bunch.
-    "    int groupIdx = zCoord / NUMBER_OF_BUBBLE;\n"
-    // The bubbles within the same bunch applies the same uniforms uStartAndEndPos[idx] & uPercentage[idx]
-    "    int idx = zCoord - groupIdx*NUMBER_OF_BUBBLE;\n"
-    // early out if uPercentage is (zero || one) setting position to zero (zero sized triangles)
-    "    if( uPercentage[idx] <= 0.0 || uPercentage[idx] >= 1.0 )\n"
-    "    {\n"
-    "      gl_Position = vec4(0.0);\n"
-    "      return;\n"
-    "    }\n"
-    "    vec4 startAndEnd = uStartAndEndPos[idx]; \n"
-    // The final position is added up different offset for bubbles
-    "    startAndEnd.zw += offset[groupIdx];\n"
-    // Notice: Only animate the uMagnification for unlock (bubble explosion animation)!
-    // In other cases, uMagnification = 1.0!
-    // Increase the Size of part of bubbles and increase the speed of movement for unlock.
-    // Performance acceptable: Branch on a uniform variable.
-    "    if( uMagnification > 1.0)\n"
-    "    {\n"
-    "      if(mod(aPosition.z,24.0) < 1.0 )\n"
-    "      {\n"
-    "        position.xy *= uMagnification;\n"
-    "      }\n"
-    "    }\n"
-    "    float percentage = uPercentage[idx]*min(uMagnification,2.5);\n"
-    "\n"
-    // increase the bubble size from 0% to 100% during the first 1/5 of movement & apply the dynamic scale
-    // the new xy value containes both the new scale and new bubble position
-    "    position.xy *= uDynamicScale*min(percentage*5.0, 1.0);\n"
-    "    position.xy += mix(startAndEnd.xy, startAndEnd.zw, percentage*uMagnification);\n"
-    // The gravity is g*t*t on the y direction
-    "    position.y += uGravity * pow(percentage, 2.0);\n"
-    "    gl_Position = uMvpMatrix * position;\n"
-    "\n"
-    // Add multiple bubble shapes in the effect
-    "    vTexCoord = aTexCoord;\n"
-    "    vPercentage = percentage;\n"
-    // Use the emit position color for the bubble
-    "    vEffectTexCoord = startAndEnd.xy * uInvertedMovementArea;\n"
-    "  }\n" );
-  vertexShaderStringStream << vertexShader;
-
-  std::string fragmentShader(
-    "  precision mediump float;\n"
-    "  varying float vPercentage;\n"
-    "  varying vec2  vEffectTexCoord;\n"
-    "\n"
-    "  void main()\n"
-    "  {\n"
-    // Get the emit pisition color, and Mix with the actor color
-    "    vec4 fragColor = texture2D(sEffect, vEffectTexCoord)*uColor;\n"
-    // Apply the shape defined by the texture contained in the material
-    // And make the opacity being 0.7, and animate from 0.7 to 0 during the last 1/5 of movement
-    "    fragColor.a  *= texture2D(sTexture, vTexCoord).a * ( 3.5 - max( vPercentage*3.5, 2.8 ) );\n"
-    "    gl_FragColor = fragColor;\n"
-    "  }\n");
-
-  ShaderEffect shaderEffect = ShaderEffect::New(
-    vertexShaderStringStream.str(),
-    fragmentShader,
-    GeometryType( GEOMETRY_TYPE_TEXTURED_MESH),
-    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
-
-  BubbleEffect handle( shaderEffect );
-
-  handle.mNumberOfBubbles = numberOfBubble;
-  handle.SetMovementArea( Stage::GetCurrent().GetSize() );
-
-  handle.SetUniform( "uGravity", 50.f );
-  handle.SetUniform( "uMagnification", 1.f );
-  handle.SetUniform( "uDynamicScale", 1.f );
-
-  Vector4 zeroVector;
-  for( unsigned int i=0; i<numberOfBubble; i++ )
-  {
-    handle.SetPercentage( i, 0.f);
-    handle.SetStartAndEndPosition( i, zeroVector );
-  }
-
-  return handle;
-}
-
-void BubbleEffect::SetMovementArea( const Vector2& movementArea )
-{
-  if( movementArea == mMovementArea )
-  {
-    return;
-  }
-
-  mMovementArea = movementArea;
-  SetUniform( "uInvertedMovementArea", Vector2(1.f,1.f) / mMovementArea );
-
-  srand(time(NULL));
-  int offset = mMovementArea.Length() / 10.f;
-  SetUniform("offset[0]", Vector2(0.f,0.f));
-  SetUniform("offset[1]", Vector2(rand()%offset,rand()%offset) );
-  SetUniform("offset[2]", Vector2(rand()%offset,-rand()%offset) );
-  SetUniform("offset[3]", Vector2(-rand()%offset,rand()%offset) );
-  SetUniform("offset[4]", Vector2(-rand()%offset,-rand()%offset) );
-  SetUniform("offset[5]", Vector2(rand()%offset,0.f));
-  SetUniform("offset[6]", Vector2(-rand()%offset,0.f));
-  SetUniform("offset[7]", Vector2(0.f,rand()%offset));
-  SetUniform("offset[8]", Vector2(0.f,-rand()%offset));
-}
-
-void BubbleEffect::SetStartAndEndPosition( unsigned int index, const Vector4& startAndEndPosition )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfBubbles );
-  std::ostringstream oss;
-  oss<< "uStartAndEndPos["<< index << "]";
-  SetUniform( oss.str(), startAndEndPosition );
-}
-
-void BubbleEffect::SetPercentage( unsigned int index, float percentage )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfBubbles );
-  SetUniform( GetPercentagePropertyName(index), percentage );
-}
-
-void BubbleEffect::SetGravity( float gravity )
-{
-  SetUniform( "uGravity", gravity );
-}
-
-void BubbleEffect::SetDynamicScale( float scale )
-{
-  SetUniform( "uDynamicScale", scale );
-}
-
-void BubbleEffect::SetMagnification( float magnification )
-{
-  SetUniform( MAGNIFICATIOB_PROPERTY_NAME, magnification );
-}
-
-std::string BubbleEffect::GetPercentagePropertyName( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfBubbles );
-  std::ostringstream oss;
-  oss<< "uPercentage["<< index << "]";
-  return oss.str();
-}
-
-std::string BubbleEffect::GetMagnificationPropertyName() const
-{
-  return MAGNIFICATIOB_PROPERTY_NAME;
-}
-
-void BubbleEffect::ResetParameters()
-{
-  SetMagnification( 1.f );
-  Vector4 zeroVector;
-  for( unsigned int i=0; i<mNumberOfBubbles; i++ )
-  {
-    SetPercentage( i, 1.f);
-    SetStartAndEndPosition( i, zeroVector );
-  }
-}
-
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/devel-api/shader-effects/bubble-effect/color-adjuster.cpp b/dali-toolkit/devel-api/shader-effects/bubble-effect/color-adjuster.cpp
deleted file mode 100644 (file)
index d0c49d9..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2015 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 "color-adjuster.h"
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-const std::string HSVDELTA_PROPERTY_NAME("uHSVDelta");
-}
-
-ColorAdjuster::ColorAdjuster()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-ColorAdjuster::ColorAdjuster( ShaderEffect handle )
-: ShaderEffect( handle )
-{
-}
-
-ColorAdjuster::~ColorAdjuster()
-{
-}
-
-ColorAdjuster ColorAdjuster::New( const Vector3& hsvDelta, bool ignoreAlpha )
-{
-  std::string fragmentShader(
-  "  precision highp float;\n"
-  "  uniform vec3 uHSVDelta;\n"
-  "  uniform float uIgnoreAlpha;\n"
-  "  float rand(vec2 co) \n"
-  "  {\n"
-  "    return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n"
-  "  }\n"
-  "  vec3 rgb2hsv(vec3 c)\n"
-  "  {\n"
-  "    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n"
-  "    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n"
-  "    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n"
-  "    \n"
-  "    float d = q.x - min(q.w, q.y);\n"
-  "    float e = 1.0e-10;\n"
-  "    return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n"
-  "  }\n"
-  "  vec3 hsv2rgb(vec3 c)\n"
-  "  {\n"
-  "   vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n"
-  "   vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n"
-  "   return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n"
-  "  }\n"
-  "  void main() {\n"
-  "    vec4 color = texture2D(sTexture, vTexCoord); \n"
-  "    vec3 hsvColor = rgb2hsv( color.rgb );\n"
-  // modify the hsv Value
-  "    hsvColor += uHSVDelta * rand(vTexCoord); \n"
-  // if the new vale exceeds one, then decrease it
-  "    hsvColor -= max(hsvColor*2.0 - vec3(2.0), 0.0);\n"
-  // if the new vale drops below zero, then increase it
-  "    hsvColor -= min(hsvColor*2.0, 0.0);\n"
-  "    color.rgb = hsv2rgb( hsvColor ); \n"
-  // uIgnoreAlpha decide the result alpha will be 1.0 or source's alpha
-  "    color.a = clamp(color.a + uIgnoreAlpha, 0.0, 1.0);\n"
-  "    gl_FragColor = color; \n"
-  "  }\n");
-
-  ShaderEffect effect = ShaderEffect::New("", fragmentShader);
-  ColorAdjuster handle( effect );
-  handle.SetUniform( "uHSVDelta", hsvDelta );
-  handle.SetUniform( "uIgnoreAlpha", ignoreAlpha?1.0f:0.0f );
-  return handle;
-}
-
-std::string ColorAdjuster::GetHsvDeltaPropertyName() const
-{
-  return HSVDELTA_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/devel-api/shader-effects/bubble-effect/color-adjuster.h b/dali-toolkit/devel-api/shader-effects/bubble-effect/color-adjuster.h
deleted file mode 100644 (file)
index e35e02e..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef __DALI_TOOLKIT_SHADER_COLOR_ADJUSTER_H__
-#define __DALI_TOOLKIT_SHADER_COLOR_ADJUSTER_H__
-
-/*
- * Copyright (c) 2015 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 <dali/public-api/math/vector3.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-/**
- * ColorAdjuster is a custom shader effect to adjust the image color in HSV space.
- */
-class DALI_IMPORT_API ColorAdjuster : public ShaderEffect
-{
-public:
-
-  /**
-   * Create an empty ColorAdjuster handle.
-   */
-  ColorAdjuster();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~ColorAdjuster();
-
-  /**
-   * Create an initialized ColorAdjuster.
-   * @param[in] hsvDelta The color difference to apply to the HSV channel.
-   * @param[in] ignoreAlpha If true, the result color will be opaque even though source has alpha value
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static ColorAdjuster New( const Vector3& hsvDelta, bool ignoreAlpha = false );
-
-   /**
-   * Get the name of the uHSVDelta uniform so that it can be animated
-   */
-  std::string GetHsvDeltaPropertyName() const;
-
-private: // Not intended for application developers
-
-  DALI_INTERNAL ColorAdjuster( ShaderEffect handle );
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-#endif /* __DALI_TOOLKIT_COLOR_ADJUSTER_EFFECT_H__ */
diff --git a/dali-toolkit/devel-api/shader-effects/carousel-effect.cpp b/dali-toolkit/devel-api/shader-effects/carousel-effect.cpp
deleted file mode 100644 (file)
index 9f6adae..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/carousel-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string RADIUS_PROPERTY_NAME( "uRadius" );
-const std::string ANGLE_PER_UNIT_PROPERTY_NAME( "uAnglePerUnit" );
-const std::string CENTER_PROPERTY_NAME( "uCenter" );
-
-} // namespace
-
-CarouselEffect::CarouselEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-CarouselEffect::CarouselEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-CarouselEffect::~CarouselEffect()
-{
-}
-
-
-CarouselEffect CarouselEffect::New()
-{
-  // append the default version
-  std::string vertexShader(
-              "uniform float uRadius;\n"
-              "uniform mediump vec2 uCenter;\n"
-              "uniform mediump vec2 uAnglePerUnit;\n"
-              "\n"
-              "void main()\n"
-              "{\n"
-              "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
-              "    mediump vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
-              "    mediump float a = length(d);\n"
-              "    mediump float cs = cos(radians(a));\n"
-              "    world.z -= cs * uRadius;\n"
-              "    gl_Position = uProjection * world;\n"
-              "    \n"
-              "    vTexCoord = aTexCoord;\n"
-              "}\n");
-
-  ShaderEffect shaderEffectCustom = ShaderEffect::New(vertexShader,
-          "",
-          GeometryType( GEOMETRY_TYPE_IMAGE ),
-          ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER ));
-
-  // Pass ownership to CarouselEffect through overloaded constructor, So that it now has access to the
-  // Dali::ShaderEffect implementation
-  CarouselEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( RADIUS_PROPERTY_NAME, 0.0f );
-  handle.SetUniform( CENTER_PROPERTY_NAME, Vector2( 0.0f, 0.0f ) );
-  handle.SetUniform( ANGLE_PER_UNIT_PROPERTY_NAME, Vector2( 0.0f, 0.0f ) );
-
-  return handle;
-}
-
-void CarouselEffect::SetRadius( float radius)
-{
-  SetUniform( RADIUS_PROPERTY_NAME, radius );
-}
-
-void CarouselEffect::SetCenter( const Vector2& center )
-{
-  SetUniform( CENTER_PROPERTY_NAME, center );
-}
-
-void CarouselEffect::SetAnglePerUnit( const Vector2& angle )
-{
-  SetUniform( ANGLE_PER_UNIT_PROPERTY_NAME, angle );
-}
-
-const std::string& CarouselEffect::GetRadiusPropertyName() const
-{
-  return RADIUS_PROPERTY_NAME;
-}
-
-const std::string& CarouselEffect::GetCenterPropertyName() const
-{
-  return CENTER_PROPERTY_NAME;
-}
-
-const std::string& CarouselEffect::GetAnglePerUnitPropertyName() const
-{
-  return ANGLE_PER_UNIT_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index f5bc686..dfe7018 100644 (file)
@@ -28,6 +28,8 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new Carousel effect
+ *
  * CarouselEffect is a custom shader effect to achieve Carousel effects in actors
  *
  * A Carousel has a Radius property which can be +ve (appear as if viewing from the outside of
@@ -39,80 +41,50 @@ namespace Toolkit
  *
  * Finally, the carousel's center position can be specified as a Screen coordinate (top-left being
  * the origin).
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uRadius"       - The radius of the Carousel effect. A positive Radius will bend toward the camera,
+ *                    while a negative Radius will bend away from the camera.
+ *  "uAnglePerUnit" - The angle deviation of Carousel in degrees per geometric unit for each axis
+                      For example if you wish for the horizontal angle deviation to vary from +/- 10
+                      degrees, then a Value of 20.0f / stageWidth for the X component should be specified.
+ *  "uCenter"       - The center point of the carousel (in screen coordinates) this is where the peek of the carousel should appear.
+ *                    Defaults value is top-left corner (0.0f, 0.0f).
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API CarouselEffect : public ShaderEffect
+inline ShaderEffect CreateCarouselEffect()
 {
-public:
-
-  /**
-   * Create an uninitialized CarouselEffect; this can be initialized with CarouselEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  CarouselEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~CarouselEffect();
-
-  /**
-   * Create an initialized CarouselEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static CarouselEffect New();
-
-  /**
-   * Set the radius of the Carousel effect.
-   * A positive Radius will bend toward the camera,
-   * while a negative Radius will bend away from the camera.
-   * @param[in] radius The new radius.
-   */
-  void SetRadius( float radius);
-
-  /**
-   * Sets the center point of the carousel (in screen coordinates)
-   * this is where the peek of the carousel should appear.
-   * this defaults to top-left corner (0.0f, 0.0f).
-   *
-   * @param[in] center The center point.
-   */
-  void SetCenter( const Vector2& center );
-
-  /**
-   * Set the angle deviation of Carousel in degrees per
-   * geometric unit for each axis. For example if you
-   * wish for the horizontal angle deviation to vary from +/- 10
-   * degrees, then a Value of 20.0f / stageWidth for the X
-   * component should be specified.
-   *
-   * @param[in] angle the Angle Spread in X and Y axes.
-   */
-  void SetAnglePerUnit( const Vector2& angle );
-
-  /**
-   * Get the name for the radius property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetRadiusPropertyName() const;
-
-  /**
-   * Get the name for the center property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCenterPropertyName() const;
-
-  /**
-   * Get the name for the angle spread property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAnglePerUnitPropertyName() const;
-
-
-private: // Not intended for application developers
-  DALI_INTERNAL CarouselEffect(ShaderEffect handle);
-};
+  // append the default version
+    std::string vertexShader(
+                "uniform float uRadius;\n"
+                "uniform mediump vec2 uCenter;\n"
+                "uniform mediump vec2 uAnglePerUnit;\n"
+                "\n"
+                "void main()\n"
+                "{\n"
+                "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+                "    mediump vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
+                "    mediump float a = length(d);\n"
+                "    mediump float cs = cos(radians(a));\n"
+                "    world.z -= cs * uRadius;\n"
+                "    gl_Position = uProjection * world;\n"
+                "    \n"
+                "    vTexCoord = aTexCoord;\n"
+                "}\n");
+
+    ShaderEffect shaderEffect = ShaderEffect::New(
+        vertexShader,
+        "",
+        ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER ));
+
+
+    shaderEffect.SetUniform( "uRadius", 0.0f );
+    shaderEffect.SetUniform( "uCenter", Vector2( 0.0f, 0.0f ) );
+    shaderEffect.SetUniform( "uAnglePerUnit", Vector2( 0.0f, 0.0f ) );
+
+    return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/displacement-effect.cpp b/dali-toolkit/devel-api/shader-effects/displacement-effect.cpp
deleted file mode 100644 (file)
index 8dca1b4..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/displacement-effect.h>
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string DISPLACEMENT_EFFECT_LIGHT_DIRECTION_PROPERTY_NAME( "uLightDirection" );
-const std::string DISPLACEMENT_EFFECT_AMBIENT_LIGHT_COLOR_PROPERTY_NAME( "uAmbientLightColor" );
-const std::string DISPLACEMENT_EFFECT_DIFFUSE_LIGHT_COLOR_PROPERTY_NAME( "uDiffuseLightColor" );
-const std::string DISPLACEMENT_EFFECT_LIGHT_MULTIPLIER_PROPERTY_NAME( "uLightMultiplier" );
-const std::string DISPLACEMENT_EFFECT_STATE_PROPERTY_NAME( "uState" );
-const std::string DISPLACEMENT_EFFECT_HEIGHT_SCALE_PROPERTY_NAME( "uHightScale" );
-const std::string DISPLACEMENT_EFFECT_FIXED_NORMAL_PROPERTY_NAME( "uFixedNormal" );
-
-// factors that scale the look, defaults
-const Vector3 DISPLACEMENT_EFFECT_LIGHT_DIRECTION_DEFAULT = Vector3(0.0, 0.7070168f, 0.7071068f);
-const Vector3 DISPLACEMENT_EFFECT_AMBIENT_LIGHT_COLOR_DEFAULT = Vector3(0.15f, 0.15f, 0.15f);
-const Vector3 DISPLACEMENT_EFFECT_DIFFUSE_LIGHT_COLOR_DEFAULT = Vector3(1.0f, 1.0f, 1.0f);
-const float   DISPLACEMENT_EFFECT_LIGHT_MULTIPLIER_DEFAULT = 1.0f;
-const float   DISPLACEMENT_EFFECT_STATE_DEFAULT = 0.0f;
-const float   DISPLACEMENT_EFFECT_HEIGHT_SCALE_DEFAULT = 0.1f;
-const Vector3 DISPLACEMENT_EFFECT_FIXED_NORMAL_DEFAULT = Vector3(0.0f, 0.0f, 1.0f);
-
-} // namespace
-
-
-////////////////////////////////////////////////////
-//
-// Soft button shader / actor tweaking parameters
-//
-
-
-DisplacementEffect::DisplacementEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-DisplacementEffect::DisplacementEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-DisplacementEffect::~DisplacementEffect()
-{
-}
-
-DisplacementEffect DisplacementEffect::New(Type type)
-{
-
-  std::string fragmentSourceFixed;
-  fragmentSourceFixed =  "precision mediump float;\n"
-    "uniform vec3 uLightDirection;\n"
-    "uniform vec3 uAmbientLightColor;\n"
-    "uniform vec3 uDiffuseLightColor;\n"
-    "uniform float uLightMultiplier;\n"
-    "uniform float uState;\n"
-    "uniform float uHightScale;\n"
-    "uniform vec3 uFixedNormal;\n"
-
-    "void main()\n"
-    "{\n"
-    "  vec4 col = texture2D(sTexture, vTexCoord);\n"
-    // calc lighting
-    "  float intensity = dot(uLightDirection, uFixedNormal);"
-    "  vec3 lighting = (intensity * uDiffuseLightColor) + uAmbientLightColor;\n"
-    "  lighting *= uLightMultiplier;\n"
-    // output col = image * light
-    "  gl_FragColor = vec4(col.rgb * lighting * uColor.rgb, col.a * uColor.a);\n"
-    "}\n";
-
-
-
-  std::string fragmentSourceDisplaced(
-      "precision mediump float;\n"
-      "uniform vec3 uLightDirection;\n"
-      "uniform vec3 uAmbientLightColor;\n"
-      "uniform vec3 uDiffuseLightColor;\n"
-      "uniform float uLightMultiplier;\n"
-      "uniform float uState;\n"
-      "uniform float uHightScale;\n"
-      "void main()\n"
-      "{\n"
-      "  highp vec4 displacementMap1 = texture2D(sEffect, vec2(vTexCoord.s, vTexCoord.t/2.0));\n"
-      "  highp vec4 displacementMap2 = texture2D(sEffect, vec2(vTexCoord.s, 0.5+vTexCoord.t/2.0));\n"
-      "  highp vec4 displacementMap = mix(displacementMap1, displacementMap2, uState);\n"
-
-      "  vec3 normalAdjusted = normalize(displacementMap.rgb*2.0-1.0);\n"
-      "  float height = uHightScale * (displacementMap.a*2.0 - 1.0);\n"
-      "  vec2 displacement = vec2(0.0);\n"
-      "  displacement += (vec2(0.5)-vTexCoord.st)*height;\n"
-      "  vec2 newCoord = vTexCoord.st + displacement.xy;\n"
-
-      "  vec4 col = texture2D(sTexture, newCoord);\n"
-      // Y-Axis for the normal map is taken as in Y-Down format, So inverting it for GL
-      "  float intensity = dot(uLightDirection, vec3(1.0,-1.0, 1.0) * normalAdjusted);"
-      "  vec3 lighting = (intensity * uDiffuseLightColor) + uAmbientLightColor;\n"
-      "  lighting *= uLightMultiplier;\n"
-      "  vec3 color = col.rgb * lighting * uColor.rgb;\n"
-      "  gl_FragColor = vec4(color, col.a * uColor.a);\n"
-      "}\n");
-
-  //////////////////////////////////////
-  // Create shader effect
-  //
-  //
-
-  ShaderEffect shader;
-  switch(type)
-  {
-    case DISPLACED:
-      shader = ShaderEffect::New( "", fragmentSourceDisplaced);
-      break;
-
-    case FIXED:
-    default:
-      shader = ShaderEffect::New( "", fragmentSourceFixed);
-      break;
-  }
-  DisplacementEffect handle( shader );
-
-
-  //////////////////////////////////////
-  // Register uniform properties
-  //
-  //
-  // factors that scale the look, defaults
-
-  handle.SetLightDirection(DISPLACEMENT_EFFECT_LIGHT_DIRECTION_DEFAULT);
-  handle.SetAmbientLightColorProperty(DISPLACEMENT_EFFECT_AMBIENT_LIGHT_COLOR_DEFAULT);
-  handle.SetDiffuseLightColorProperty(DISPLACEMENT_EFFECT_DIFFUSE_LIGHT_COLOR_DEFAULT);
-  handle.SetLightingMultiplierProperty(DISPLACEMENT_EFFECT_LIGHT_MULTIPLIER_DEFAULT);
-  handle.SetStateProperty(DISPLACEMENT_EFFECT_STATE_DEFAULT);
-  handle.SetHeightScaleProperty(DISPLACEMENT_EFFECT_HEIGHT_SCALE_DEFAULT);
-
-  if(type == FIXED)
-  {
-    handle.SetFixedNormalProperty(DISPLACEMENT_EFFECT_FIXED_NORMAL_DEFAULT);
-  }
-
-
-  return handle;
-}
-
-const std::string& DisplacementEffect::GetLightDirectionPropertyName() const
-{
-  return DISPLACEMENT_EFFECT_LIGHT_DIRECTION_PROPERTY_NAME;
-}
-
-const std::string& DisplacementEffect::GetAmbientLightColorPropertyName() const
-{
-  return DISPLACEMENT_EFFECT_AMBIENT_LIGHT_COLOR_PROPERTY_NAME;
-}
-
-const std::string& DisplacementEffect::GetDiffuseLightColorPropertyName() const
-{
-  return DISPLACEMENT_EFFECT_DIFFUSE_LIGHT_COLOR_PROPERTY_NAME;
-}
-
-const std::string& DisplacementEffect::GetLightingMultiplierPropertyName() const
-{
-  return DISPLACEMENT_EFFECT_LIGHT_MULTIPLIER_PROPERTY_NAME;
-}
-
-const std::string& DisplacementEffect::GetStatePropertyName() const
-{
-  return DISPLACEMENT_EFFECT_STATE_PROPERTY_NAME;
-}
-
-const std::string& DisplacementEffect::GetHeightScalePropertyName() const
-{
-  return DISPLACEMENT_EFFECT_HEIGHT_SCALE_PROPERTY_NAME;
-}
-
-const std::string& DisplacementEffect::GetFixedNormalPropertyName() const
-{
-  return DISPLACEMENT_EFFECT_FIXED_NORMAL_PROPERTY_NAME;
-}
-
-void DisplacementEffect::SetLightDirection(const Vector3 lightDirection)
-{
-  SetUniform( DISPLACEMENT_EFFECT_LIGHT_DIRECTION_PROPERTY_NAME, lightDirection);
-}
-
-void DisplacementEffect::SetAmbientLightColorProperty(const Vector3 ambientLight)
-{
-  SetUniform( DISPLACEMENT_EFFECT_AMBIENT_LIGHT_COLOR_PROPERTY_NAME, ambientLight);
-}
-
-void DisplacementEffect::SetDiffuseLightColorProperty(const Vector3 diffuseLight)
-{
-  SetUniform( DISPLACEMENT_EFFECT_DIFFUSE_LIGHT_COLOR_PROPERTY_NAME, diffuseLight);
-}
-
-void DisplacementEffect::SetLightingMultiplierProperty(const float lightMultiplier)
-{
-  SetUniform( DISPLACEMENT_EFFECT_LIGHT_MULTIPLIER_PROPERTY_NAME, lightMultiplier);
-}
-
-void DisplacementEffect::SetStateProperty(const float state)
-{
-  SetUniform( DISPLACEMENT_EFFECT_STATE_PROPERTY_NAME, state);
-}
-
-void DisplacementEffect::SetHeightScaleProperty(const float heightScale)
-{
-  SetUniform( DISPLACEMENT_EFFECT_HEIGHT_SCALE_PROPERTY_NAME, heightScale);
-}
-
-void DisplacementEffect::SetFixedNormalProperty(const Vector3 fixedNormal)
-{
-  Vector3 newFixedNormal(fixedNormal);
-  newFixedNormal.Normalize();
-
-  SetUniform( DISPLACEMENT_EFFECT_FIXED_NORMAL_PROPERTY_NAME, newFixedNormal);
-}
-
-}
-
-}
index aabb087..f50a177 100644 (file)
@@ -28,8 +28,9 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new displacement effect
  *
- * Class for two state displacement effect shader that works on a per object basis. By passing a height-normal map as an effect image, the user can create
+ * Two state displacement effect shader that works on a per object basis. By passing a height-normal map as an effect image, the user can create
  * various styles of buttons on an image actor. The shader requires two height-normal maps in one image, one for each state.
  *
  *    The normals and height information for the two states of the button should be strictly specified in this format:
@@ -55,7 +56,7 @@ namespace Toolkit
  * Usage example:-
  *
  * // Create shader used for doing soft button\n
- * DisplacementEffect buttonEffect = DisplacementEffect::New();
+ * ShaderEffect buttonEffect = CreateDisplacementEffect();
  * buttonEffect.SetEffectImage(Image::New( FANCY_BUTTON_HEIGHT_MAP_IMAGE_PATH ););
  *
  * // set shader to the soft button\n
@@ -66,155 +67,127 @@ namespace Toolkit
  *
  *
  * Animation animation = Animation::New( ... );\n
- * animation.AnimateTo( Property(buttonEffect, buttonEffect.GetStatePropertyName()), 1.0f, AlphaFunction::BOUNCE, ... );\n
+ * animation.AnimateTo( Property(buttonEffect, "uState"), 1.0f, AlphaFunction::BOUNCE, ... );\n
  * animation.Play();\n
  *
+ * Animatable/Constrainable uniforms:
+ *   "uLightDirection"      - The light direction is used in the lighting calculation. The angle of incidence directly affects the amount of light reflected.
+ *                            Default (0.0f, 0.7070168f, 0.7071068f), i.e angled at the surface from in front and above.
+ *   "uAmbientLightColor"   - The ambient light is used in the lighting calculation. Care must be taken to not saturate the image by setting this value too high,
+ *                            or the indentation will not look correct. Default 0.15.
+ *   "uDiffuseLightColor"   - The diffuse light is used in the lighting calculation. Default is (1.0f, 1.0f, 1.0f).
+ *   "uLightMultiplier"     - The ambient and diffuse lighting is multiplied by this factor. Since a diffuse light at an angle will cause the whole image to darken,
+ *                            this property can be used to scale the image back up closer to the pixel values of the original diffuse texture. Care must be taken
+ *                            to not saturate the image,or the indentation will not look correct. Default 1.0
+ *   "uState"               - The shader can have a maximum of two end states 0 or 1, Animate between these two values to do the transitions
+ *                            between states. Default 0.0
+ *   "uHightScale"          - The height displacement is multiplied by this factor. Tweak this to get the required level of depth. Default 0.1
+ *   "uFixedNormal"         - The Fixed normal will be used for the light calculation. Tweak this to get the required level of light.
+ *                            Only applicable for the FIXED type shader and not for DISPLACED type
+ *
+ * @param type The type of the effect, can be either DISPLACED, or FIXED.
+ * @return A handle to a newly allocated ShaderEffect
+ *
  */
-class DALI_IMPORT_API DisplacementEffect : public ShaderEffect
-{
 
-public:
+typedef enum
+{
+  DISPLACEMENT_EFFECT_DISPLACED = 0,    /// Image gets displaced
+  DISPLACEMENT_EFFECT_FIXED             /// Image does not displace. Useful for matching lighting between areas that do not displace and those that do, e.g for backgrounds which are visible between buttons.
+}DisplacementEffectType;
 
-  typedef enum
+inline ShaderEffect CreateDisplacementEffect(DisplacementEffectType type)
+{
+  std::string fragmentSourceFixed;
+  fragmentSourceFixed =  "precision mediump float;\n"
+      "uniform vec3 uLightDirection;\n"
+      "uniform vec3 uAmbientLightColor;\n"
+      "uniform vec3 uDiffuseLightColor;\n"
+      "uniform float uLightMultiplier;\n"
+      "uniform float uState;\n"
+      "uniform float uHightScale;\n"
+      "uniform vec3 uFixedNormal;\n"
+
+      "void main()\n"
+      "{\n"
+      "  vec4 col = texture2D(sTexture, vTexCoord);\n"
+      // calc lighting
+      "  float intensity = dot(uLightDirection, uFixedNormal);"
+      "  vec3 lighting = (intensity * uDiffuseLightColor) + uAmbientLightColor;\n"
+      "  lighting *= uLightMultiplier;\n"
+      // output col = image * light
+      "  gl_FragColor = vec4(col.rgb * lighting * uColor.rgb, col.a * uColor.a);\n"
+      "}\n";
+
+
+
+  std::string fragmentSourceDisplaced(
+      "precision mediump float;\n"
+      "uniform vec3 uLightDirection;\n"
+      "uniform vec3 uAmbientLightColor;\n"
+      "uniform vec3 uDiffuseLightColor;\n"
+      "uniform float uLightMultiplier;\n"
+      "uniform float uState;\n"
+      "uniform float uHightScale;\n"
+      "void main()\n"
+      "{\n"
+      "  highp vec4 displacementMap1 = texture2D(sEffect, vec2(vTexCoord.s, vTexCoord.t/2.0));\n"
+      "  highp vec4 displacementMap2 = texture2D(sEffect, vec2(vTexCoord.s, 0.5+vTexCoord.t/2.0));\n"
+      "  highp vec4 displacementMap = mix(displacementMap1, displacementMap2, uState);\n"
+
+      "  vec3 normalAdjusted = normalize(displacementMap.rgb*2.0-1.0);\n"
+      "  float height = uHightScale * (displacementMap.a*2.0 - 1.0);\n"
+      "  vec2 displacement = vec2(0.0);\n"
+      "  displacement += (vec2(0.5)-vTexCoord.st)*height;\n"
+      "  vec2 newCoord = vTexCoord.st + displacement.xy;\n"
+
+      "  vec4 col = texture2D(sTexture, newCoord);\n"
+      // Y-Axis for the normal map is taken as in Y-Down format, So inverting it for GL
+      "  float intensity = dot(uLightDirection, vec3(1.0,-1.0, 1.0) * normalAdjusted);"
+      "  vec3 lighting = (intensity * uDiffuseLightColor) + uAmbientLightColor;\n"
+      "  lighting *= uLightMultiplier;\n"
+      "  vec3 color = col.rgb * lighting * uColor.rgb;\n"
+      "  gl_FragColor = vec4(color, col.a * uColor.a);\n"
+      "}\n");
+
+  //////////////////////////////////////
+  // Create shader effect
+  //
+  //
+
+  ShaderEffect shaderEffect;
+  switch(type)
   {
-    DISPLACED = 0,    /// Image gets displaced
-    FIXED             /// Image does not displace. Useful for matching lighting between areas that do not displace and those that do, e.g for backgrounds which are visible between buttons.
-  }Type;
-
-  /**
-   * Create an uninitialized DisplacementEffect; this can be initialized with DisplacementEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  DisplacementEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~DisplacementEffect();
-
-  /**
-   * Create an initialized DisplacementEffect
-   * @param type The type of the effect, can be either DISPLACED, or FIXED.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static DisplacementEffect New(Type type);
-
-  /**
-   * Get the name for the light direction property (Vector3)
-   * The light direction is used in the lighting calculation. The angle of incidence directly affects the amount of light reflected.
-   * Default (0.0f, 0.7070168f, 0.7071068f), i.e angled at the surface from in front and above.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetLightDirectionPropertyName() const;
-
-  /**
-   * Get the name for the ambient lighting color property (Vector3)
-   * The ambient light is used in the lighting calculation. Care must be taken to not saturate the image by setting this value too high,
-   * or the indentation will not look correct. Default 0.15.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAmbientLightColorPropertyName() const;
-
-  /**
-   * Get the name for the diffuse light color property (Vector3).
-   * The diffuse light is used in the lighting calculation. Default is (1.0f, 1.0f, 1.0f).
-   * @return A std::string containing the property name
-   */
-  const std::string& GetDiffuseLightColorPropertyName() const;
-
-  /**
-   * Get the name for the lighting multiplier property (float).
-   * The ambient and diffuse lighting is multiplied by this factor. Since a diffuse light at an angle will cause the whole image to darken,
-   * this property can be used to scale the image back up closer to the pixel values of the original diffuse texture. Care must be taken to not saturate the image,
-   * or the indentation will not look correct. Default 1.0
-   * @return A std::string containing the property name
-   */
-  const std::string& GetLightingMultiplierPropertyName() const;
-
-  /**
-   * Get the name for the state property (float).
-   * The shader can have a maximum of two end states 0 or 1, Animate between these two values to do the transitions between states.
-   * Default 0.0
-   * @return A std::string containing the property name.
-   */
-  const std::string& GetStatePropertyName() const;
-
-  /**
-   * Get the name for the height scale property (float).
-   * The height displacement is multiplied by this factor. Tweak this to get the required level of depth.
-   * Default 0.1
-   * @return A std::string containing the property name.
-   */
-  const std::string& GetHeightScalePropertyName() const;
-
-  /**
-   * Get the name for the fixed normal property (Vector3).
-   * Only applicable for the FIXED type shader and not for DISPLACEMENT type.
-   * The Fixed normal will be used for the light calculation. Tweak this to get the required level of light.
-   * Default (0.0f, 0.0f, 1.0f)
-   * @return A std::string containing the property name.
-   */
-  const std::string& GetFixedNormalPropertyName() const;
-
-  /**
-   * Set the light direction property
-   * The light direction is used in the lighting calculation. The angle of incidence directly affects the amount of light reflected.
-   * Default (0.0f, 0.7070168f, 0.7071068f), i.e angled at the surface from in front and above.
-   * @param [in] lightDirection The new light direction.
-   */
-  void SetLightDirection(Vector3 lightDirection);
-
-  /**
-   * Set the ambient light color property
-   * The ambient light is used in the lighting calculation. Care must be taken to not saturate the image by setting this value too high,
-   * or the indentation will not look correct. Default (0.15f, 0.15f, 0.15f).
-   * @param [in] ambientLight The new ambient light value.
-   */
-  void SetAmbientLightColorProperty(Vector3 ambientLight);
-
-  /**
-   * Set the diffuse light color property.
-   * The diffuse light is used in the lighting calculation. Default is (1.0f, 1.0f, 1.0f), i.e. a white light so the natural image color is shown.
-   * @param [in] diffuseLight The new diffuse light value.
-   */
-  void SetDiffuseLightColorProperty(Vector3 diffuseLight);
-
-  /**
-   * Get the name for the lighting multiplier property.
-   * The ambient and diffuse lighting is multiplied by this factor. Since a diffuse light at an angle will cause the whole image to darken,
-   * this property can be used to scale the image back up closer to the pixel values of the original diffuse texture. Care must be taken to not saturate the image,
-   * or the indentation will not look correct. Default 1.0
-   * @param [in] lightMultiplier The new light multiplier value.
-   */
-  void SetLightingMultiplierProperty(float lightMultiplier);
-
-  /**
-   * Get the name for the state property.
-   * The shader can only be in or in between two states 0 or 1, Animate between these two values to do the transitions between states.
-   * @param [in] state The new state value.
-   */
-  void SetStateProperty(float state);
-
-  /**
-   * Set the name for the height scale property.
-   * The height displacement is multiplied by this factor. Tweak this to get the required level of depth. Default 0.1
-   * @param [in] heightScale The new height scale.
-   */
-  void SetHeightScaleProperty(float heightScale);
-
-  /**
-   * Set the name for fixed normal property, Only applicable for the FIXED type shader and not for DISPLACEMENT type.
-   * The Fixed normal will be used for the light calculation. Tweak this to get the required level of light.
-   * @param [in] fixedNormal The new normal for the fixed type shader effect.
-   */
-  void SetFixedNormalProperty(Vector3 fixedNormal);
-
-private:
-  // Not intended for application developers
-  DALI_INTERNAL DisplacementEffect(ShaderEffect handle);
-};
+    case DISPLACEMENT_EFFECT_DISPLACED:
+      shaderEffect = ShaderEffect::New( "", fragmentSourceDisplaced);
+      break;
+
+    case DISPLACEMENT_EFFECT_FIXED:
+    default:
+      shaderEffect = ShaderEffect::New( "", fragmentSourceFixed);
+      break;
+  }
+
+
+  //////////////////////////////////////
+  // Register uniform properties
+  //
+  //
+  // factors that scale the look, defaults
+  shaderEffect.SetUniform("uLightDirection",Vector3(0.0, 0.7070168f, 0.7071068f));
+  shaderEffect.SetUniform("uAmbientLightColor",Vector3(0.15f, 0.15f, 0.15f));
+  shaderEffect.SetUniform("uDiffuseLightColor",Vector3(1.0f, 1.0f, 1.0f));
+  shaderEffect.SetUniform("uLightMultiplier",1.0f);
+  shaderEffect.SetUniform("uState",0.0f);
+  shaderEffect.SetUniform("uHightScale",0.1f);
+
+  if(type == DISPLACEMENT_EFFECT_FIXED)
+  {
+    shaderEffect.SetUniform("uFixedNormal",Vector3(0.0f, 0.0f, 1.0f) );
+  }
+
+  return shaderEffect;
+}
 
 }
 
diff --git a/dali-toolkit/devel-api/shader-effects/dissolve-effect.cpp b/dali-toolkit/devel-api/shader-effects/dissolve-effect.cpp
deleted file mode 100644 (file)
index 6cabd7d..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/dissolve-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string DISTORTION_PROPERTY_NAME( "uPercentage" );
-
-} // namespace
-
-DissolveEffect::DissolveEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-DissolveEffect::DissolveEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-DissolveEffect::~DissolveEffect()
-{
-}
-
-
-DissolveEffect DissolveEffect::New( bool useHighPrecision )
-{
-  std::string prefixHighPrecision( "precision highp float;\n");
-  std::string prefixMediumPrecision( "precision mediump float;\n" );
-  std::string vertexShader(
-    "uniform float uPercentage;\n"
-    "uniform vec3 uSaddleParam;\n"
-    "uniform vec2 uTranslation;\n"
-    "uniform vec2 uRotation; \n"
-    "uniform float uToNext;\n"
-    "varying float vPercentage;\n"
-    "void main()\n"
-    "{\n"
-      "gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
-      "vTexCoord = aTexCoord;\n"
-      //Calculate the distortion value given the dissolve central line
-      "vec2 texCoor = vec2( (aTexCoord.s - sTextureRect.s ) / (sTextureRect.p - sTextureRect.s), (aTexCoord.t- sTextureRect.t)/(sTextureRect.q - sTextureRect.t) ); \n"
-      "vec2 value = texCoor + uTranslation; \n"
-      "mat2 rotateMatrix = mat2( uRotation.s, uRotation.t, -uRotation.t, uRotation.s ); \n"
-      "value = rotateMatrix * value; \n"
-      "if(uToNext == 1.0)  \n"
-      "  value.s = uSaddleParam[2] + value.s; \n"
-      "float delay = value.t*value.t / uSaddleParam[0] - value.s*value.s/uSaddleParam[1];\n"
-      "vPercentage = clamp( uPercentage*2.0 - 0.5*sin(delay*1.571) - 0.5, 0.0, 1.0 ); \n"
-    "}\n");
-  std::string fragmentShader(
-    "varying float vPercentage;\n"
-    "float rand(vec2 co) \n"
-    "{\n"
-    "  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n"
-    "}\n"
-    "void main()\n"
-    "{\n"
-      //Calculate the randomness
-      "float offsetS = rand( vTexCoord * vPercentage ) * (sTextureRect.p - sTextureRect.s) - vTexCoord.s  + sTextureRect.s; \n"
-      "float offsetT = rand( vec2(vTexCoord.t*vPercentage, vTexCoord.s * vPercentage) ) * (sTextureRect.q - sTextureRect.t) - vTexCoord.t + sTextureRect.t; \n"
-      "vec2 lookupCoord = vTexCoord + vec2(offsetS, offsetT) * vPercentage; \n"
-      "gl_FragColor = texture2D( sTexture, lookupCoord ) * uColor; \n"
-      "gl_FragColor.a *= 1.0 - vPercentage; \n"
-    "}" );
-
-  // Create the implementation, temporarily owned on stack,
-  Dali::ShaderEffect shaderEffectCustom;
-  if( useHighPrecision )
-  {
-    shaderEffectCustom =  Dali::ShaderEffect::New( prefixHighPrecision+vertexShader, prefixHighPrecision + fragmentShader,
-                                               GeometryType( GEOMETRY_TYPE_IMAGE),
-                                               ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
-  }
-  else
-  {
-    shaderEffectCustom =  Dali::ShaderEffect::New( prefixMediumPrecision+vertexShader, prefixMediumPrecision + fragmentShader,
-                                               GeometryType( GEOMETRY_TYPE_IMAGE),
-                                               ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
-  }
-
-  /* Pass ownership to DissolveEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::DissolveEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( DISTORTION_PROPERTY_NAME, 0.0f );
-  handle.SetProperty( ShaderEffect::Property::GRID_DENSITY, Dali::Property::Value(50.0f) );
-
-  handle.SetCentralLine( Vector2(1.0f,0.5f), Vector2(-1.0f, 0.0f) );
-
-  return handle;
-}
-
-void DissolveEffect::SetCentralLine( const Vector2& position, const Vector2& displacement )
-{
-  // the line passes through 'position' and has the direction of 'displacement'
-  float coefA, coefB, coefC; //line equation: Ax+By+C=0;
-  coefA = displacement.y;
-  coefB = -displacement.x;
-  coefC = -displacement.y*position.x + displacement.x*position.y;
-
-  float inversedAABB = 1.f / (coefA*coefA+coefB*coefB);
-  float inversedSqrtAABB = sqrtf(inversedAABB);
-  float saddleA;
-
-  //saddle surface(Hyperbolic paraboloid)function, used to calculate the dissolve starting time
-  //z = y*y/a/a - x*x/b/b
-  //with our selection of parameters(a and b), this value for any texture coordinate is between -1.0 and 1.0
-
-  Vector3 saddleParam; // [0]: a*a, [1]: b*b, [2] b
-  Vector2 translation;
-  Vector2 rotation;
-  float toNext = -1.f;
-  if( displacement.x > 0.f || (EqualsZero(displacement.x) && displacement.y > 0.f) )
-  {
-    toNext = 1.f;
-  }
-
-  if( (displacement.y * displacement.x < 0.0f) )
-  {
-    //distance from (0,0) to the line
-    float distanceTopLeft =  fabsf(coefC) * inversedSqrtAABB;
-    //distance from (1, 1 ) to the line
-    float distanceBottomRight = fabsf(coefA+coefB+coefC) * inversedSqrtAABB;
-    saddleA = std::max( distanceTopLeft, distanceBottomRight );
-
-    //foot of a perpendicular: (1,0) to the line
-    float footX1 = ( coefB*coefB - coefA*coefC) * inversedAABB;
-    float footY1 = (-coefA*coefB - coefB*coefC) * inversedAABB;
-    //foot of a perpendicular: (0,1) to the line
-    float footX2 = (-coefA*coefB - coefA*coefC) * inversedAABB;
-    float footY2 = ( coefA*coefA - coefB*coefC) * inversedAABB;
-    saddleParam[1] = (footX1-footX2)*(footX1-footX2) + (footY1-footY2)*(footY1-footY2);
-    translation = Vector2(-footX2,-footY2);
-  }
-  else
-  {
-    //distance from(1,0) to the line
-    float distanceTopRight = fabsf(coefA+coefC) * inversedSqrtAABB;
-    //distance from(0,1) to the line
-    float distanceBottomLeft = fabsf(coefB+coefC) * inversedSqrtAABB;
-    saddleA = std::max( distanceTopRight, distanceBottomLeft );
-    //foot of a perpendicular: (0,0) to the line
-    float footX3 = (-coefA*coefC) * inversedAABB;
-    float footY3 = (-coefB*coefC) * inversedAABB;
-    //foot of a perpendicular: (1.0,1.0) to the line
-    float footX4 = ( coefB*coefB - coefA*coefB - coefA*coefC) * inversedAABB;
-    float footY4 = (-coefA*coefB + coefA*coefA- coefB*coefC) * inversedAABB;
-    saddleParam[1] = (footX3-footX4)*(footX3-footX4) + (footY3-footY4)*(footY3-footY4);
-    translation = Vector2(-footX3, -footY3);
-  }
-
-  saddleParam[2] = sqrtf(saddleParam[1]);
-  saddleParam[0] = saddleA*saddleA;
-  rotation = Vector2(-displacement.x, displacement.y);
-  rotation.Normalize();
-
-  SetUniform( "uSaddleParam", saddleParam );
-  SetUniform( "uTranslation", translation );
-  SetUniform( "uRotation", rotation );
-  SetUniform( "uToNext", toNext );
-
-}
-
-void DissolveEffect::SetDistortion( float distortion )
-{
-  SetUniform( DISTORTION_PROPERTY_NAME, distortion );
-}
-
-const std::string& DissolveEffect::GetDistortionPropertyName() const
-{
-  return DISTORTION_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 7ead044..4aee8cc 100644 (file)
@@ -28,64 +28,161 @@ namespace Toolkit
 {
 
 /**
- * @brief DissolveEffect is a custom shader effect to achieve Dissolve effects in Image actors.
+ * @brief Set the dissolve central line.
+ *
+ * Use one point (position) and one direction ( displacement ) vector to define this line
+ * As we use the texture coordinate as pixel position to calculate random offset,
+ * the line should passing through rectangle {(0,0),(0,1),(1,0),(1,1)},
+ * so make the position parameter with two component values between 0.0 to 1.0
+ * @param[in] dissolveEffect The shader effect
+ * @param[in] position The point ( locates within rectangle {(0,0),(0,1),(1,0),(1,1)} ) passed through by the central line
+ * @param[in] displacement The direction of the central line
+ */
+inline void DissolveEffectSetCentralLine( ShaderEffect& dissolveEffect, const Vector2& position, const Vector2& displacement )
+{
+  // the line passes through 'position' and has the direction of 'displacement'
+    float coefA, coefB, coefC; //line equation: Ax+By+C=0;
+    coefA = displacement.y;
+    coefB = -displacement.x;
+    coefC = -displacement.y*position.x + displacement.x*position.y;
+
+    float inversedAABB = 1.f / (coefA*coefA+coefB*coefB);
+    float inversedSqrtAABB = sqrtf(inversedAABB);
+    float saddleA;
+
+    //saddle surface(Hyperbolic paraboloid)function, used to calculate the dissolve starting time
+    //z = y*y/a/a - x*x/b/b
+    //with our selection of parameters(a and b), this value for any texture coordinate is between -1.0 and 1.0
+
+    Vector3 saddleParam; // [0]: a*a, [1]: b*b, [2] b
+    Vector2 translation;
+    Vector2 rotation;
+    float toNext = -1.f;
+    if( displacement.x > 0.f || (EqualsZero(displacement.x) && displacement.y > 0.f) )
+    {
+      toNext = 1.f;
+    }
+
+    if( (displacement.y * displacement.x < 0.0f) )
+    {
+      //distance from (0,0) to the line
+      float distanceTopLeft =  fabsf(coefC) * inversedSqrtAABB;
+      //distance from (1, 1 ) to the line
+      float distanceBottomRight = fabsf(coefA+coefB+coefC) * inversedSqrtAABB;
+      saddleA = std::max( distanceTopLeft, distanceBottomRight );
+
+      //foot of a perpendicular: (1,0) to the line
+      float footX1 = ( coefB*coefB - coefA*coefC) * inversedAABB;
+      float footY1 = (-coefA*coefB - coefB*coefC) * inversedAABB;
+      //foot of a perpendicular: (0,1) to the line
+      float footX2 = (-coefA*coefB - coefA*coefC) * inversedAABB;
+      float footY2 = ( coefA*coefA - coefB*coefC) * inversedAABB;
+      saddleParam[1] = (footX1-footX2)*(footX1-footX2) + (footY1-footY2)*(footY1-footY2);
+      translation = Vector2(-footX2,-footY2);
+    }
+    else
+    {
+      //distance from(1,0) to the line
+      float distanceTopRight = fabsf(coefA+coefC) * inversedSqrtAABB;
+      //distance from(0,1) to the line
+      float distanceBottomLeft = fabsf(coefB+coefC) * inversedSqrtAABB;
+      saddleA = std::max( distanceTopRight, distanceBottomLeft );
+      //foot of a perpendicular: (0,0) to the line
+      float footX3 = (-coefA*coefC) * inversedAABB;
+      float footY3 = (-coefB*coefC) * inversedAABB;
+      //foot of a perpendicular: (1.0,1.0) to the line
+      float footX4 = ( coefB*coefB - coefA*coefB - coefA*coefC) * inversedAABB;
+      float footY4 = (-coefA*coefB + coefA*coefA- coefB*coefC) * inversedAABB;
+      saddleParam[1] = (footX3-footX4)*(footX3-footX4) + (footY3-footY4)*(footY3-footY4);
+      translation = Vector2(-footX3, -footY3);
+    }
+
+    saddleParam[2] = sqrtf(saddleParam[1]);
+    saddleParam[0] = saddleA*saddleA;
+    rotation = Vector2(-displacement.x, displacement.y);
+    rotation.Normalize();
+
+    dissolveEffect.SetUniform( "uSaddleParam", saddleParam );
+    dissolveEffect.SetUniform( "uTranslation", translation );
+    dissolveEffect.SetUniform( "uRotation", rotation );
+    dissolveEffect.SetUniform( "uToNext", toNext );
+}
+/**
+ * @brief Create a new Dissolve effect
+ *
+ *  DissolveEffect is a custom shader effect to achieve Dissolve effects in Image actors.
+ *
+ *  Animatable/Constrainable uniforms:
+ *    "uPercentage" - This value is proportional to the distortion applied; a value of zero means no distortion.
+ *
+ *  @param[in] useHighPrecision True if using high precision in fragment shader for fully random noise, false otherwise
+ *  @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API DissolveEffect : public ShaderEffect
+
+inline ShaderEffect CreateDissolveEffect(bool useHighPrecision = true)
 {
-public:
-
-  /**
-   * @brief Create an uninitialized DissolveEffect; this can be initialized with DissolveEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  DissolveEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~DissolveEffect();
-
-  /**
-   * @brief Create an initialized DissolveEffect.
-   *
-   * @param[in] useHighPrecision True if using high precision in fragment shader for fully random noise, false otherwise
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static DissolveEffect New( bool useHighPrecision = true);
-
-  /**
-   * @brief Set the dissolve central line.
-   *
-   * Use one point (position) and one direction ( displacement ) vector to define this line
-   * As we use the texture coordinate as pixel position to calculate random offset,
-   * the line should passing through rectangle {(0,0),(0,1),(1,0),(1,1)},
-   * so make the position parameter with two component values between 0.0 to 1.0
-   * @param[in] position The point ( locates within rectangle {(0,0),(0,1),(1,0),(1,1)} ) passed through by the central line
-   * @param[in] displacement The direction of the central line
-   */
-  void SetCentralLine( const Vector2& position, const Vector2& displacement );
-
-  /**
-   * @brief Sets the distortion applied to the effect texture.
-   *
-   * This value is proportional to the distortion applied; a value of zero means no distortion.
-   * @param [in] distortion The distortion value.
-   */
-  void SetDistortion( float distortion );
-
-  /**
-   * @brief Get the name for the distortion property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetDistortionPropertyName() const;
-
-private: // Not intended for application developers
-  DALI_INTERNAL DissolveEffect(ShaderEffect handle);
-};
+  std::string prefixHighPrecision( "precision highp float;\n");
+    std::string prefixMediumPrecision( "precision mediump float;\n" );
+    std::string vertexShader(
+      "uniform float uPercentage;\n"
+      "uniform vec3 uSaddleParam;\n"
+      "uniform vec2 uTranslation;\n"
+      "uniform vec2 uRotation; \n"
+      "uniform float uToNext;\n"
+      "varying float vPercentage;\n"
+      "void main()\n"
+      "{\n"
+        "gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
+        "vTexCoord = aTexCoord;\n"
+        //Calculate the distortion value given the dissolve central line
+        "vec2 texCoor = vec2( (aTexCoord.s - sTextureRect.s ) / (sTextureRect.p - sTextureRect.s), (aTexCoord.t- sTextureRect.t)/(sTextureRect.q - sTextureRect.t) ); \n"
+        "vec2 value = texCoor + uTranslation; \n"
+        "mat2 rotateMatrix = mat2( uRotation.s, uRotation.t, -uRotation.t, uRotation.s ); \n"
+        "value = rotateMatrix * value; \n"
+        "if(uToNext == 1.0)  \n"
+        "  value.s = uSaddleParam[2] + value.s; \n"
+        "float delay = value.t*value.t / uSaddleParam[0] - value.s*value.s/uSaddleParam[1];\n"
+        "vPercentage = clamp( uPercentage*2.0 - 0.5*sin(delay*1.571) - 0.5, 0.0, 1.0 ); \n"
+      "}\n");
+    std::string fragmentShader(
+      "varying float vPercentage;\n"
+      "float rand(vec2 co) \n"
+      "{\n"
+      "  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n"
+      "}\n"
+      "void main()\n"
+      "{\n"
+        //Calculate the randomness
+        "float offsetS = rand( vTexCoord * vPercentage ) * (sTextureRect.p - sTextureRect.s) - vTexCoord.s  + sTextureRect.s; \n"
+        "float offsetT = rand( vec2(vTexCoord.t*vPercentage, vTexCoord.s * vPercentage) ) * (sTextureRect.q - sTextureRect.t) - vTexCoord.t + sTextureRect.t; \n"
+        "vec2 lookupCoord = vTexCoord + vec2(offsetS, offsetT) * vPercentage; \n"
+        "gl_FragColor = texture2D( sTexture, lookupCoord ) * uColor; \n"
+        "gl_FragColor.a *= 1.0 - vPercentage; \n"
+      "}" );
+
+    // Create the implementation, temporarily owned on stack,
+    Dali::ShaderEffect shaderEffect;
+    if( useHighPrecision )
+    {
+      shaderEffect =  Dali::ShaderEffect::New(
+          prefixHighPrecision+vertexShader, prefixHighPrecision + fragmentShader,
+          ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
+    }
+    else
+    {
+      shaderEffect =  Dali::ShaderEffect::New(
+          prefixMediumPrecision+vertexShader, prefixMediumPrecision + fragmentShader,
+          ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
+    }
+
+    shaderEffect.SetUniform( "uPercentage", 0.0f );
+    shaderEffect.SetProperty( ShaderEffect::Property::GRID_DENSITY, Dali::Property::Value(50.0f) );
+
+    DissolveEffectSetCentralLine( shaderEffect, Vector2(1.0f,0.5f), Vector2(-1.0f, 0.0f) );
+
+    return shaderEffect;
+
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/dissolve-local-effect.cpp b/dali-toolkit/devel-api/shader-effects/dissolve-local-effect.cpp
deleted file mode 100644 (file)
index acd6fda..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2015 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 <sstream>
-
-#include <dali-toolkit/devel-api/shader-effects/dissolve-local-effect.h>
-
-#include <dali-toolkit/devel-api/shader-effects/dissolve-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-  const std::string DISTORTION_PROPERTY_NAME( "uPercentage" );
-  const std::string CENTER_PROPERTY_NAME( "uCenter" );
-  const std::string RADIUS_PROPERTY_NAME( "uRadius" );
-  const std::string TRANSPARENCY_PROPERTY_NAME( "uTransparency" );
-}
-
-DissolveLocalEffect::DissolveLocalEffect()
-: mNumberOfDimples( 1 )
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-DissolveLocalEffect::DissolveLocalEffect( ShaderEffect handle )
-: ShaderEffect( handle ),
-  mNumberOfDimples( 1 )
-{
-}
-
-DissolveLocalEffect::~DissolveLocalEffect()
-{
-}
-
-DissolveLocalEffect DissolveLocalEffect::New( unsigned int numberOfDimples )
-{
-  std::ostringstream vertexShaderStringStream;
-  vertexShaderStringStream << "#define NUMBER_OF_DIMPLE "<< numberOfDimples << "\n";
-  std::string vertexShader(
-    "precision highp float;\n"
-    "uniform vec2 uCenter[ NUMBER_OF_DIMPLE ];\n"
-    "uniform float uRadius[ NUMBER_OF_DIMPLE ]; \n"
-    "uniform float uPercentage[ NUMBER_OF_DIMPLE ]; \n"
-    "varying float vPercentage;\n"
-    "void main()\n"
-    "{\n"
-    "  vec4 position = uModelView * vec4( aPosition, 1.0 );\n"
-    "  float percentage = 0.0;\n"
-    "  for( int i=0; i<NUMBER_OF_DIMPLE; ++i )\n"
-    "  {\n"
-    "    float distance = distance(uCenter[i], position.xy);\n"
-    "    percentage = max(percentage, uPercentage[i] * cos(clamp( distance/uRadius[i], 0.0, 1.0 )*1.57) );"
-    "  }\n"
-    "  vPercentage = clamp( percentage, 0.0, 1.0 );\n"
-    "  gl_Position = uProjection * position;\n"
-    "  vTexCoord = aTexCoord;\n"
-    "}\n");
-  vertexShaderStringStream << vertexShader;
-
-  std::string fragmentShader(
-    "precision highp float;\n"
-    "uniform float uTransparency;\n"
-    "varying float vPercentage;\n"
-    "float rand(vec2 co) \n"
-    "{\n"
-    "  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n"
-    "}\n"
-    "void main()\n"
-    "{\n"
-      //Calculate the randomness
-    "  float offsetS = rand( vTexCoord * vPercentage ); \n"
-    "  float offsetT = rand( vec2(vTexCoord.t*vPercentage, vTexCoord.s * vPercentage) ); \n"
-    "  vec2 lookupCoord = vTexCoord + vec2(offsetS, offsetT) * vPercentage; \n"
-    "  gl_FragColor = texture2D( sTexture, lookupCoord ) * uColor; \n"
-    "  gl_FragColor.a *= 1.0 - uTransparency*vPercentage; \n"
-    "}\n");
-
-  ShaderEffect shaderEffect = ShaderEffect::New( vertexShaderStringStream.str(), fragmentShader,
-                                                 GeometryType( GEOMETRY_TYPE_IMAGE),
-                                                 ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
-
-  DissolveLocalEffect handle( shaderEffect );
-  handle.mNumberOfDimples = numberOfDimples;
-
-  //Register uniform properties
-  for( unsigned int i = 0; i < numberOfDimples; i++ )
-  {
-    handle.SetCenter(i, Vector2(0.f,0.f));
-    handle.SetRadius(i, 0.f);
-    handle.SetDistortion( i, 0.f );
-  }
-  handle.SetProperty( ShaderEffect::Property::GRID_DENSITY, Dali::Property::Value(5.f) );
-  handle.SetTransparency( 0.5f );
-
-  return handle;
-}
-
-unsigned int DissolveLocalEffect::GetNumberOfDimples() const
-{
-  return mNumberOfDimples;
-}
-
-void DissolveLocalEffect::SetTransparency( float transparency)
-{
-  SetUniform( TRANSPARENCY_PROPERTY_NAME, transparency );
-}
-
-void DissolveLocalEffect::SetCenter( unsigned int index, const Vector2& center )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfDimples );
-  SetUniform( GetCenterPropertyName( index ), center, ShaderEffect::COORDINATE_TYPE_VIEWPORT_POSITION );
-}
-
-void DissolveLocalEffect::SetRadius( unsigned int index, float radius )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfDimples );
-  SetUniform( GetRadiusPropertyName( index ), radius );
-}
-
-void DissolveLocalEffect::SetDistortion( unsigned int index, float distortion )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfDimples );
-  SetUniform( GetDistortionPropertyName( index ), distortion );
-}
-
-std::string DissolveLocalEffect::GetCenterPropertyName( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfDimples );
-  std::ostringstream oss;
-  oss<< CENTER_PROPERTY_NAME << "[" << index << "]";
-  return oss.str();
-}
-
-std::string DissolveLocalEffect::GetRadiusPropertyName( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfDimples );
-  std::ostringstream oss;
-  oss<< RADIUS_PROPERTY_NAME << "[" << index << "]";
-  return oss.str();
-}
-
-std::string DissolveLocalEffect::GetDistortionPropertyName( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfDimples );
-  std::ostringstream oss;
-  oss<< DISTORTION_PROPERTY_NAME << "["<< index << "]";
-  return oss.str();
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index f140eee..3a244fc 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/shader-effects/shader-effect.h>
+#include <sstream>
 
 namespace Dali
 {
@@ -28,102 +29,88 @@ namespace Toolkit
 {
 
 /**
+ * @brief Create a new DissolveLocalEffect
+ *
  * DissolveLocalEffect is a custom shader effect to achieve Dissolve effects in multiple small areas of Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uTransparency"
+ *  "uCenter"     - The center positions of each dimples
+ *  "uRadius"     - The propagation radius of each dimple
+ *  "uPercentage" - The distortion applied to the effect texture. A value of zero means no distortion
+ *
+ * @param[in] numberOfDimples The number of dimples
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API DissolveLocalEffect : public ShaderEffect
+inline ShaderEffect CreateDissolveLocalEffect( unsigned int numberOfDimples )
 {
-public:
-
-  /**
-   * Create an uninitialized DissolveLocalEffect; this can be initialized with DissolveLocalEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  DissolveLocalEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~DissolveLocalEffect();
-
-  /**
-   * Create an initialized DissolveLocalEffect.
-   * @param[in] numberOfDimples The number of dimples
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static DissolveLocalEffect New( unsigned int numberOfDimples );
-
-  /**
-   * Get the number of dimples the shader supports.
-   * @return The number of dimples in the shader.
-   */
-  unsigned int GetNumberOfDimples() const;
-
-  /**
-  * Set the transparency of the drifted pixels.
-  * @param[in] transparency The transparency of the drifted pixels.
-  */
-  void SetTransparency( float transparency);
-
-  /**
-   * Set the certer position of a dimple.
-   * @param[in] index The index of the dimple to change.
-   * @param[in] center The center position of the dimple.
-   * @pre index has to be between 0 and GetNumberOfDimples() - 1
-   */
-  void SetCenter( unsigned int index, const Vector2& center );
-
-  /**
-   * Set the propogation radius of a dimple.
-   * @param[in] index The index of the dimple to change.
-   * @param[in] radius The propagation radius of the dimple.
-   * @pre index has to be between 0 and GetNumberOfDimples() - 1
-   */
-  void SetRadius( unsigned int index, float radius );
-
-  /**
-   * Sets the distortion applied to the effect texture.
-   * This value is proportional to the distortion applied; a value of zero means no distortion.
-   * @param[in] index The index of the dimple to change.
-   * @param[in] distortion The distortion value.
-   * @pre index has to be between 0 and GetNumberOfDimples() - 1
-   */
-  void SetDistortion( unsigned int index, float distortion );
-
-  /**
-   * Get the name of the center property of a dimple.
-   * @param[in] index The index of the dimple.
-   * @return A std::string containing the property name.
-   * @pre index has to be between 0 and GetNumberOfDimples() - 1
-   */
-  std::string GetCenterPropertyName( unsigned int index ) const;
-
-  /**
-   * Get the name of the radius property of a dimple.
-   * @param[in] index The index of the dimple.
-   * @return A std::string containing the property name
-   * @pre index has to be between 0 and GetNumberOfDimples() - 1
-   */
-  std::string GetRadiusPropertyName( unsigned int index ) const;
-
-  /**
-   * Get the name for the distortion property of a dimple
-   * @param[in] index the index of a dimple.
-   * @return A std::string containing the property name
-   * @pre index has to be between 0 and GetNumberOfDimples() - 1
-   */
-  std::string GetDistortionPropertyName( unsigned int index ) const;
-
-private: // Not intended for application developers
-
-  DALI_INTERNAL DissolveLocalEffect( ShaderEffect handle );
-
-private:
-
-  unsigned int mNumberOfDimples;  ///< The number of dimples the shader supports
-
-};
+  std::ostringstream vertexShaderStringStream;
+  vertexShaderStringStream << "#define NUMBER_OF_DIMPLE "<< numberOfDimples << "\n";
+  std::string vertexShader(
+      "precision highp float;\n"
+      "uniform vec2 uCenter[ NUMBER_OF_DIMPLE ];\n"
+      "uniform float uRadius[ NUMBER_OF_DIMPLE ]; \n"
+      "uniform float uPercentage[ NUMBER_OF_DIMPLE ]; \n"
+      "varying float vPercentage;\n"
+      "void main()\n"
+      "{\n"
+      "  vec4 position = uModelView * vec4( aPosition, 1.0 );\n"
+      "  float percentage = 0.0;\n"
+      "  for( int i=0; i<NUMBER_OF_DIMPLE; ++i )\n"
+      "  {\n"
+      "    float distance = distance(uCenter[i], position.xy);\n"
+      "    percentage = max(percentage, uPercentage[i] * cos(clamp( distance/uRadius[i], 0.0, 1.0 )*1.57) );"
+      "  }\n"
+      "  vPercentage = clamp( percentage, 0.0, 1.0 );\n"
+      "  gl_Position = uProjection * position;\n"
+      "  vTexCoord = aTexCoord;\n"
+      "}\n");
+  vertexShaderStringStream << vertexShader;
+
+  std::string fragmentShader(
+      "precision highp float;\n"
+      "uniform float uTransparency;\n"
+      "varying float vPercentage;\n"
+      "float rand(vec2 co) \n"
+      "{\n"
+      "  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n"
+      "}\n"
+      "void main()\n"
+      "{\n"
+      //Calculate the randomness
+      "  float offsetS = rand( vTexCoord * vPercentage ); \n"
+      "  float offsetT = rand( vec2(vTexCoord.t*vPercentage, vTexCoord.s * vPercentage) ); \n"
+      "  vec2 lookupCoord = vTexCoord + vec2(offsetS, offsetT) * vPercentage; \n"
+      "  gl_FragColor = texture2D( sTexture, lookupCoord ) * uColor; \n"
+      "  gl_FragColor.a *= 1.0 - uTransparency*vPercentage; \n"
+      "}\n");
+
+  ShaderEffect shaderEffect = ShaderEffect::New(
+      vertexShaderStringStream.str(), fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
+
+  //Register uniform properties
+  std::ostringstream oss;
+  for( unsigned int i = 0; i < numberOfDimples; i++ )
+  {
+    oss.str("");
+    oss<< "uCenter["<< i << "]";
+    shaderEffect.SetUniform(oss.str(), Vector2(0.f,0.f));
+
+    oss.str("");
+    oss<< "uRadius["<< i << "]";
+    shaderEffect.SetUniform(oss.str(), 0.f);
+
+    oss.str("");
+    oss<< "uPercentage["<< i << "]";
+    shaderEffect.SetUniform( oss.str(), 0.f );
+  }
+
+  shaderEffect.SetProperty( ShaderEffect::Property::GRID_DENSITY, Dali::Property::Value(5.f) );
+  shaderEffect.SetUniform( "uTransparency", 0.5f );
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/distance-field-effect.cpp b/dali-toolkit/devel-api/shader-effects/distance-field-effect.cpp
deleted file mode 100644 (file)
index 988eabb..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/distance-field-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-// generic uniforms
-const std::string COLOR_PROPERTY_NAME( "uColor" );
-const std::string SMOOTHING_PROPERTY_NAME( "uSmoothing" );
-
-// outline uniforms
-const std::string OUTLINE_ENABLE_PROPERTY_NAME( "uDoOutline" );
-const std::string OUTLINECOLOR_PROPERTY_NAME( "uOutlineColor" );
-const std::string OUTLINE_SIZE_PROPERTY_NAME( "uOutlineParams" );
-
-// glow related
-const std::string GLOW_ENABLE_PROPERTY_NAME( "uDoGlow" );
-const std::string GLOW_COLOR_PROPERTY_NAME( "uGlowColor" );
-const std::string GLOW_BOUNDARY_PROPERTY_NAME( "uGlowBoundary" );
-
-// shadow related
-const std::string SHADOW_ENABLE_PROPERTY_NAME( "uDoShadow" );
-const std::string SHADOW_COLOR_PROPERTY_NAME( "uShadowColor" );
-const std::string SHADOW_OFFSET_PROPERTY_NAME( "uShadowOffset" );
-} // namespace
-
-DistanceFieldEffect::DistanceFieldEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-DistanceFieldEffect::DistanceFieldEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-DistanceFieldEffect::~DistanceFieldEffect()
-{
-}
-
-DistanceFieldEffect DistanceFieldEffect::New()
-{
-  std::string fragmentShaderPrefix(
-      "#extension GL_OES_standard_derivatives : enable\n"
-      "\n"
-      );
-
-  std::string fragmentShader(
-      "uniform mediump float uSmoothing;\n"
-      "uniform mediump float uGlowBoundary;\n"
-      "uniform mediump vec2  uOutlineParams;\n"
-      "uniform lowp    vec4  uOutlineColor;\n"
-      "uniform lowp    vec4  uShadowColor;\n"
-      "uniform mediump vec2  uShadowOffset;\n"
-      "uniform lowp    vec4  uGlowColor;\n"
-      "uniform lowp    float uDoOutline;\n"
-      "uniform lowp    float uDoShadow;\n"
-      "uniform lowp    float uDoGlow;\n"
-      "\n"
-      "void main()\n"
-      "{\n"
-      "  // sample distance field\n"
-      "  mediump float distance = texture2D(sTexture, vTexCoord).a;\n"
-      "  mediump float smoothWidth = fwidth(distance);\n"
-      "  mediump float alphaFactor = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, distance);\n"
-      "  lowp    vec4  color;\n"
-      "  if (uDoShadow == 0.0)\n"
-      "  {\n"
-      "    mediump float alpha = uColor.a * alphaFactor;\n"
-      "    lowp    vec4  rgb = uColor;\n"
-      "\n"
-      "    if (uDoOutline > 0.0)\n"
-      "    {\n"
-      "      mediump float outlineWidth = uOutlineParams[1] + smoothWidth;\n"
-      "      mediump float outlineBlend = smoothstep(uOutlineParams[0] - outlineWidth, uOutlineParams[0] + outlineWidth, distance);\n"
-      "      alpha = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, distance);\n"
-      "      rgb = mix(uOutlineColor, uColor, outlineBlend);\n"
-      "    }\n"
-      "\n"
-      "    if (uDoGlow > 0.0)\n"
-      "    {\n"
-      "      rgb = mix(uGlowColor, rgb, alphaFactor);\n"
-      "      alpha = smoothstep(uGlowBoundary, uSmoothing, distance);\n"
-      "    }\n"
-      "\n"
-      "    // set fragment color\n"
-      "    color = vec4(rgb.rgb, alpha);\n"
-      "  }\n"
-      "\n"
-      "  else // (uDoShadow > 0.0)\n"
-      "  {\n"
-      "    mediump float shadowDistance = texture2D(sTexture, vTexCoord - uShadowOffset).a;\n"
-      "    mediump float inText = alphaFactor;\n"
-      "    mediump float inShadow = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, shadowDistance);\n"
-      "\n"
-      "    // inside object, outside shadow\n"
-      "    if (inText == 1.0)\n"
-      "    {\n"
-      "      color = uColor;\n"
-      "    }\n"
-      "    // inside object, outside shadow\n"
-      "    else if ((inText != 0.0) && (inShadow == 0.0))\n"
-      "    {\n"
-      "      color = uColor;\n"
-      "      color.a *= inText;\n"
-      "    }\n"
-      "    // outside object, completely inside shadow\n"
-      "    else if ((inText == 0.0) && (inShadow == 1.0))\n"
-      "    {\n"
-      "      color = uShadowColor;\n"
-      "    }\n"
-      "    // inside object, completely inside shadow\n"
-      "    else if ((inText != 0.0) && (inShadow == 1.0))\n"
-      "    {\n"
-      "      color = mix(uShadowColor, uColor, inText);\n"
-      "      color.a = uShadowColor.a;\n"
-      "    }\n"
-      "    // inside object, inside shadow's border\n"
-      "    else if ((inText != 0.0) && (inShadow != 0.0))\n"
-      "    {\n"
-      "      color = mix(uShadowColor, uColor, inText);\n"
-      "      color.a *= max(inText, inShadow);\n"
-      "    }\n"
-      "    // inside shadow's border\n"
-      "    else if (inShadow != 0.0)\n"
-      "    {\n"
-      "      color = uShadowColor;\n"
-      "      color.a *= inShadow;\n"
-      "    }\n"
-      "    // outside shadow and object\n"
-      "    else \n"
-      "    {\n"
-      "      color.a = 0.0;\n"
-      "    }\n"
-      "\n"
-      "  }\n"
-      "\n"
-      "  gl_FragColor = color;\n"
-      "\n"
-      "}\n"
-      );
-
-  // Create the implementation, temporarily owned on stack
-  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::NewWithPrefix("", "",
-                                                                       fragmentShaderPrefix, fragmentShader,
-                                                                       Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
-                                                                       ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING));
-
-  /* Pass ownership to DistanceFieldEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-
-  // TODO: move default values to... Constants?
-  Dali::Toolkit::DistanceFieldEffect handle( shaderEffect );
-
-  handle.SetSmoothingEdge(0.5f);
-  handle.SetOutlineColor(Color::BLACK);
-  handle.SetOutlineParams(Vector2(0.51f, 0.0f));
-  handle.SetGlowBoundary(0.4f);
-  handle.SetGlowColor(Color::GREEN);
-  handle.SetShadowColor(Vector4(0.0f, 0.0f, 0.0f, 0.4f));
-
-  // TODO: find a way to set the shadow offset in texel coordinates instead of UVs.
-  handle.SetShadowOffset(Vector2(0.05f, 0.05f));
-
-  // Default:
-  handle.SetOutline(false);
-  handle.SetGlow(false);
-  handle.SetShadow(false);
-
-  return handle;
-
-}
-
-void DistanceFieldEffect::SetGlowColor(const Vector4& color)
-{
-  SetUniform(GLOW_COLOR_PROPERTY_NAME, color);
-}
-
-void DistanceFieldEffect::SetGlow(bool glowEnable)
-{
-  const float a = glowEnable ? 1.0f : 0.0f;
-  SetUniform(GLOW_ENABLE_PROPERTY_NAME, a);
-}
-
-void DistanceFieldEffect::SetGlowBoundary(float glowBoundary)
-{
-  SetUniform(GLOW_BOUNDARY_PROPERTY_NAME, glowBoundary);
-}
-
-void DistanceFieldEffect::SetOutline(bool outlineEnable)
-{
-  const float a = outlineEnable ? 1.0f : 0.0f;
-  SetUniform(OUTLINE_ENABLE_PROPERTY_NAME, a);
-}
-
-void DistanceFieldEffect::SetOutlineColor(const Vector4& color)
-{
-  SetUniform(OUTLINECOLOR_PROPERTY_NAME, color);
-}
-
-void DistanceFieldEffect::SetOutlineParams(const Vector2& outlineParams)
-{
-  SetUniform(OUTLINE_SIZE_PROPERTY_NAME, outlineParams);
-}
-
-void DistanceFieldEffect::SetShadow(bool shadowEnable)
-{
-  if (shadowEnable)
-  {
-    SetGlow(false);
-    SetOutline(false);
-  }
-
-  const float a = shadowEnable ? 1.0f : 0.0f;
-  SetUniform(SHADOW_ENABLE_PROPERTY_NAME, a);
-}
-
-void DistanceFieldEffect::SetShadowColor(const Vector4& color)
-{
-  SetUniform(SHADOW_COLOR_PROPERTY_NAME, color);
-}
-
-void DistanceFieldEffect::SetShadowOffset(const Vector2& offset)
-{
-  SetUniform(SHADOW_OFFSET_PROPERTY_NAME, offset);
-}
-
-void DistanceFieldEffect::SetSmoothingEdge(const float smoothing)
-{
-  SetUniform(SMOOTHING_PROPERTY_NAME, smoothing);
-}
-
-const std::string& DistanceFieldEffect::GetColorPropertyName() const
-{
-  return COLOR_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetOutlineColorPropertyName() const
-{
-  return OUTLINECOLOR_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetShadowColorPropertyName() const
-{
-  return SHADOW_COLOR_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetShadowOffsetPropertyName() const
-{
-  return SHADOW_OFFSET_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetGlowColorPropertyName() const
-{
-  return GLOW_COLOR_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetGlowBoundaryPropertyName() const
-{
-  return GLOW_BOUNDARY_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetOutlineSizePropertyName() const
-{
-  return OUTLINE_SIZE_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetOutlineEnablePropertyName() const
-{
-  return OUTLINE_ENABLE_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetGlowEnablePropertyName() const
-{
-  return GLOW_ENABLE_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetShadowEnablePropertyName() const
-{
-  return SHADOW_ENABLE_PROPERTY_NAME;
-}
-
-const std::string& DistanceFieldEffect::GetSmoothingPropertyName() const
-{
-  return SMOOTHING_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 7d0b883..c3b2669 100644 (file)
@@ -28,169 +28,156 @@ namespace Toolkit
 {
 
 /**
+ * Creates a new DistanceFieldEffect
+ *
  * DistanceFieldEffect is a custom shader effect to achieve distance field on Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *
+ *  "uSmoothing"    - Soft edge smoothing. Specify the distance field value for the center of the edge.
+
+ *  "uDoGlow"       - The glow state. If true, glow is enabled
+ *  "uGlowBoundary" - The glow boundary factor
+ *  "uGlowColor"    - The glow color multiplier
+
+ *  "uDoShadow"     - The shadow state. If true, shadows is enabled. Cannot be used with glow/and or outline
+ *  "uShadowColor"  - The shadow color multiplier
+ *  "uShadowOffset" - The shadow offset
+
+ *  "uDoOutline"    - The outline state. If true, outline is enabled
+ *  "uOutlineColor" - The outline color multiplier
+ *  "uOutlineParams"- Thickness of outline. The outline thickness is determined by two values.
+ *                    First value [0-1] Specifies the distance field value for the center of the outline.
+ *                    Second value [0-1] Specifies the softness/width/anti-aliasing of the outlines inner edge.
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API DistanceFieldEffect : public ShaderEffect
+inline ShaderEffect CreateDistanceFieldEffect()
 {
-public:
-
-  /**
-   * Create an uninitialized DistanceFieldEffect; this can be initialized with DistanceFieldEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  DistanceFieldEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~DistanceFieldEffect();
-
-  /**
-   * Create an initialized DistanceFieldEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static DistanceFieldEffect New();
-
-  /**
-   * Set the shadow state
-   * @param[in] shadowEnable value - true, enable shadow.
-   * @note Shadow cannot be used with glow/and or outline.
-   */
-  void SetShadow(bool shadowEnable);
-
-  /**
-   * Set the shadow color multiplier (e.g. output RGB)
-   * @param[in] color Shadow color value
-   */
-  void SetShadowColor(const Vector4& color);
-
-  /**
-   * Set the shadow offset
-   * @param[in] color shadow offset value
-   */
-  void SetShadowOffset(const Vector2& color);
-
-  /**
-   * Set the glow state
-   * @param[in] glowEnable value - true, enable glow.
-   */
-
-  void SetGlow(bool glowEnable);
-
-  /**
-   * Set the glow color multiplier (e.g. output RGB)
-   * @param[in] color Glow color value
-   */
-  void SetGlowColor(const Vector4& color);
-
-  /**
-   * Set the glow boundary factor
-   * @param[in] glowBoundary glow boundary
-   */
-  void SetGlowBoundary(float glowBoundary);
-
-  /**
-   * Set the outline state
-   * @param[in] outlineEnable value - true, enable outline.
-   */
-
-  void SetOutline(bool outlineEnable);
-
-  /**
-   * Set the outline color multiplier (e.g. output RGB)
-   * @param[in] color Outline color value
-   */
-  void SetOutlineColor(const Vector4& color);
-
-  /**
-   * Sets the outline parameters.
-   * @param[in] outlineParams  Thickness of outline. The outline thickness is determined by two parameters.
-   *              params[0] (0-1) Specifies the distance field value for the center of the outline.
-   *                      0 <= params[0] <= 1
-   *              params[1] (0-1) Specifies the softness/width/anti-aliasing of the outlines inner edge.
-   *                      0 <= params[0] <= 1
-   */
-  void SetOutlineParams(const Vector2& outlineParams);
-
-  /**
-   * Set soft edge smoothing
-   * @param[in] smoothing Specify the distance field value for the center of the edge.
-   *                      0 <= params <= 1
-   */
-  void SetSmoothingEdge(float smoothing);
-
-  /**
-   * Get the name for the outline-enable property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetOutlineEnablePropertyName() const;
-
-  /**
-   * Get the name for the glow-enable property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetGlowEnablePropertyName() const;
-
-  /**
-   * Get the name for the shadow-enable property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetShadowEnablePropertyName() const;
-
-  /**
-   * Get the name for the radius property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetColorPropertyName() const;
-
-  /**
-   * Get the name for the smoothing property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetSmoothingPropertyName() const;
-
-  /**
-   * Get the name for the outline color property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetOutlineColorPropertyName() const;
-
-  /**
-   * Get the name for the outline size property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetOutlineSizePropertyName() const;
-
-  /**
-   * Get the name for the shadow color property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetShadowColorPropertyName() const;
-
-  /**
-   * Get the name for the shadow offset property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetShadowOffsetPropertyName() const;
-
-  /**
-   * Get the name for the glow color property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetGlowColorPropertyName() const;
-
-  /**
-   * Get the name for the glow boundary property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetGlowBoundaryPropertyName() const;
-
-private:
-  DALI_INTERNAL DistanceFieldEffect(ShaderEffect handle);
-
-};
+  std::string fragmentShaderPrefix(
+      "#extension GL_OES_standard_derivatives : enable\n"
+      "\n"
+  );
+
+  std::string fragmentShader(
+      "uniform mediump float uSmoothing;\n"
+      "uniform mediump float uGlowBoundary;\n"
+      "uniform mediump vec2  uOutlineParams;\n"
+      "uniform lowp    vec4  uOutlineColor;\n"
+      "uniform lowp    vec4  uShadowColor;\n"
+      "uniform mediump vec2  uShadowOffset;\n"
+      "uniform lowp    vec4  uGlowColor;\n"
+      "uniform lowp    float uDoOutline;\n"
+      "uniform lowp    float uDoShadow;\n"
+      "uniform lowp    float uDoGlow;\n"
+      "\n"
+      "void main()\n"
+      "{\n"
+      "  // sample distance field\n"
+      "  mediump float distance = texture2D(sTexture, vTexCoord).a;\n"
+      "  mediump float smoothWidth = fwidth(distance);\n"
+      "  mediump float alphaFactor = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, distance);\n"
+      "  lowp    vec4  color;\n"
+      "  if (uDoShadow == 0.0)\n"
+      "  {\n"
+      "    mediump float alpha = uColor.a * alphaFactor;\n"
+      "    lowp    vec4  rgb = uColor;\n"
+      "\n"
+      "    if (uDoOutline > 0.0)\n"
+      "    {\n"
+      "      mediump float outlineWidth = uOutlineParams[1] + smoothWidth;\n"
+      "      mediump float outlineBlend = smoothstep(uOutlineParams[0] - outlineWidth, uOutlineParams[0] + outlineWidth, distance);\n"
+      "      alpha = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, distance);\n"
+      "      rgb = mix(uOutlineColor, uColor, outlineBlend);\n"
+      "    }\n"
+      "\n"
+      "    if (uDoGlow > 0.0)\n"
+      "    {\n"
+      "      rgb = mix(uGlowColor, rgb, alphaFactor);\n"
+      "      alpha = smoothstep(uGlowBoundary, uSmoothing, distance);\n"
+      "    }\n"
+      "\n"
+      "    // set fragment color\n"
+      "    color = vec4(rgb.rgb, alpha);\n"
+      "  }\n"
+      "\n"
+      "  else // (uDoShadow > 0.0)\n"
+      "  {\n"
+      "    mediump float shadowDistance = texture2D(sTexture, vTexCoord - uShadowOffset).a;\n"
+      "    mediump float inText = alphaFactor;\n"
+      "    mediump float inShadow = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, shadowDistance);\n"
+      "\n"
+      "    // inside object, outside shadow\n"
+      "    if (inText == 1.0)\n"
+      "    {\n"
+      "      color = uColor;\n"
+      "    }\n"
+      "    // inside object, outside shadow\n"
+      "    else if ((inText != 0.0) && (inShadow == 0.0))\n"
+      "    {\n"
+      "      color = uColor;\n"
+      "      color.a *= inText;\n"
+      "    }\n"
+      "    // outside object, completely inside shadow\n"
+      "    else if ((inText == 0.0) && (inShadow == 1.0))\n"
+      "    {\n"
+      "      color = uShadowColor;\n"
+      "    }\n"
+      "    // inside object, completely inside shadow\n"
+      "    else if ((inText != 0.0) && (inShadow == 1.0))\n"
+      "    {\n"
+      "      color = mix(uShadowColor, uColor, inText);\n"
+      "      color.a = uShadowColor.a;\n"
+      "    }\n"
+      "    // inside object, inside shadow's border\n"
+      "    else if ((inText != 0.0) && (inShadow != 0.0))\n"
+      "    {\n"
+      "      color = mix(uShadowColor, uColor, inText);\n"
+      "      color.a *= max(inText, inShadow);\n"
+      "    }\n"
+      "    // inside shadow's border\n"
+      "    else if (inShadow != 0.0)\n"
+      "    {\n"
+      "      color = uShadowColor;\n"
+      "      color.a *= inShadow;\n"
+      "    }\n"
+      "    // outside shadow and object\n"
+      "    else \n"
+      "    {\n"
+      "      color.a = 0.0;\n"
+      "    }\n"
+      "\n"
+      "  }\n"
+      "\n"
+      "  gl_FragColor = color;\n"
+      "\n"
+      "}\n"
+  );
+
+  // Create the implementation, temporarily owned on stack
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::NewWithPrefix(
+      "", "",
+      fragmentShaderPrefix, fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING));
+
+  shaderEffect.SetUniform("uSmoothing",0.5f);
+  shaderEffect.SetUniform("uOutlineColor",Color::BLACK);
+  shaderEffect.SetUniform("uOutlineParams",Vector2(0.51f, 0.0f));
+  shaderEffect.SetUniform("uGlowBoundary",0.4f);
+  shaderEffect.SetUniform("uGlowColor",Color::GREEN);
+  shaderEffect.SetUniform("uShadowColor",Vector4(0.0f, 0.0f, 0.0f, 0.4f));
+
+  // TODO: find a way to set the shadow offset in texel coordinates instead of UVs.
+  shaderEffect.SetUniform("uShadowOffset",Vector2(0.05f, 0.05f));
+
+  // Default:
+  shaderEffect.SetUniform("uDoOutline",false);
+  shaderEffect.SetUniform("uDoGlow",false);
+  shaderEffect.SetUniform("uDoShadow",false);
+
+  return shaderEffect;
+}
+
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/image-region-effect.cpp b/dali-toolkit/devel-api/shader-effects/image-region-effect.cpp
deleted file mode 100644 (file)
index 1a16481..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/image-region-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string TOP_LEFT_PROPERTY_NAME( "uTopLeft" );
-const std::string BOTTOM_RIGHT_PROPERTY_NAME( "uBottomRight" );
-
-} // namespace
-
-ImageRegionEffect::ImageRegionEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-ImageRegionEffect::ImageRegionEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-ImageRegionEffect::~ImageRegionEffect()
-{
-}
-
-
-ImageRegionEffect ImageRegionEffect::New()
-{
-  std::string vertexShader(
-    "uniform mediump vec2 uTopLeft;\n"
-    "uniform mediump vec2 uBottomRight;\n"
-    "void main()\n"
-    "{\n"
-    "  mediump vec4 position = vec4(aPosition,1.0);\n"
-    "  gl_Position = uMvpMatrix * position;\n"
-    // The line below is doing the same as the following commented lines:
-    //"  vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n"
-    //"  vec2 topLeft = sTextureRect.xy + uTopLeft * imageSize;\n"
-    //"  vec2 bottomRight = sTextureRect.xy + uBottomRight * imageSize;\n"
-    //"  vec2 texCoord = (aTexCoord - sTextureRect.xy) / imageSize;\n"
-    //"  vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n"
-    "  vTexCoord = sTextureRect.xy + uTopLeft * ( sTextureRect.zw - sTextureRect.xy ) + ( aTexCoord - sTextureRect.xy ) * ( uBottomRight - uTopLeft );\n"
-    "}\n"
-  );
-
-  Dali::ShaderEffect shaderEffectCustom = Dali::ShaderEffect::New( vertexShader, "" );
-
-  Dali::Toolkit::ImageRegionEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( TOP_LEFT_PROPERTY_NAME, Vector2( 0.f, 0.f ) );
-  handle.SetUniform( BOTTOM_RIGHT_PROPERTY_NAME, Vector2( 1.f, 1.f ) );
-
-  return handle;
-}
-
-void ImageRegionEffect::SetTopLeft(const Vector2& point)
-{
-  SetUniform( TOP_LEFT_PROPERTY_NAME, point );
-}
-
-void ImageRegionEffect::SetBottomRight(const Vector2& point)
-{
-  SetUniform( BOTTOM_RIGHT_PROPERTY_NAME, point );
-}
-
-const std::string& ImageRegionEffect::GetTopLeftPropertyName() const
-{
-  return TOP_LEFT_PROPERTY_NAME;
-}
-
-const std::string& ImageRegionEffect::GetBottomRightPropertyName() const
-{
-  return BOTTOM_RIGHT_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index a74f5b8..2bce6b3 100644 (file)
@@ -28,67 +28,43 @@ namespace Toolkit
 {
 
 /**
- * @brief ImageRegionEffect is a custom shader effect to show only a region of an Image actor.
+ * @brief Creates a new ImageRegionEffect
+ *
+ * ImageRegionEffect is a custom shader effect to show only a region of an Image actor.
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uTopLeft"      - The top-left corner of the image region. The coordinates are in percentage,
+ *                    (0,0) being the top-left and (1,1) the bottom right of the original image
+ *  "uBottomRight"  - The bottom-right corner of the image region. The coordinates are in percentage,
+ *                    (0,0) being the top-left and (1,1) the bottom right of the original image
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API ImageRegionEffect : public ShaderEffect
+inline ShaderEffect CreateImageRegionEffect()
 {
-public:
-
-  /**
-   * @brief Create an uninitialized ImageRegionEffect; this can be initialized with ImageRegionEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  ImageRegionEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~ImageRegionEffect();
-
-  /**
-   * @brief Create an initialized ImageRegionEffect.
-   *
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static ImageRegionEffect New();
-
-  /**
-   * @brief Set the top-left corner of the image region.
-   *
-   * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
-   * @param [in] point The top-left corner of the region.
-   */
-  void SetTopLeft(const Vector2& point);
-
-  /**
-   * @brief Set the bottom-right corner of the image region.
-   *
-   * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
-   * @param [in] point The bottom-right corner of the region.
-   */
-  void SetBottomRight(const Vector2& point);
-
-  /**
-   * @brief Get the name for the top-left point property.
-   *
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetTopLeftPropertyName() const;
-
-  /**
-   * @brief Get the name for the bottom-right point property which can be used in Animation APIs.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetBottomRightPropertyName() const;
-
-private: // Not intended for application developers
-  DALI_INTERNAL ImageRegionEffect(ShaderEffect handle);
-};
+  std::string vertexShader(
+      "uniform mediump vec2 uTopLeft;\n"
+      "uniform mediump vec2 uBottomRight;\n"
+      "void main()\n"
+      "{\n"
+      "  mediump vec4 position = vec4(aPosition,1.0);\n"
+      "  gl_Position = uMvpMatrix * position;\n"
+      // The line below is doing the same as the following commented lines:
+      //"  vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n"
+      //"  vec2 topLeft = sTextureRect.xy + uTopLeft * imageSize;\n"
+      //"  vec2 bottomRight = sTextureRect.xy + uBottomRight * imageSize;\n"
+      //"  vec2 texCoord = (aTexCoord - sTextureRect.xy) / imageSize;\n"
+      //"  vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n"
+      "  vTexCoord = sTextureRect.xy + uTopLeft * ( sTextureRect.zw - sTextureRect.xy ) + ( aTexCoord - sTextureRect.xy ) * ( uBottomRight - uTopLeft );\n"
+      "}\n"
+  );
+
+  Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, "" );
+  shaderEffect.SetUniform( "uTopLeft", Vector2( 0.f, 0.f ) );
+  shaderEffect.SetUniform( "uBottomRight", Vector2( 1.f, 1.f ) );
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/iris-effect.cpp b/dali-toolkit/devel-api/shader-effects/iris-effect.cpp
deleted file mode 100644 (file)
index 5217dda..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/iris-effect.h>
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-const std::string RADIUS_PROPERTY_NAME( "uRadius" );
-const std::string CENTER_PROPERTY_NAME( "uCenter" );
-const std::string BLEND_FACTOR_PROPERTY_NAME( "uBlendFactor" );
-} // namespace
-
-IrisEffect::IrisEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-IrisEffect::IrisEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-IrisEffect::~IrisEffect()
-{
-}
-
-IrisEffect IrisEffect::New()
-{
-  // append the default version
-  std::string vertexShader(
-              "uniform mediump vec2 uCenter;\n"
-              "varying mediump vec2 vRelativePosition;\n"
-              "\n"
-              "void main()\n"
-              "{\n"
-              "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
-              "    gl_Position = uProjection * world;\n"
-              "    \n"
-              "    vTexCoord = aTexCoord;\n"
-              "    vRelativePosition = aTexCoord - uCenter;\n"
-              "}\n");
-
-  std::string fragmentShader(
-              "uniform mediump float uRadius;                                                           \n"
-              "uniform mediump float uBlendFactor;                                                      \n"
-              "varying mediump vec2 vRelativePosition;                                                  \n"
-              "void main()                                                                      \n"
-              "{                                                                                \n"
-              "   mediump float delta = (length(vRelativePosition) - uRadius);                          \n"
-              "   delta = clamp(0.0 - delta * uBlendFactor, 0.0, 1.0);                          \n"
-              "   gl_FragColor = texture2D(sTexture, vTexCoord) * uColor;                       \n"
-              "   gl_FragColor.a *= delta;                                                      \n"
-              "}                                                                                \n"
-              );
-
-  Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      vertexShader,
-      fragmentShader,
-      GeometryType( GEOMETRY_TYPE_IMAGE ),
-      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ));
-
-  Dali::Toolkit::IrisEffect handle( shaderEffectCustom );
-  handle.SetUniform( RADIUS_PROPERTY_NAME, 0.0f );
-  handle.SetUniform( BLEND_FACTOR_PROPERTY_NAME, 100.0f );
-  handle.SetUniform( CENTER_PROPERTY_NAME, Vector2(0.5f, 0.5f) );
-  return handle;
-}
-
-void IrisEffect::SetRadius( float radius )
-{
-  SetUniform( RADIUS_PROPERTY_NAME, radius );
-}
-
-void IrisEffect::SetBlendFactor(float value )
-{
-  SetUniform( BLEND_FACTOR_PROPERTY_NAME, value );
-}
-
-void IrisEffect::SetCenter( const Vector2& center )
-{
-  SetUniform( CENTER_PROPERTY_NAME, center );
-}
-
-const std::string& IrisEffect::GetRadiusPropertyName() const
-{
-  return RADIUS_PROPERTY_NAME;
-}
-
-const std::string& IrisEffect::GetBlendFactorPropertyName() const
-{
-  return BLEND_FACTOR_PROPERTY_NAME;
-}
-
-const std::string& IrisEffect::GetCenterPropertyName() const
-{
-  return CENTER_PROPERTY_NAME;
-}
-
-
-}
-}
index 7bad71e..2304748 100644 (file)
@@ -28,90 +28,64 @@ namespace Toolkit
 {
 
 /**
- * @brief IrisEffect is a custom shader effect to achieve iris effects in Image actors
+ * @brief Creates a new IrisEffect
+ *
+ * IrisEffect is a custom shader effect to achieve iris effects in Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *
+ *  "uRadius"       - The radius of the iris effect in texture coordinate distance,
+ *                    i.e. 0.0 (no circle) to 1.0 (complete circle), to > 1.0 (extending outside of texture).
+ *                    @note For Atlas Textures results may be unpredictable.
+ *
+ *  "uBlendFactor"  - The blend factor of the iris effect. The lower the value, the larger the blending portion
+ *                    (between Opaque & Transparent). Blending will account for 1 / blendFactor of the radius
+ *                    of the texture.
+ *
+ *  "uCenter"       - The center point of the iris (in texture coordinates)
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API IrisEffect : public ShaderEffect
+inline ShaderEffect CreateIrisEffect()
 {
-
-public:
-
-  /**
-   * @brief Create an uninitialized IrisEffect; this can be initialized with IrisEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  IrisEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~IrisEffect();
-
-  /**
-   * @brief Create an initialized IrisEffect.
-   *
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static IrisEffect New();
-
-  /**
-   * @brief Set the radius of the iris effect in texture coordinate distance,
-   * i.e. 0.0 (no circle) to 1.0 (complete circle), to > 1.0 (extending
-   * outside of texture).
-   *
-   * @note For Atlas Textures results may be unpredictable.
-   *
-   * @param [in] radius The new radius.
-   */
-  void SetRadius(float radius);
-
-  /**
-   * @brief Set the blend factor of the iris effect.
-   *
-   * The lower the value, the larger the blending portion
-   * (between Opaque & Transparent)
-   *
-   * Blending will account for 1 / blendFactor of the radius
-   * of the texture.
-   *
-   * @param [in] value The new blend Factor.
-   */
-  void SetBlendFactor(float value);
-
-  /**
-   * @brief Sets the center point of the iris (in texture coordinates).
-   *
-   * @param[in] center The center point.
-   */
-  void SetCenter( const Vector2& center );
-
-  /**
-   * @brief Get the name for the radius property which can be used in Animation APIs.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetRadiusPropertyName() const;
-
-  /**
-   * @brief Get the name for the blend factor property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetBlendFactorPropertyName() const;
-
-  /**
-   * @brief Get the name for the center property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCenterPropertyName() const;
-
-
-private: // Not intended for application developers
-  DALI_INTERNAL IrisEffect(ShaderEffect handle);
-};
+  // append the default version
+  std::string vertexShader(
+      "uniform mediump vec2 uCenter;\n"
+      "varying mediump vec2 vRelativePosition;\n"
+      "\n"
+      "void main()\n"
+      "{\n"
+      "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+      "    gl_Position = uProjection * world;\n"
+      "    \n"
+      "    vTexCoord = aTexCoord;\n"
+      "    vRelativePosition = aTexCoord - uCenter;\n"
+      "}\n");
+
+  std::string fragmentShader(
+      "uniform mediump float uRadius;                                                           \n"
+      "uniform mediump float uBlendFactor;                                                      \n"
+      "varying mediump vec2 vRelativePosition;                                                  \n"
+      "void main()                                                                      \n"
+      "{                                                                                \n"
+      "   mediump float delta = (length(vRelativePosition) - uRadius);                          \n"
+      "   delta = clamp(0.0 - delta * uBlendFactor, 0.0, 1.0);                          \n"
+      "   gl_FragColor = texture2D(sTexture, vTexCoord) * uColor;                       \n"
+      "   gl_FragColor.a *= delta;                                                      \n"
+      "}                                                                                \n"
+  );
+
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      vertexShader,
+      fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ));
+
+  shaderEffect.SetUniform( "uRadius", 0.0f );
+  shaderEffect.SetUniform( "uBlendFactor", 100.0f );
+  shaderEffect.SetUniform( "uCenter", Vector2(0.5f, 0.5f) );
+
+  return shaderEffect;
+}
 
 }
 }
diff --git a/dali-toolkit/devel-api/shader-effects/mask-effect.cpp b/dali-toolkit/devel-api/shader-effects/mask-effect.cpp
deleted file mode 100644 (file)
index daa2672..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/mask-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-MaskEffect::MaskEffect()
-{
-}
-
-MaskEffect::~MaskEffect()
-{
-}
-
-MaskEffect MaskEffect::New( Image maskImage )
-{
-  const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE =
-  "void main()                                                                    \n"
-  "{                                                                              \n"
-  "  highp vec4 mask = texture2D(sEffect, vTexCoord);                             \n"
-  "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(1,1,1,mask.a); \n"
-  "}                                                                              \n";
-
-  ShaderEffect shader = ShaderEffect::New( "", // Use default
-                                           ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
-                                           GeometryType( GEOMETRY_TYPE_IMAGE ),
-                                           ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
-
-  shader.SetEffectImage( maskImage );
-
-  return MaskEffect( shader );
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-MaskEffect::MaskEffect( ShaderEffect handle )
-: ShaderEffect( handle )
-{
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index a950ecb..8da0c99 100644 (file)
@@ -29,44 +29,39 @@ namespace Toolkit
 {
 
 /**
- * @brief MaskEffect is used to control which parts of an image are visible, using the alpha channel of a separate mask image.
+ * @brief Creates a new MaskEffect
+ *
+ * MaskEffect is used to control which parts of an image are visible, using the alpha channel of a separate mask image.
  *
  * Typically mask images should be the same size as the main image being viewed, but this isn't essential.
  *
  * Usage example:
  *
  *   ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) );
- *   MaskEffect maskEffect = MaskEffect::New( Image::New( MASK_IMAGE_PATH ) );
+ *   ShaderEffect maskEffect = CreateMaskEffect( Image::New( MASK_IMAGE_PATH ) );
  *   actor.SetShaderEffect( maskEffect );
+ *
+ * @param[in] maskImage The image to use as a mask
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API MaskEffect : public ShaderEffect
+inline ShaderEffect CreateMaskEffect(Image maskImage)
 {
-public:
-
-  /**
-   * @brief Create an empty MaskEffect handle.
-   */
-  MaskEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~MaskEffect();
+  const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE =
+      "void main()                                                                    \n"
+      "{                                                                              \n"
+      "  highp vec4 mask = texture2D(sEffect, vTexCoord);                             \n"
+      "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(1,1,1,mask.a); \n"
+      "}                                                                              \n";
 
-  /**
-   * @brief Create a MaskEffect.
-   *
-   * @param[in] maskImage The image to use as a mask
-   * @return A handle to a newly allocated MaskEffect.
-   */
-  static MaskEffect New( Image maskImage );
+  ShaderEffect shaderEffect = ShaderEffect::New(
+      "", // Use default
+      ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
 
-private: // Not intended for application developers
+  shaderEffect.SetEffectImage( maskImage );
 
-  DALI_INTERNAL MaskEffect( ShaderEffect handle );
-};
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/mirror-effect.cpp b/dali-toolkit/devel-api/shader-effects/mirror-effect.cpp
deleted file mode 100644 (file)
index 7ed44c7..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/mirror-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string DEPTH_PROPERTY_NAME( "uDepth" );
-const std::string ALPHA_PROPERTY_NAME( "uAlpha" );
-
-} // namespace
-
-MirrorEffect::MirrorEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-MirrorEffect::MirrorEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-MirrorEffect::~MirrorEffect()
-{
-}
-
-MirrorEffect MirrorEffect::New()
-{
-
-  std::string vertexShader(
-      "void main()                                  \n"
-      "{                                            \n"
-      "  mediump vec3 pos = aPosition;              \n"
-      "  pos.y = pos.y * 3.0;                       \n"
-      "  mediump vec4 world = uModelView * vec4(pos,1.0); \n"
-      "  gl_Position = uProjection * world;         \n"
-      "  vTexCoord = aTexCoord;                     \n"
-      "}                                            \n" );
-
-  std::string fragmentShader(
-      "uniform  mediump float  uDepth;              \n"
-      "uniform  mediump float  uAlpha;              \n"
-      "void main()                                  \n"
-      "{                                            \n"
-      " if(vTexCoord.y < 1.0 / 3.0)                 \n"
-      " {                                           \n"
-      "   gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);  \n"
-      " }                                           \n"
-      " else if(vTexCoord.y < 2.0 / 3.0)            \n"
-      " {                                           \n"
-      "   gl_FragColor = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y * 3.0 - 1.0)) * uColor;    \n"
-      "   gl_FragColor.a *= uAlpha;                 \n"
-      " }                                           \n"
-      " else                                        \n"
-      " {                                           \n"
-      "   highp float darkness = 3.0 - vTexCoord.y * 3.0;                                                   \n"
-      "   darkness = (1.0 - 1.0 / uDepth + darkness * 1.0/ uDepth) * 0.65;                            \n"
-      "   highp vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor;      \n"
-      "   color.a *= uAlpha;                                                                          \n"
-      "   gl_FragColor = color * vec4(darkness, darkness, darkness, darkness);                        \n"
-      " }                                           \n"
-      "}                                            \n" );
-
-  // Create the implementation, temporarily owned on stack,
-  Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      vertexShader,
-      fragmentShader,
-      GeometryType( GEOMETRY_TYPE_IMAGE ),
-      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ));
-
-  /* Pass ownership to MirrorEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::MirrorEffect handle( shaderEffectCustom );
-  handle.SetUniform(ALPHA_PROPERTY_NAME, 1.0f);
-  handle.SetUniform(DEPTH_PROPERTY_NAME, 0.5f);
-  return handle;
-}
-
-void MirrorEffect::SetDepth( float depth )
-{
-  SetUniform( DEPTH_PROPERTY_NAME, depth );
-}
-
-void MirrorEffect::SetAlpha( float alpha )
-{
-  SetUniform( ALPHA_PROPERTY_NAME, alpha );
-}
-
-const std::string& MirrorEffect::GetDepthPropertyName() const
-{
-  return DEPTH_PROPERTY_NAME;
-}
-
-const std::string& MirrorEffect::GetAlphaPropertyName() const
-{
-  return ALPHA_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 1eafac1..06eb019 100644 (file)
@@ -28,60 +28,63 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new MirrorEffect
+ *
  * MirrorEffect is a custom shader effect to achieve square effects in Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uDepth"  - The depth of the mirror effect. Default value 0.5
+ *  "uAlpha"  - The alpha of the mirror effect. Default value 1.0
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API MirrorEffect : public ShaderEffect
+inline ShaderEffect CreateMirrorEffect()
 {
-public:
-
-  /**
-   * Create an uninitialized MirrorEffect; this can be initialized with MirrorEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  MirrorEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~MirrorEffect();
-
-  /**
-   * Create an initialized MirrorEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static MirrorEffect New();
-
-  /**
-   * Set the depth of the mirror effect.
-   * @param [in] depth The new mirror depth value.
-   */
-  void SetDepth(float depth);
-
-  /**
-   * Set the alpha of the mirror effect.
-   * @param [in] alpha The new mirror alpha value.
-   */
-  void SetAlpha(float alpha);
-
-  /**
-   * Get the name for the depth property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetDepthPropertyName() const;
-
-  /**
-   * Get the name for the alpha property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAlphaPropertyName() const;
+  std::string vertexShader(
+      "void main()                                  \n"
+      "{                                            \n"
+      "  mediump vec3 pos = aPosition;              \n"
+      "  pos.y = pos.y * 3.0;                       \n"
+      "  mediump vec4 world = uModelView * vec4(pos,1.0); \n"
+      "  gl_Position = uProjection * world;         \n"
+      "  vTexCoord = aTexCoord;                     \n"
+      "}                                            \n" );
+
+  std::string fragmentShader(
+      "uniform  mediump float  uDepth;              \n"
+      "uniform  mediump float  uAlpha;              \n"
+      "void main()                                  \n"
+      "{                                            \n"
+      " if(vTexCoord.y < 1.0 / 3.0)                 \n"
+      " {                                           \n"
+      "   gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);  \n"
+      " }                                           \n"
+      " else if(vTexCoord.y < 2.0 / 3.0)            \n"
+      " {                                           \n"
+      "   gl_FragColor = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y * 3.0 - 1.0)) * uColor;    \n"
+      "   gl_FragColor.a *= uAlpha;                 \n"
+      " }                                           \n"
+      " else                                        \n"
+      " {                                           \n"
+      "   highp float darkness = 3.0 - vTexCoord.y * 3.0;                                                   \n"
+      "   darkness = (1.0 - 1.0 / uDepth + darkness * 1.0/ uDepth) * 0.65;                            \n"
+      "   highp vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor;      \n"
+      "   color.a *= uAlpha;                                                                          \n"
+      "   gl_FragColor = color * vec4(darkness, darkness, darkness, darkness);                        \n"
+      " }                                           \n"
+      "}                                            \n" );
+
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      vertexShader,
+      fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ));
+
+  shaderEffect.SetUniform("uAlpha", 1.0f);
+  shaderEffect.SetUniform("uDepth", 0.5f);
+
+  return shaderEffect;
+}
 
-private: // Not intended for application developers
-  DALI_INTERNAL MirrorEffect(ShaderEffect handle);
-};
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/motion-blur-effect.cpp b/dali-toolkit/devel-api/shader-effects/motion-blur-effect.cpp
deleted file mode 100644 (file)
index ed92e82..0000000
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/animation/constraints.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string MOTION_BLUR_TEXCOORD_SCALE_PROPERTY_NAME( "uBlurTexCoordScale" );
-const std::string MOTION_BLUR_GEOM_STRETCH_SCALING_FACTOR_PROPERTY_NAME( "uGeometryStretchFactor" );
-const std::string MOTION_BLUR_SPEED_SCALING_FACTOR_PROPERTY_NAME( "uSpeedScalingFactor" );
-const std::string MOTION_BLUR_OBJECT_FADE_START_PROPERTY_NAME( "uObjectFadeStart" );
-const std::string MOTION_BLUR_OBJECT_FADE_END_PROPERTY_NAME( "uObjectFadeEnd" );
-const std::string MOTION_BLUR_ALPHA_SCALE_PROPERTY_NAME( "uAlphaScale" );
-const std::string MOTION_BLUR_NUM_SAMPLES_NAME( "uNumSamples" );
-const std::string MOTION_BLUR_RECIP_NUM_SAMPLES_NAME( "uRecipNumSamples" );
-const std::string MOTION_BLUR_RECIP_NUM_SAMPLES_MINUS_ONE_NAME( "uRecipNumSamplesMinusOne" );
-const std::string MOTION_BLUR_MODEL_LASTFRAME( "uModelLastFrame" );  ///< Matrix
-
-////////////////////////////////////////////////////
-//
-// Motion blur shader / actor tweaking parameters
-//
-
-const unsigned int MOTION_BLUR_NUM_SAMPLES = 8;
-
-// half width and half height respectively of actor, corresponding to values in vertex attribute stream
-// TODO: Note that these values work for normal image actor (verts +/- 0.5) but a grid or a nine square seems to have verts in pixel space (e.g. 256,256). Need to fix this somehow,
-// either in Dali or by passing uniforms which we can use to 'normalise' the verts in the vertex shader
-const Vector2 MOTION_BLUR_ACTOR_VERTEX( 0.5f, 0.5f );
-
-const float MOTION_BLUR_TEXCOORD_SCALE = 0.125f;             // stretch texture reads along velocity vector, larger number means reads spaced further apart
-const float MOTION_BLUR_GEOM_STRETCH_SCALING_FACTOR = 0.05f; // scaling factor for how much to stretch actor geom as it moves
-const float MOTION_BLUR_SPEED_SCALING_FACTOR = 0.5f;         // scales the speed, producing a number affecting how much the actor blurs & fades at the edges
-
-const Vector2 MOTION_BLUR_OBJECT_FADE_END( MOTION_BLUR_ACTOR_VERTEX );             // distance from center at which actor fully fades to zero alpha
-const Vector2 MOTION_BLUR_OBJECT_FADE_START( MOTION_BLUR_OBJECT_FADE_END * 0.5f ); // distance from center at which actor start to fade from full alpha
-
-const float MOTION_BLUR_ALPHA_SCALE = 0.75f; // global scaler applied to actor alpha as it is blurred + moving
-
-} // namespace
-
-
-MotionBlurEffect::MotionBlurEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-MotionBlurEffect::MotionBlurEffect( ShaderEffect handle )
-:ShaderEffect( handle )
-{
-}
-
-MotionBlurEffect::~MotionBlurEffect()
-{
-}
-
-MotionBlurEffect MotionBlurEffect::Apply( RenderableActor renderable )
-{
-  MotionBlurEffect newEffect = New( MOTION_BLUR_NUM_SAMPLES );
-  renderable.SetShaderEffect( newEffect );
-
-  Dali::Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME );
-
-  Constraint constraint = Constraint::New<Matrix>( newEffect, uModelProperty, EqualToConstraint() );
-  constraint.AddSource( Source( renderable, Actor::Property::WORLD_MATRIX ) );
-
-  // and set up constraint.
-  constraint.Apply();
-  return newEffect;
-}
-
-MotionBlurEffect MotionBlurEffect::New()
-{
-  return New( MOTION_BLUR_NUM_SAMPLES );
-}
-
-MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
-{
-  // Dali vertexSource prefix for reference:
-  // precision highp float;
-  // attribute vec3  aPosition;
-  // attribute vec2  aTexCoord;
-  // uniform   mat4  uMvpMatrix;
-  // uniform   mat4  uModelView;
-  // uniform   mat3  uNormalMatrix;
-  // uniform   mat4  uProjection;
-  // uniform   vec4  uColor;
-  // varying   vec2  vTexCoord;
-  std::string vertexSource;
-  vertexSource =
-    "precision mediump float;\n"
-    "uniform mat4 uModelLastFrame;\n"
-    "uniform float uTimeDelta;\n"
-
-    "uniform float uGeometryStretchFactor;\n"
-    "uniform float uSpeedScalingFactor;\n"
-
-    // outputs
-    "varying vec2 vModelSpaceCenterToPos;\n"
-    "varying vec2 vScreenSpaceVelocityVector;\n"
-    "varying float vSpeed;\n"
-
-    "void main()\n"
-    "{\n"
-    // get view space position of vertex this frame and last frame
-    " vec4 vertex = vec4(aPosition, 1.0);\n"
-    " vec4 viewSpaceVertex = uModelView * vertex;\n"
-    " vec4 viewSpaceVertexLastFrame = (uViewMatrix * uModelLastFrame) * vertex;\n"
-    " float reciprocalTimeDelta = 1.0 / ((uTimeDelta > 0.0) ? uTimeDelta : 0.01);\n"
-
-    // work out vertex's last movement in view space
-    " vec3 viewSpacePosDelta = viewSpaceVertex.xyz - viewSpaceVertexLastFrame.xyz;\n"
-
-    // get clip space position of vertex this frame and last frame
-    " vec4 clipSpaceVertex = uMvpMatrix * vertex;\n"
-    " vec4 clipSpaceVertexLastFrame = uProjection * viewSpaceVertexLastFrame;\n"
-
-    // decide how much this vertex is 'trailing', i.e. at the back of the object relative to its direction of motion. We do this
-    // by assuming the objects model space origin is at its center and taking the dot product of the vector from center to vertex with the motion direction
-    " float t = 0.0;\n"
-    " float posDeltaLength = length(viewSpacePosDelta);\n"
-    " if(posDeltaLength > 0.001)\n" // avoid div by 0 if object has barely moved
-    " {\n"
-    "   vec4 viewSpaceCenterToPos = uModelView * vec4(aPosition, 0.0);\n"
-    "   float centerToVertexDist = length(viewSpaceCenterToPos);\n"
-    "   if(centerToVertexDist > 0.001)\n" // avoid div by 0 if object has vertex at model space origin
-    "   {\n"
-    "     vec3 viewSpacePosDeltaNormalised = viewSpacePosDelta / posDeltaLength;\n"
-    "     vec3 viewSpaceCenterToPosNormalised = viewSpaceCenterToPos.xyz / centerToVertexDist;\n"
-    "     t = (dot(viewSpacePosDeltaNormalised, viewSpaceCenterToPosNormalised) * 0.5 ) + 0.5;\n" // scale and bias from [-1..1] to [0..1]
-    "   }\n"
-    " }\n"
-    // output vertex position lerped with its last position, based on how much it is trailing,
-    // this stretches the geom back along where it has just been, giving a warping effect
-    // Note: we must take account of time delta to convert position delta into a velocity, so changes are smooth (take into account frame time correctly)
-    " gl_Position = mix(clipSpaceVertexLastFrame, clipSpaceVertex, t * uGeometryStretchFactor * reciprocalTimeDelta);\n"
-
-    // work out vertex's last movement in normalised device coordinates [-1..1] space, i.e. perspective divide
-    " vec2 ndcVertex = clipSpaceVertex.xy / clipSpaceVertex.w;\n"
-    " vec2 ndcVertexLastFrame = clipSpaceVertexLastFrame.xy / clipSpaceVertexLastFrame.w;\n"
-    // scale and bias so that a value of 1.0 corresponds to screen size (NDC is [-1..1] = 2)
-    " vScreenSpaceVelocityVector = ((ndcVertex - ndcVertexLastFrame) * 0.5 * reciprocalTimeDelta);\n"
-    " vScreenSpaceVelocityVector.y = -vScreenSpaceVelocityVector.y;\n" // TODO negated due to y being inverted in our coordinate system?
-    // calculate a scaling factor proportional to velocity, which we can use to tweak how things look
-    " vSpeed = length(vScreenSpaceVelocityVector) * uSpeedScalingFactor;\n"
-    " vSpeed = clamp(vSpeed, 0.0, 1.0);\n"
-
-    // provide fragment shader with vector from center of object to pixel (assumes the objects model space origin is at its center and verts have same z)
-    " vModelSpaceCenterToPos = aPosition.xy;\n"
-
-    " vTexCoord = aTexCoord;\n"
-    "}\n";
-
-
-  // Dali fragmentSource prefix for reference:
-  // precision highp     float;
-  // uniform   sampler2D sTexture;
-  // uniform   sampler2D sEffect;
-  // uniform   vec4      uColor;
-  // varying   vec2      vTexCoord;
-  std::string fragmentSource;
-  fragmentSource =
-    "precision mediump float;\n"
-    "uniform vec2 uObjectFadeStart;\n"
-    "uniform vec2 uObjectFadeEnd;\n"
-    "uniform float uAlphaScale;\n"
-    "uniform float uBlurTexCoordScale;\n"
-    "uniform float uNumSamples;\n"
-    "uniform float uRecipNumSamples;\n"
-    "uniform float uRecipNumSamplesMinusOne;\n"
-    // inputs
-    "varying vec2 vModelSpaceCenterToPos;\n"
-    "varying vec2 vScreenSpaceVelocityVector;\n"
-    "varying float vSpeed;\n"
-
-    "void main()\n"
-    "{\n"
-    // calculate an alpha value that will fade the object towards its extremities, we need this to avoid an unsightly hard edge between color values of
-    // the blurred object and the unblurred background. Use smoothstep also to hide any hard edges (discontinuities) in rate of change of this alpha gradient
-    " vec2 centerToPixel = abs(vModelSpaceCenterToPos);\n"
-    " vec2 fadeToEdges = smoothstep(0.0, 1.0, 1.0 - ((centerToPixel - uObjectFadeStart) / (uObjectFadeEnd - uObjectFadeStart)));\n"
-    " float fadeToEdgesScale = fadeToEdges.x * fadeToEdges.y * uAlphaScale;\n" // apply global scaler
-    " fadeToEdgesScale = mix(1.0, fadeToEdgesScale, vSpeed);\n" // fade proportional to speed, so opaque when at rest
-
-    // scale velocity vector by user requirements
-    " vec2 velocity = vScreenSpaceVelocityVector * uBlurTexCoordScale;\n"
-
-    // standard actor texel
-    " vec4 colActor = texture2D(sTexture, vTexCoord);\n"
-
-    // blurred actor - gather texture samples from the actor texture in the direction of motion
-    " vec4 col = colActor * uRecipNumSamples;\n"
-    " for(float i = 1.0; i < uNumSamples; i += 1.0)\n"
-    " {\n"
-    "   float t = i * uRecipNumSamplesMinusOne;\n"
-    "   col += texture2D(sTexture, vTexCoord + (velocity * t)) * uRecipNumSamples;\n"
-    " }\n"
-    " gl_FragColor = mix(colActor, col, vSpeed);\n" // lerp blurred and non-blurred actor based on speed of motion
-    " gl_FragColor.a = colActor.a * fadeToEdgesScale;\n" // fade blurred actor to its edges based on speed of motion
-    " gl_FragColor *= uColor;\n"
-    "}\n";
-
-  // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
-  ShaderEffect shader = ShaderEffect::New( vertexSource, fragmentSource,
-                                           GEOMETRY_TYPE_IMAGE,
-                                           ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID) );
-
-  MotionBlurEffect handle( shader );
-
-
-  //////////////////////////////////////
-  // Register uniform properties
-  //
-  //
-
-  // factors that scale the look, defaults
-  handle.SetUniform( MOTION_BLUR_TEXCOORD_SCALE_PROPERTY_NAME, MOTION_BLUR_TEXCOORD_SCALE );
-  handle.SetUniform( MOTION_BLUR_GEOM_STRETCH_SCALING_FACTOR_PROPERTY_NAME, MOTION_BLUR_GEOM_STRETCH_SCALING_FACTOR );
-  handle.SetUniform( MOTION_BLUR_SPEED_SCALING_FACTOR_PROPERTY_NAME, MOTION_BLUR_SPEED_SCALING_FACTOR );
-  handle.SetUniform( MOTION_BLUR_OBJECT_FADE_START_PROPERTY_NAME, MOTION_BLUR_OBJECT_FADE_START );
-  handle.SetUniform( MOTION_BLUR_OBJECT_FADE_END_PROPERTY_NAME, MOTION_BLUR_OBJECT_FADE_END );
-  handle.SetUniform( MOTION_BLUR_ALPHA_SCALE_PROPERTY_NAME, MOTION_BLUR_ALPHA_SCALE );
-  handle.SetUniform( MOTION_BLUR_NUM_SAMPLES_NAME, static_cast<float>( MOTION_BLUR_NUM_SAMPLES ) );
-  handle.SetUniform( MOTION_BLUR_RECIP_NUM_SAMPLES_NAME, 1.0f / static_cast<float>( MOTION_BLUR_NUM_SAMPLES ) );
-  handle.SetUniform( MOTION_BLUR_RECIP_NUM_SAMPLES_MINUS_ONE_NAME, 1.0f / static_cast<float>( MOTION_BLUR_NUM_SAMPLES - 1.0f ) );
-  handle.SetUniform( MOTION_BLUR_MODEL_LASTFRAME, Matrix::IDENTITY );
-
-  return handle;
-}
-
-MotionBlurEffect MotionBlurEffect::DownCast( ShaderEffect shaderEffect )
-{
-  MotionBlurEffect handle = shaderEffect;
-  return handle;
-}
-
-void MotionBlurEffect::SetNumSamples( int numSamples )
-{
-  SetUniform( MOTION_BLUR_NUM_SAMPLES_NAME, static_cast<float>( numSamples ) );
-  SetUniform( MOTION_BLUR_RECIP_NUM_SAMPLES_NAME, 1.0f / static_cast<float>( numSamples ) );
-  SetUniform( MOTION_BLUR_RECIP_NUM_SAMPLES_MINUS_ONE_NAME, 1.0f / static_cast<float>( numSamples - 1.0f ) );
-}
-
-void MotionBlurEffect::SetTexcoordScale( float texcoordScale )
-{
-  SetUniform( MOTION_BLUR_TEXCOORD_SCALE_PROPERTY_NAME, texcoordScale );
-}
-
-void MotionBlurEffect::SetGeometryStretchFactor( float scalingFactor )
-{
-  SetUniform( MOTION_BLUR_GEOM_STRETCH_SCALING_FACTOR_PROPERTY_NAME, scalingFactor );
-}
-
-void MotionBlurEffect::SetSpeedScalingFactor( float scalingFactor )
-{
-  SetUniform( MOTION_BLUR_SPEED_SCALING_FACTOR_PROPERTY_NAME, scalingFactor );
-}
-
-void MotionBlurEffect::SetObjectFadeStart( Vector2 displacement )
-{
-  SetUniform( MOTION_BLUR_OBJECT_FADE_START_PROPERTY_NAME, displacement );
-}
-
-void MotionBlurEffect::SetObjectFadeEnd( Vector2 displacement )
-{
-  SetUniform( MOTION_BLUR_OBJECT_FADE_END_PROPERTY_NAME, displacement );
-}
-
-void MotionBlurEffect::SetAlphaScale( float alphaScale )
-{
-  SetUniform( MOTION_BLUR_ALPHA_SCALE_PROPERTY_NAME, alphaScale );
-}
-
-const std::string& MotionBlurEffect::GetTexcoordScalePropertyName() const
-{
-  return MOTION_BLUR_TEXCOORD_SCALE_PROPERTY_NAME;
-}
-
-const std::string& MotionBlurEffect::GetGeometryStretchFactorPropertyName() const
-{
-  return MOTION_BLUR_GEOM_STRETCH_SCALING_FACTOR_PROPERTY_NAME;
-}
-
-const std::string& MotionBlurEffect::GetSpeedScalingFactorPropertyName() const
-{
-  return MOTION_BLUR_SPEED_SCALING_FACTOR_PROPERTY_NAME;
-}
-
-const std::string& MotionBlurEffect::GetObjectFadeStartPropertyName() const
-{
-  return MOTION_BLUR_OBJECT_FADE_START_PROPERTY_NAME;
-}
-
-const std::string& MotionBlurEffect::GetObjectFadeEndPropertyName() const
-{
-  return MOTION_BLUR_OBJECT_FADE_END_PROPERTY_NAME;
-}
-
-const std::string& MotionBlurEffect::GetAlphaScalePropertyName() const
-{
-  return MOTION_BLUR_ALPHA_SCALE_PROPERTY_NAME;
-}
-
-}
-
-}
index 5455fef..a4aaa7f 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/renderable-actor.h>
+#include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/shader-effects/shader-effect.h>
 
 namespace Dali
@@ -29,185 +29,210 @@ namespace Toolkit
 {
 
 /**
+ * @brief Create a new MotionBlurEffect
  *
- * Class for motion blur shader that works on a per object basis. Objects will
+ * Motion blur shader works on a per object basis. Objects will
  * blur when they move, or if the camera moves. Can be applied to ImageActor or
  * TextActor only.
  *
  * Usage example:-
  *
  * // Create shader used for doing motion blur\n
- * MotionBlurEffect MotionBlurEffect = MotionBlurEffect::New();
+ * ShaderEffect MotionBlurEffect = CreateMotionBlurEffect();
  *
  * // set actor shader to the blur one\n
- * Actor Actor = Actor::New( ... );\n
- * Actor.SetShaderEffect( MotionBlurEffect );
+ * Actor actor = Actor::New( ... );\n
+ * actor.SetShaderEffect( MotionBlurEffect );
  *
+ * // Constrain "uModelLastFrame" to be the same as the actor's world matrix\n
+ * Dali::Property::Index uModelProperty = MotionBlurEffect.GetPropertyIndex( "uModelLastFrame" );
+ * Constraint constraint = Constraint::New<Matrix>( MotionBlurEffect, uModelProperty, EqualToConstraint() );\n
+ * constraint.AddSource( Source( actor , Actor::Property::WORLD_MATRIX ) );\n
+ * constraint.Apply();\n
+ *
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uBlurTexCoordScale"      - This scales the offset for texture samples along the motion velocity vector.
+ *                              A smaller value means the samples will be spaced closer, larger value further
+ *                              apart. User should use this to get the blur to look contiguous, i.e. the blur
+ *                              texels should not be too widely spread, with gaps in between. Default 0.125.
+ *  "uGeometryStretchFactor"  - This scales the amount the geometry stretches backwards along the motion velocity
+ *                              vector. A smaller value means the geometry stretches less, larger it stretches more.
+ *                              User should use this to get the blur to 'bleed' into areas outside the physical
+ *                              bounds of the actor. We need this as the blur is only applied inside the bounds of
+ *                              the actor, but you would expect motion blur trails where the actor was previously
+ *                              but is there no longer. Default 0.05.
+ *  "uSpeedScalingFactor"     - This takes the magnitude of the motion velocity vector and scales it to produce a
+ *                              value which is used to fade the blur in / out with the speed that the actor is moving.
+ *                              As the blur fades in, more of the blur is visible and less of the original actor, and
+ *                              viceversa. This value is also used to control how much to fade the actor near the
+ *                              edges, based on the speed the actor is moving. When the actor is at rest this is not applied.
+ *                              Default 0.5.
+ *  "uObjectFadeStart"        - The displacement from the centre of the actor that the actor will start to fade towards its
+ *                              edges. This is used to prevent an unsightly hard edge between the blurred actor and the scene.
+ *                              Depends on the values of the vertices in the vertex stream. When the actor is at rest this is
+ *                              not applied. Default 0.25, which is half way towards the edge for an ImageRenderer::QUAD.
+ *  "uObjectFadeEnd"          - The displacement from the centre of the actor that the actor will finish fading towards its
+ *                              edges. This is used to prevent an unsightly hard edge between the blurred actor and the scene.
+ *                              Depends on the values of the vertices in the vertex stream. When the actor is at rest this is
+ *                              not applied.Default 0.5, which is all the way towards the edge for an ImageRenderer::QUAD.
+ *  "uAlphaScale"             - Global scaler applied to the alpha of the actor. Used to make the blurred actor a bit more subtle
+ *                              (helps to hide discontinuities due to limited number of texture samples) and reveal a bit of the
+ *                              background behind it as it moves. When the actor is at rest this is not applied. Default 0.75.
+ *  "uNumSamples"             - The number of texture samples to be taken. Increasing the number of samples provides better quality
+ *                              at the cost of performance.
+ *  "uModelLastFrame"         - The model to world space transformation matrix of the actor in the previous frame.
+ *
+ * @param numBlurSamples Number of samples used by the shader
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API MotionBlurEffect : public ShaderEffect
+inline ShaderEffect CreateMotionBlurEffect( unsigned int numBlurSamples = 8 )
 {
-
-public:
-
-  /**
-   * Create an uninitialized MotionBlurEffect; this can be initialized with MotionBlurEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  MotionBlurEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~MotionBlurEffect();
-
-  /**
-   * Create an initialized MotionBlurEffect
-   * The number of texture samples taken along the motion velocity vector of the
-   * actor, producing the blur, is set to a default of 8.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static MotionBlurEffect New();
-
-  /**
-   * Create a  MotionBlurEffect and attach it to the specified actor
-   * The number of texture samples taken along the motion velocity vector of the
-   * actor, producing the blur, is set to a default of 8.
-   * @param renderable actor to apply the effect to
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static MotionBlurEffect Apply( RenderableActor renderable );
-
-  /**
-   * Create an initialized MotionBlurEffect
-   * @param numBlurSamples The number of texture samples taken along the motion
-   * velocity vector of the actor, producing the blur. A higher number gives a
-   * smoother blur but costs more in terms of performance.
-   * @param numBlurSamples to have
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static MotionBlurEffect New( unsigned int numBlurSamples );
-
-  /**
-   * Set texcoord scale property. This scales the offset for texture samples
-   * along the motion velocity vector. A smaller value means the samples will
-   * be spaced closer, larger value further apart. User should use this to get
-   * the blur to look contiguous, i.e. the blur texels should not be too widely
-   * spread, with gaps in between. Default 0.125.
-   * @param texcoordScale The scaling factor that multiplies the motion velocity vector for texture lookups.
-   */
-  void SetTexcoordScale( float texcoordScale );
-
-  /**
-   * Set geometry stretch factor property. This scales the amount the
-   * geometry stretches backwards along the motion velocity vector. A smaller
-   * value means the geometry stretches less, larger it stretches more. User
-   * should use this to get the blur to 'bleed' into areas outside the physical
-   * bounds of the actor. We need this as the blur is only applied inside the
-   * bounds of the actor, but you would expect motion blur trails where the
-   * actor was previously but is there no longer. Default 0.05.
-   * @param scalingFactor The scaling factor that extrudes the geometry backwards along the motion velocity vector.
-   */
-  void SetGeometryStretchFactor( float scalingFactor );
-
-  /**
-   * Set speed scaling factor property. This takes the magnitude of the motion
-   * velocity vector and scales it to produce a value which is used to fade the
-   * blur in / out with the speed that the actor is moving. As the blur fades
-   * in, more of the blur is visible and less of the original actor, and vice
-   * versa.
-   * This value is also used to control how much to fade the actor near the
-   * edges, based on the speed the actor is moving. When the actor is at rest
-   * this is not applied. Default 0.5.
-   * @param scalingFactor The scaling factor that controls the edge fade / blur fade of the actor.
-   */
-  void SetSpeedScalingFactor( float scalingFactor );
-
-  /**
-   * Set the displacement from the centre of the actor that the actor will start
-   * to fade towards its edges. This is used to prevent an unsightly hard edge
-   * between the blurred actor and the scene. Depends on the values of the
-   * vertices in the vertex stream. When the actor is at rest this is not applied.
-   * Default 0.25, which is half way towards the edge for an ImageRenderer::QUAD.
-   * @param displacement The displacement from the centre of the actor that the actor will start to edge fade.
-   */
-  void SetObjectFadeStart( Vector2 displacement );
-
-  /**
-   * Set the displacement from the centre of the actor that the actor will
-   * finish fading towards its edges. This is used to prevent an unsightly hard
-   * edge between the blurred actor and the scene. Depends on the values of the
-   * vertices in the vertex stream. When the actor is at rest this is not applied.
-   * Default 0.5, which is all the way towards the edge for an ImageRenderer::QUAD.
-   * @param displacement The displacement from the centre of the actor that the actor will finish edge fading.
-   */
-  void SetObjectFadeEnd( Vector2 displacement );
-
-  /**
-   * Set a global scaler applied to the alpha of the actor. Used to make the
-   * blurred actor a bit more subtle (helps to hide discontinuities due to
-   * limited number of texture samples) and reveal a bit of the background
-   * behind it as it moves. When the actor is at rest this is not applied. Default 0.75.
-   * @param alphaScale The scaling factor which multiplies the alpha of each pixel of the actor.
-   */
-  void SetAlphaScale( float alphaScale );
-
-  /**
-   * Set the number of texture samples to be taken. Increasing the number of
-   * samples provides better quality at the cost of performance.
-   * @param numSamples The number of texture samples to be taken. Default is 8.
-   */
-  void SetNumSamples( int numSamples );
-
-  /**
-   * Get the name for the texcoord scale property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetTexcoordScalePropertyName() const;
-
-  /**
-   * Get the name for the geometry stretching property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetGeometryStretchFactorPropertyName() const;
-
-  /**
-   * Get the name for the speed scaling property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetSpeedScalingFactorPropertyName() const;
-
-  /**
-   * Get the name for the fade start property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetObjectFadeStartPropertyName() const;
-
-  /**
-   * Get the name for the fade end property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetObjectFadeEndPropertyName() const;
-
-  /**
-   * Get the name for the alpha scale property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAlphaScalePropertyName() const;
-
-  /**
-   * Downcast an ShaderEffect handle to MotionBlurEffect handle. If handle points to a MotionBlurEffect object the
-   * downcast produces valid handle. If not the returned handle is left uninitialized.
-   * @param[in] handle to a ShaderEffect
-   * @return handle to a MotionBlurEffect object or an uninitialized handle
-   */
-  static MotionBlurEffect DownCast( ShaderEffect handle );
-
-private:
-  // Not intended for application developers
-  DALI_INTERNAL MotionBlurEffect( ShaderEffect handle );
-};
+  // Dali vertexSource prefix for reference:
+  // precision highp float;
+  // attribute vec3  aPosition;
+  // attribute vec2  aTexCoord;
+  // uniform   mat4  uMvpMatrix;
+  // uniform   mat4  uModelView;
+  // uniform   mat3  uNormalMatrix;
+  // uniform   mat4  uProjection;
+  // uniform   vec4  uColor;
+  // varying   vec2  vTexCoord;
+  std::string vertexSource;
+  vertexSource =
+      "precision mediump float;\n"
+      "uniform mat4 uModelLastFrame;\n"
+      "uniform float uTimeDelta;\n"
+
+      "uniform float uGeometryStretchFactor;\n"
+      "uniform float uSpeedScalingFactor;\n"
+
+      // outputs
+      "varying vec2 vModelSpaceCenterToPos;\n"
+      "varying vec2 vScreenSpaceVelocityVector;\n"
+      "varying float vSpeed;\n"
+
+      "void main()\n"
+      "{\n"
+      // get view space position of vertex this frame and last frame
+      " vec4 vertex = vec4(aPosition, 1.0);\n"
+      " vec4 viewSpaceVertex = uModelView * vertex;\n"
+      " vec4 viewSpaceVertexLastFrame = (uViewMatrix * uModelLastFrame) * vertex;\n"
+      " float reciprocalTimeDelta = 1.0 / ((uTimeDelta > 0.0) ? uTimeDelta : 0.01);\n"
+
+      // work out vertex's last movement in view space
+      " vec3 viewSpacePosDelta = viewSpaceVertex.xyz - viewSpaceVertexLastFrame.xyz;\n"
+
+      // get clip space position of vertex this frame and last frame
+      " vec4 clipSpaceVertex = uMvpMatrix * vertex;\n"
+      " vec4 clipSpaceVertexLastFrame = uProjection * viewSpaceVertexLastFrame;\n"
+
+      // decide how much this vertex is 'trailing', i.e. at the back of the object relative to its direction of motion. We do this
+      // by assuming the objects model space origin is at its center and taking the dot product of the vector from center to vertex with the motion direction
+      " float t = 0.0;\n"
+      " float posDeltaLength = length(viewSpacePosDelta);\n"
+      " if(posDeltaLength > 0.001)\n" // avoid div by 0 if object has barely moved
+      " {\n"
+      "   vec4 viewSpaceCenterToPos = uModelView * vec4(aPosition, 0.0);\n"
+      "   float centerToVertexDist = length(viewSpaceCenterToPos);\n"
+      "   if(centerToVertexDist > 0.001)\n" // avoid div by 0 if object has vertex at model space origin
+      "   {\n"
+      "     vec3 viewSpacePosDeltaNormalised = viewSpacePosDelta / posDeltaLength;\n"
+      "     vec3 viewSpaceCenterToPosNormalised = viewSpaceCenterToPos.xyz / centerToVertexDist;\n"
+      "     t = (dot(viewSpacePosDeltaNormalised, viewSpaceCenterToPosNormalised) * 0.5 ) + 0.5;\n" // scale and bias from [-1..1] to [0..1]
+      "   }\n"
+      " }\n"
+      // output vertex position lerped with its last position, based on how much it is trailing,
+      // this stretches the geom back along where it has just been, giving a warping effect
+      // Note: we must take account of time delta to convert position delta into a velocity, so changes are smooth (take into account frame time correctly)
+      " gl_Position = mix(clipSpaceVertexLastFrame, clipSpaceVertex, t * uGeometryStretchFactor * reciprocalTimeDelta);\n"
+
+      // work out vertex's last movement in normalised device coordinates [-1..1] space, i.e. perspective divide
+      " vec2 ndcVertex = clipSpaceVertex.xy / clipSpaceVertex.w;\n"
+      " vec2 ndcVertexLastFrame = clipSpaceVertexLastFrame.xy / clipSpaceVertexLastFrame.w;\n"
+      // scale and bias so that a value of 1.0 corresponds to screen size (NDC is [-1..1] = 2)
+      " vScreenSpaceVelocityVector = ((ndcVertex - ndcVertexLastFrame) * 0.5 * reciprocalTimeDelta);\n"
+      " vScreenSpaceVelocityVector.y = -vScreenSpaceVelocityVector.y;\n" // TODO negated due to y being inverted in our coordinate system?
+      // calculate a scaling factor proportional to velocity, which we can use to tweak how things look
+      " vSpeed = length(vScreenSpaceVelocityVector) * uSpeedScalingFactor;\n"
+      " vSpeed = clamp(vSpeed, 0.0, 1.0);\n"
+
+      // provide fragment shader with vector from center of object to pixel (assumes the objects model space origin is at its center and verts have same z)
+      " vModelSpaceCenterToPos = aPosition.xy;\n"
+
+      " vTexCoord = aTexCoord;\n"
+      "}\n";
+
+
+  // Dali fragmentSource prefix for reference:
+  // precision highp     float;
+  // uniform   sampler2D sTexture;
+  // uniform   sampler2D sEffect;
+  // uniform   vec4      uColor;
+  // varying   vec2      vTexCoord;
+  std::string fragmentSource;
+  fragmentSource =
+      "precision mediump float;\n"
+      "uniform vec2 uObjectFadeStart;\n"
+      "uniform vec2 uObjectFadeEnd;\n"
+      "uniform float uAlphaScale;\n"
+      "uniform float uBlurTexCoordScale;\n"
+      "uniform float uNumSamples;\n"
+      "uniform float uRecipNumSamples;\n"
+      "uniform float uRecipNumSamplesMinusOne;\n"
+      // inputs
+      "varying vec2 vModelSpaceCenterToPos;\n"
+      "varying vec2 vScreenSpaceVelocityVector;\n"
+      "varying float vSpeed;\n"
+
+      "void main()\n"
+      "{\n"
+      // calculate an alpha value that will fade the object towards its extremities, we need this to avoid an unsightly hard edge between color values of
+      // the blurred object and the unblurred background. Use smoothstep also to hide any hard edges (discontinuities) in rate of change of this alpha gradient
+      " vec2 centerToPixel = abs(vModelSpaceCenterToPos);\n"
+      " vec2 fadeToEdges = smoothstep(0.0, 1.0, 1.0 - ((centerToPixel - uObjectFadeStart) / (uObjectFadeEnd - uObjectFadeStart)));\n"
+      " float fadeToEdgesScale = fadeToEdges.x * fadeToEdges.y * uAlphaScale;\n" // apply global scaler
+      " fadeToEdgesScale = mix(1.0, fadeToEdgesScale, vSpeed);\n" // fade proportional to speed, so opaque when at rest
+
+      // scale velocity vector by user requirements
+      " vec2 velocity = vScreenSpaceVelocityVector * uBlurTexCoordScale;\n"
+
+      // standard actor texel
+      " vec4 colActor = texture2D(sTexture, vTexCoord);\n"
+
+      // blurred actor - gather texture samples from the actor texture in the direction of motion
+      " vec4 col = colActor * uRecipNumSamples;\n"
+      " for(float i = 1.0; i < uNumSamples; i += 1.0)\n"
+      " {\n"
+      "   float t = i * uRecipNumSamplesMinusOne;\n"
+      "   col += texture2D(sTexture, vTexCoord + (velocity * t)) * uRecipNumSamples;\n"
+      " }\n"
+      " gl_FragColor = mix(colActor, col, vSpeed);\n" // lerp blurred and non-blurred actor based on speed of motion
+      " gl_FragColor.a = colActor.a * fadeToEdgesScale;\n" // fade blurred actor to its edges based on speed of motion
+      " gl_FragColor *= uColor;\n"
+      "}\n";
+
+  // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
+  ShaderEffect shader = ShaderEffect::New( vertexSource, fragmentSource,
+                                           ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID) );
+
+  //////////////////////////////////////
+  // Register uniform properties
+  //
+  //
+  shader.SetUniform( "uBlurTexCoordScale", 0.125f );
+  shader.SetUniform( "uGeometryStretchFactor", 0.05f );
+  shader.SetUniform( "uSpeedScalingFactor", 0.5f );
+  shader.SetUniform( "uObjectFadeStart", Vector2( 0.25f, 0.25f ) );
+  shader.SetUniform( "uObjectFadeEnd", Vector2( 0.5f, 0.5f ) );
+  shader.SetUniform( "uAlphaScale", 0.75f );
+  shader.SetUniform( "uNumSamples", static_cast<float>( numBlurSamples ) );
+  shader.SetUniform( "uRecipNumSamples", 1.0f / static_cast<float>( numBlurSamples ) );
+  shader.SetUniform( "uRecipNumSamplesMinusOne", 1.0f / static_cast<float>( numBlurSamples - 1.0f ) );
+  shader.SetUniform( "uModelLastFrame", Matrix::IDENTITY );
+
+  return shader;
+}
 
 }
 
diff --git a/dali-toolkit/devel-api/shader-effects/motion-stretch-effect.cpp b/dali-toolkit/devel-api/shader-effects/motion-stretch-effect.cpp
deleted file mode 100644 (file)
index 11c1ba8..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/animation/constraints.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-struct MatrixFromPropertiesConstraint
-{
-  MatrixFromPropertiesConstraint()
-  {
-  }
-
-  Matrix operator()( const Matrix& current,
-                     const PropertyInput& propertyPosition,
-                     const PropertyInput& propertyOrientation,
-                     const PropertyInput& propertyScale )
-  {
-    Matrix mat4( false );
-    mat4.SetTransformComponents( propertyScale.GetVector3(),
-                                 propertyOrientation.GetQuaternion(),
-                                 propertyPosition.GetVector3() );
-
-    return mat4;
-  }
-};
-
-const std::string MOTION_STRETCH_GEOMETRY_STRETCH_SCALING_FACTOR_PROPERTY_NAME( "uGeometryStretchFactor" );
-const std::string MOTION_STRETCH_SPEED_SCALING_FACTOR_PROPERTY_NAME( "uSpeedScalingFactor" );
-const std::string MOTION_STRETCH_OBJECT_FADE_START_PROPERTY_NAME( "uObjectFadeStart" );
-const std::string MOTION_STRETCH_OBJECT_FADE_END_PROPERTY_NAME( "uObjectFadeEnd" );
-const std::string MOTION_STRETCH_ALPHA_SCALE_PROPERTY_NAME( "uAlphaScale" );
-const std::string MOTION_STRETCH_MODELVIEW_LASTFRAME( "uModelLastFrame" );  ///< Matrix
-
-////////////////////////////////////////////////////
-//
-// Motion stretch shader / actor tweaking parameters
-//
-
-// half width and half height respectively of actor, corresponding to values in vertex attribute stream
-// Note that these values work for normal image actor (verts +/- 0.5) but a grid or a nine square seemsi
-// to have verts in pixel space (e.g. 256,256). Need to fix this somehow,
-// either in Dali or by passing uniforms which we can use to 'normalise' the verts in the vertex shader
-const Vector2 MOTION_STRETCH_ACTOR_VERTEX( 0.5f, 0.5f );
-
-const float MOTION_STRETCH_GEOM_STRETCH_SCALING_FACTOR = 0.5f; // scaling factor for how much to stretch actor geom as it moves
-const float MOTION_STRETCH_SPEED_SCALING_FACTOR = 0.5f;        // scales the speed, producing a number affecting how much the actor stretches & fades at the edges
-
-const Vector2 MOTION_STRETCH_OBJECT_FADE_END( MOTION_STRETCH_ACTOR_VERTEX );             // displacement from center at which actor fully fades to zero alpha
-const Vector2 MOTION_STRETCH_OBJECT_FADE_START( MOTION_STRETCH_OBJECT_FADE_END * 0.5f ); // displacement from center at which actor start to fade from full alpha
-
-const float MOTION_STRETCH_ALPHA_SCALE = 0.75f; // global scaler applied to actor alpha as it is stretched + moving
-
-} // namespace
-
-
-MotionStretchEffect::MotionStretchEffect()
-{
-}
-
-// Call the Parent copy constructor to add reference to the implementation for this object
-MotionStretchEffect::MotionStretchEffect( ShaderEffect handle )
-:ShaderEffect( handle )
-{
-}
-
-MotionStretchEffect::~MotionStretchEffect()
-{
-}
-
-MotionStretchEffect MotionStretchEffect::Apply( RenderableActor renderable )
-{
-  MotionStretchEffect newEffect = New();
-  renderable.SetShaderEffect( newEffect );
-
-  Dali::Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );
-
-  Constraint constraint = Constraint::New<Matrix>( newEffect, uModelProperty, EqualToConstraint() );
-  constraint.AddSource( Source( renderable, Actor::Property::WORLD_MATRIX ) );
-
-  // and set up constraint.
-  constraint.Apply();
-  return newEffect;
-}
-
-MotionStretchEffect MotionStretchEffect::New()
-{
-  // Dali vertexSource prefix for reference:
-  // precision highp float;
-  // attribute vec3  aPosition;
-  // attribute vec2  aTexCoord;
-  // uniform   mat4  uMvpMatrix;
-  // uniform   mat4  uModelView;
-  // uniform   mat3  uNormalMatrix;
-  // uniform   mat4  uProjection;
-  // uniform   vec4  uColor;
-  // varying   vec2  vTexCoord;
-  std::string vertexSource;
-  vertexSource =
-    "precision mediump float;\n"
-    "uniform mat4  uModelLastFrame;\n"
-    "uniform float uTimeDelta;\n"
-
-    "uniform float uGeometryStretchFactor;\n"
-    "uniform float uSpeedScalingFactor;\n"
-
-    // outputs
-    "varying vec2 vModelSpaceCenterToPos;\n"
-    "varying vec2 vScreenSpaceVelocityVector;\n"
-    "varying float vSpeed;\n"
-
-    "void main()\n"
-    "{\n"
-    // get view space position of vertex this frame and last frame
-    " vec4 vertex = vec4(aPosition, 1.0);\n"
-    " vec4 viewSpaceVertex = uModelView * vertex;\n"
-    " vec4 viewSpaceVertexLastFrame = uViewMatrix * uModelLastFrame * vertex;\n"
-
-    // work out vertex's last movement in view space
-    " vec3 viewSpacePosDelta = viewSpaceVertex.xyz - viewSpaceVertexLastFrame.xyz;\n"
-    " float reciprocalTimeDelta = 1.0 / ((uTimeDelta > 0.0) ? uTimeDelta : 0.01);\n"
-
-    // get clip space position of vertex this frame and last frame
-    " vec4 clipSpaceVertex = uMvpMatrix * vertex;\n"
-    " vec4 clipSpaceVertexLastFrame = uProjection * viewSpaceVertexLastFrame;\n"
-
-    // decide how much this vertex is 'trailing', i.e. at the back of the object relative to its direction of motion. We do this
-    // by assuming the objects model space origin is at its center and taking the dot product of the vector from center to vertex with the motion direction
-    " float t = 0.0;\n"
-    " float posDeltaLength = length(viewSpacePosDelta);\n"
-    " if(posDeltaLength > 0.001)\n" // avoid div by 0 if object has barely moved
-    " {\n"
-    "   vec4 viewSpaceCenterToPos = uModelView * vec4(aPosition, 0.0);\n"
-    "   float centerToVertexDist = length(viewSpaceCenterToPos);\n"
-    "   if(centerToVertexDist > 0.001)\n" // avoid div by 0 if object has vertex at model space origin
-    "   {\n"
-    "     vec3 viewSpacePosDeltaNormalised = viewSpacePosDelta / posDeltaLength;\n"
-    "     vec3 viewSpaceCenterToPosNormalised = viewSpaceCenterToPos.xyz / centerToVertexDist;\n"
-    "     t = (dot(viewSpacePosDeltaNormalised, viewSpaceCenterToPosNormalised) * 0.5 ) + 0.5;\n" // scale and bias from [-1..1] to [0..1]
-    "   }\n"
-    " }\n"
-    // output vertex position lerped with its last position, based on how much it is trailing,
-    // this stretches the geom back along where it has just been, giving a warping effect
-    // We raise t to a power in order that non-trailing vertices are effected much more than trailing ones
-    // Note: we must take account of time delta to convert position delta into a velocity, so changes are smooth (take into account frame time correctly)
-    " gl_Position = mix(clipSpaceVertexLastFrame, clipSpaceVertex, t * t * t * uGeometryStretchFactor * reciprocalTimeDelta);\n"
-
-    // work out vertex's last movement in normalised device coordinates [-1..1] space, i.e. perspective divide
-    " vec2 ndcVertex = clipSpaceVertex.xy / clipSpaceVertex.w;\n"
-    " vec2 ndcVertexLastFrame = clipSpaceVertexLastFrame.xy / clipSpaceVertexLastFrame.w;\n"
-    // scale and bias so that a value of 1.0 corresponds to screen size (NDC is [-1..1] = 2)
-    " vScreenSpaceVelocityVector = ((ndcVertex - ndcVertexLastFrame) * 0.5 * reciprocalTimeDelta);\n"
-    " vScreenSpaceVelocityVector.y = -vScreenSpaceVelocityVector.y;\n" // TODO negated due to y being inverted in our coordinate system?
-    // calculate a scaling factor proportional to velocity, which we can use to tweak how things look
-    " vSpeed = length(vScreenSpaceVelocityVector) * uSpeedScalingFactor;\n"
-    " vSpeed = clamp(vSpeed, 0.0, 1.0);\n"
-
-    // provide fragment shader with vector from center of object to pixel (assumes the objects model space origin is at its center and verts have same z)
-    " vModelSpaceCenterToPos = aPosition.xy;\n"
-
-    " vTexCoord = aTexCoord;\n"
-    "}\n";
-
-
-  // Dali fragmentSource prefix for reference:
-  // precision highp     float;
-  // uniform   sampler2D sTexture;
-  // uniform   sampler2D sEffect;
-  // uniform   vec4      uColor;
-  // varying   vec2      vTexCoord;
-  std::string fragmentSource;
-  fragmentSource =
-    "precision mediump float;\n"
-
-    "uniform vec2 uObjectFadeStart;\n"
-    "uniform vec2 uObjectFadeEnd;\n"
-    "uniform float uAlphaScale;\n"
-
-    // inputs
-    "varying vec2 vModelSpaceCenterToPos;\n"
-    "varying vec2 vScreenSpaceVelocityVector;\n"
-    "varying float vSpeed;\n"
-
-    "void main()\n"
-    "{\n"
-    // calculate an alpha value that will fade the object towards its extremities, we need this to avoid an unsightly hard edge between color values of
-    // the stretched object and the background. Use smoothstep also to hide any hard edges (discontinuities) in rate of change of this alpha gradient
-    " vec2 centerToPixel = abs( vModelSpaceCenterToPos );\n"
-    " vec2 fadeToEdges = smoothstep(0.0, 1.0, 1.0 - ((centerToPixel - uObjectFadeStart) / (uObjectFadeEnd - uObjectFadeStart)));\n"
-    " float fadeToEdgesScale = fadeToEdges.x * fadeToEdges.y * uAlphaScale;\n" // apply global scaler
-    " fadeToEdgesScale = mix(1.0, fadeToEdgesScale, vSpeed);\n" // fade proportional to speed, so opaque when at rest
-
-    // standard actor texel
-    " vec4 colActor = texture2D(sTexture, vTexCoord);\n"
-    " gl_FragColor = colActor;\n"
-    " gl_FragColor.a *= fadeToEdgesScale;\n" // fade actor to its edges based on speed of motion
-    " gl_FragColor *= uColor;\n"
-    "}";
-
-  // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
-  ShaderEffect shader = ShaderEffect::New(
-    vertexSource, fragmentSource, GeometryType( GEOMETRY_TYPE_IMAGE ),
-    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ) );
-
-
-
-  MotionStretchEffect handle( shader );
-
-
-  //////////////////////////////////////
-  // Register uniform properties
-  //
-  //
-
-  // factors that scale the look, defaults
-  handle.SetUniform( MOTION_STRETCH_GEOMETRY_STRETCH_SCALING_FACTOR_PROPERTY_NAME, MOTION_STRETCH_GEOM_STRETCH_SCALING_FACTOR );
-  handle.SetUniform( MOTION_STRETCH_SPEED_SCALING_FACTOR_PROPERTY_NAME, MOTION_STRETCH_SPEED_SCALING_FACTOR );
-  handle.SetUniform( MOTION_STRETCH_OBJECT_FADE_START_PROPERTY_NAME, MOTION_STRETCH_OBJECT_FADE_START );
-  handle.SetUniform( MOTION_STRETCH_OBJECT_FADE_END_PROPERTY_NAME, MOTION_STRETCH_OBJECT_FADE_END );
-  handle.SetUniform( MOTION_STRETCH_ALPHA_SCALE_PROPERTY_NAME, MOTION_STRETCH_ALPHA_SCALE );
-  handle.SetUniform( MOTION_STRETCH_MODELVIEW_LASTFRAME, Matrix::IDENTITY );
-
-  return handle;
-}
-
-void MotionStretchEffect::SetGeometryStretchFactor( float scalingFactor )
-{
-  SetUniform( MOTION_STRETCH_GEOMETRY_STRETCH_SCALING_FACTOR_PROPERTY_NAME, scalingFactor );
-}
-
-void MotionStretchEffect::SetSpeedScalingFactor( float scalingFactor )
-{
-  SetUniform( MOTION_STRETCH_SPEED_SCALING_FACTOR_PROPERTY_NAME, scalingFactor );
-}
-
-void MotionStretchEffect::SetObjectFadeStart( Vector2 displacement )
-{
-  SetUniform( MOTION_STRETCH_OBJECT_FADE_START_PROPERTY_NAME, displacement );
-}
-
-void MotionStretchEffect::SetObjectFadeEnd( Vector2 displacement )
-{
-  SetUniform( MOTION_STRETCH_OBJECT_FADE_END_PROPERTY_NAME, displacement );
-}
-
-void MotionStretchEffect::SetAlphaScale( float alphaScale )
-{
-  SetUniform( MOTION_STRETCH_ALPHA_SCALE_PROPERTY_NAME, alphaScale );
-}
-
-const std::string& MotionStretchEffect::GetGeometryStretchFactorPropertyName() const
-{
-  return MOTION_STRETCH_GEOMETRY_STRETCH_SCALING_FACTOR_PROPERTY_NAME;
-}
-
-const std::string& MotionStretchEffect::GetSpeedScalingFactorPropertyName() const
-{
-  return MOTION_STRETCH_SPEED_SCALING_FACTOR_PROPERTY_NAME;
-}
-
-const std::string& MotionStretchEffect::GetObjectFadeStartPropertyName() const
-{
-  return MOTION_STRETCH_OBJECT_FADE_START_PROPERTY_NAME;
-}
-
-const std::string& MotionStretchEffect::GetObjectFadeEndPropertyName() const
-{
-  return MOTION_STRETCH_OBJECT_FADE_END_PROPERTY_NAME;
-}
-
-const std::string& MotionStretchEffect::GetAlphaScalePropertyName() const
-{
-  return MOTION_STRETCH_ALPHA_SCALE_PROPERTY_NAME;
-}
-
-}
-
-}
index 5cc7bcf..e16e2ef 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/renderable-actor.h>
+#include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/shader-effects/shader-effect.h>
 
 namespace Dali
@@ -29,136 +29,180 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new MotionStretchEffect
  *
- * Class for motion stretch shader that works on a per object basis. Objects will stretch in the direction of motion when they move, or if the camera moves. Can be applied
+ * Motion stretch shader works on a per object basis. Objects will stretch in the direction of motion when they move, or if the camera moves. Can be applied
  * to ImageActor or TextActor only.
  *
  * Usage example:-
  *
  * // Create shader used for doing motion stretch\n
- * MotionStretchEffect MotionStretchEffect = MotionStretchEffect::New();
+ * ShaderEffect MotionStretchEffect = CreateMotionStretchEffect();
  *
  * // set actor shader to the stretch one\n
- * Actor Actor = Actor::New( ... );\n
- * Actor.SetShaderEffect( MotionStretchEffect );
+ * Actor actor = Actor::New( ... );\n
+ * actor.SetShaderEffect( MotionStretchEffect );
  *
+ * // Constrain "uModelLastFrame" to be the same as the actor's world matrix\n
+ * Dali::Property::Index uModelProperty = MotionBlurEffect.GetPropertyIndex( "uModelLastFrame" );
+ * Constraint constraint = Constraint::New<Matrix>( MotionBlurEffect, uModelProperty, EqualToConstraint() );\n
+ * constraint.AddSource( Source( actor , Actor::Property::WORLD_MATRIX ) );\n
+ * constraint.Apply();\n
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uGeometryStretchFactor"  - This scales the amount the geometry stretches along the motion velocity vector.
+ *                              A smaller value means the geometry stretches less, larger it stretches more. Default 0.5.
+ *  "uSpeedScalingFactor"     - This value is used to control how much to fade the actor near the edges, based on the
+ *                              speed the actor is moving. When the actor is at rest this is not applied. Default 0.5.
+ *  "uObjectFadeStart"        - The displacement from the centre of the actor that the actor will start to fade towards
+ *                              its edges. This is used to prevent an unsightly hard edge between the stretched actor and
+ *                              the scene. Depends on the values of the vertices in the vertex stream. When the actor is at
+ *                              rest this is not applied. Default Vector2(0.25, 0.25), which is half way towards the edge for
+ *                              an ImageRenderer::QUAD.
+ *  "uObjectFadeEnd"          - The displacement from the centre of the actor that the actor will finish fading towards its edges.
+ *                              This is used to prevent an unsightly hard edge between the stretched actor and the scene. Depends
+ *                              on the values of the vertices in the vertex stream. When the actor is at rest this is not applied.
+ *                              Default 0.5, which is all the way towards the edge for an ImageRenderer::QUAD.
+ *  "uAlphaScale"             - Global scaler applied to the alpha of the actor. Used to make the stretched actor a bit more subtle
+ *                              and reveal a bit of the background behind it as it moves. When the actor is at rest this is not
+ *                              applied. Default 0.75.
+ *  "uModelLastFrame"         - The model to world space transformation matrix of the actor in the previous frame.
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API MotionStretchEffect : public ShaderEffect
+inline ShaderEffect CreateMotionStretchEffect()
 {
-
-public:
-
-  /**
-   * Create an uninitialized MotionStretchEffect; this can be initialized with MotionStretchEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  MotionStretchEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~MotionStretchEffect();
-
-  /**
-   * Create an initialized MotionStretchEffect
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static MotionStretchEffect New();
-
-  /**
-   * Create a  MotionStretchEffect and attach it to the specified actor
-   * @param renderable actor to apply the effect to
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static MotionStretchEffect Apply( RenderableActor renderable );
-
-  /**
-   * Set geometry stretch factor property. This scales the amount the geometry
-   * stretches along the motion velocity vector. A smaller value means the geometry
-   * stretches less, larger it stretches more. Default 0.5.
-   * @param scalingFactor The scaling factor that extrudes the geometry forwards along the motion velocity vector.
-   */
-  void SetGeometryStretchFactor( float scalingFactor );
-
-  /**
-   * Set speed scaling factor property. This value is used to control how much
-   * to fade the actor near the edges, based on the speed the actor is moving.
-   * When the actor is at rest this is not applied. Default 0.5.
-   * @param scalingFactor The scaling factor that controls the edge fade of the actor.
-   */
-  void SetSpeedScalingFactor( float scalingFactor );
-
-  /**
-   * Set the displacement from the centre of the actor that the actor will start to
-   * fade towards its edges. This is used to prevent an unsightly hard edge
-   * between the stretched actor and the scene. Depends on the values of the
-   * vertices in the vertex stream. When the actor is at rest this is not applied.
-   * Default Vector2(0.25, 0.25), which is half way towards the edge for an ImageRenderer::QUAD.
-   * @param displacement The displacement from the centre of the actor that the actor will start to edge fade.
-   */
-  void SetObjectFadeStart( Vector2 displacement );
-
-  /**
-   * Set the displacement from the centre of the actor that the actor will
-   * finish fading towards its edges. This is used to prevent an unsightly hard
-   * edge between the stretched actor and the scene. Depends on the values of
-   * the vertices in the vertex stream. When the actor is at rest this is not applied.
-   * Default 0.5, which is all the way towards the edge for an ImageRenderer::QUAD.
-   * @param displacement The displacement from the centre of the actor that the actor will finish edge fading.
-   */
-  void SetObjectFadeEnd( Vector2 displacement );
-
-  /**
-   * Set a global scaler applied to the alpha of the actor. Used to make the
-   * stretched actor a bit more subtle and reveal a bit of the background behind
-   * it as it moves. When the actor is at rest this is not applied. Default 0.75.
-   * @param alphaScale The scaling factor which multiplies the alpha of each pixel of the actor.
-   */
-  void SetAlphaScale( float alphaScale );
-
-
-  /**
-   * Get the name for the texcoord scale property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetTexcoordScalePropertyName() const;
-
-  /**
-   * Get the name for the geometry stretching property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetGeometryStretchFactorPropertyName() const;
-
-  /**
-   * Get the name for the speed scaling property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetSpeedScalingFactorPropertyName() const;
-
-  /**
-   * Get the name for the fade start X property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetObjectFadeStartPropertyName() const;
-
-  /**
-   * Get the name for the fade end X property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetObjectFadeEndPropertyName() const;
-
-  /**
-   * Get the name for the alpha scale property. Useful for animation.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAlphaScalePropertyName() const;
-
-private:
-  // Not intended for application developers
-  DALI_INTERNAL MotionStretchEffect( ShaderEffect handle );
-};
+  // Dali vertexSource prefix for reference:
+  // precision highp float;
+  // attribute vec3  aPosition;
+  // attribute vec2  aTexCoord;
+  // uniform   mat4  uMvpMatrix;
+  // uniform   mat4  uModelView;
+  // uniform   mat3  uNormalMatrix;
+  // uniform   mat4  uProjection;
+  // uniform   vec4  uColor;
+  // varying   vec2  vTexCoord;
+  std::string vertexSource;
+  vertexSource =
+      "precision mediump float;\n"
+      "uniform mat4  uModelLastFrame;\n"
+      "uniform float uTimeDelta;\n"
+
+      "uniform float uGeometryStretchFactor;\n"
+      "uniform float uSpeedScalingFactor;\n"
+
+      // outputs
+      "varying vec2 vModelSpaceCenterToPos;\n"
+      "varying vec2 vScreenSpaceVelocityVector;\n"
+      "varying float vSpeed;\n"
+
+      "void main()\n"
+      "{\n"
+      // get view space position of vertex this frame and last frame
+      " vec4 vertex = vec4(aPosition, 1.0);\n"
+      " vec4 viewSpaceVertex = uModelView * vertex;\n"
+      " vec4 viewSpaceVertexLastFrame = uViewMatrix * uModelLastFrame * vertex;\n"
+
+      // work out vertex's last movement in view space
+      " vec3 viewSpacePosDelta = viewSpaceVertex.xyz - viewSpaceVertexLastFrame.xyz;\n"
+      " float reciprocalTimeDelta = 1.0 / ((uTimeDelta > 0.0) ? uTimeDelta : 0.01);\n"
+
+      // get clip space position of vertex this frame and last frame
+      " vec4 clipSpaceVertex = uMvpMatrix * vertex;\n"
+      " vec4 clipSpaceVertexLastFrame = uProjection * viewSpaceVertexLastFrame;\n"
+
+      // decide how much this vertex is 'trailing', i.e. at the back of the object relative to its direction of motion. We do this
+      // by assuming the objects model space origin is at its center and taking the dot product of the vector from center to vertex with the motion direction
+      " float t = 0.0;\n"
+      " float posDeltaLength = length(viewSpacePosDelta);\n"
+      " if(posDeltaLength > 0.001)\n" // avoid div by 0 if object has barely moved
+      " {\n"
+      "   vec4 viewSpaceCenterToPos = uModelView * vec4(aPosition, 0.0);\n"
+      "   float centerToVertexDist = length(viewSpaceCenterToPos);\n"
+      "   if(centerToVertexDist > 0.001)\n" // avoid div by 0 if object has vertex at model space origin
+      "   {\n"
+      "     vec3 viewSpacePosDeltaNormalised = viewSpacePosDelta / posDeltaLength;\n"
+      "     vec3 viewSpaceCenterToPosNormalised = viewSpaceCenterToPos.xyz / centerToVertexDist;\n"
+      "     t = (dot(viewSpacePosDeltaNormalised, viewSpaceCenterToPosNormalised) * 0.5 ) + 0.5;\n" // scale and bias from [-1..1] to [0..1]
+      "   }\n"
+      " }\n"
+      // output vertex position lerped with its last position, based on how much it is trailing,
+      // this stretches the geom back along where it has just been, giving a warping effect
+      // We raise t to a power in order that non-trailing vertices are effected much more than trailing ones
+      // Note: we must take account of time delta to convert position delta into a velocity, so changes are smooth (take into account frame time correctly)
+      " gl_Position = mix(clipSpaceVertexLastFrame, clipSpaceVertex, t * t * t * uGeometryStretchFactor * reciprocalTimeDelta);\n"
+
+      // work out vertex's last movement in normalised device coordinates [-1..1] space, i.e. perspective divide
+      " vec2 ndcVertex = clipSpaceVertex.xy / clipSpaceVertex.w;\n"
+      " vec2 ndcVertexLastFrame = clipSpaceVertexLastFrame.xy / clipSpaceVertexLastFrame.w;\n"
+      // scale and bias so that a value of 1.0 corresponds to screen size (NDC is [-1..1] = 2)
+      " vScreenSpaceVelocityVector = ((ndcVertex - ndcVertexLastFrame) * 0.5 * reciprocalTimeDelta);\n"
+      " vScreenSpaceVelocityVector.y = -vScreenSpaceVelocityVector.y;\n" // TODO negated due to y being inverted in our coordinate system?
+      // calculate a scaling factor proportional to velocity, which we can use to tweak how things look
+      " vSpeed = length(vScreenSpaceVelocityVector) * uSpeedScalingFactor;\n"
+      " vSpeed = clamp(vSpeed, 0.0, 1.0);\n"
+
+      // provide fragment shader with vector from center of object to pixel (assumes the objects model space origin is at its center and verts have same z)
+      " vModelSpaceCenterToPos = aPosition.xy;\n"
+
+      " vTexCoord = aTexCoord;\n"
+      "}\n";
+
+
+  // Dali fragmentSource prefix for reference:
+  // precision highp     float;
+  // uniform   sampler2D sTexture;
+  // uniform   sampler2D sEffect;
+  // uniform   vec4      uColor;
+  // varying   vec2      vTexCoord;
+  std::string fragmentSource;
+  fragmentSource =
+      "precision mediump float;\n"
+
+      "uniform vec2 uObjectFadeStart;\n"
+      "uniform vec2 uObjectFadeEnd;\n"
+      "uniform float uAlphaScale;\n"
+
+      // inputs
+      "varying vec2 vModelSpaceCenterToPos;\n"
+      "varying vec2 vScreenSpaceVelocityVector;\n"
+      "varying float vSpeed;\n"
+
+      "void main()\n"
+      "{\n"
+      // calculate an alpha value that will fade the object towards its extremities, we need this to avoid an unsightly hard edge between color values of
+      // the stretched object and the background. Use smoothstep also to hide any hard edges (discontinuities) in rate of change of this alpha gradient
+      " vec2 centerToPixel = abs( vModelSpaceCenterToPos );\n"
+      " vec2 fadeToEdges = smoothstep(0.0, 1.0, 1.0 - ((centerToPixel - uObjectFadeStart) / (uObjectFadeEnd - uObjectFadeStart)));\n"
+      " float fadeToEdgesScale = fadeToEdges.x * fadeToEdges.y * uAlphaScale;\n" // apply global scaler
+      " fadeToEdgesScale = mix(1.0, fadeToEdgesScale, vSpeed);\n" // fade proportional to speed, so opaque when at rest
+
+      // standard actor texel
+      " vec4 colActor = texture2D(sTexture, vTexCoord);\n"
+      " gl_FragColor = colActor;\n"
+      " gl_FragColor.a *= fadeToEdgesScale;\n" // fade actor to its edges based on speed of motion
+      " gl_FragColor *= uColor;\n"
+      "}";
+
+  // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
+  ShaderEffect shaderEffect = ShaderEffect::New(
+      vertexSource, fragmentSource,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ) );
+
+
+  //////////////////////////////////////
+  // Register uniform properties
+  //
+  //
+  shaderEffect.SetUniform( "uGeometryStretchFactor",  0.5f );
+  shaderEffect.SetUniform( "uSpeedScalingFactor",     0.5f );
+  shaderEffect.SetUniform( "uObjectFadeStart",        Vector2( 0.25f, 0.25f ) );
+  shaderEffect.SetUniform( "uObjectFadeEnd",          Vector2( 0.5f, 0.5f ) );
+  shaderEffect.SetUniform( "uAlphaScale",             0.75f );
+  shaderEffect.SetUniform( "uModelLastFrame",         Matrix::IDENTITY );
+
+  return shaderEffect;
+}
 
 }
 
diff --git a/dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.cpp b/dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.cpp
deleted file mode 100644 (file)
index e7c69d5..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/object/property-input.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
-#include <dali/public-api/images/resource-image.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace NinePatchMaskEffect
-{
-
-namespace
-{
-
-void NinePatchMaskEffectSizeConstraint( Vector2& current, const PropertyInputContainer& inputs )
-{
-  const Vector3& actorSize = inputs[0]->GetVector3();
-  current.x = actorSize.x;
-  current.y = actorSize.y;
-}
-
-} // unnamed namespace
-
-static void DoApply( ImageActor actor, const std::string& maskImage, const Vector2& maskSize, Vector4 maskBorder )
-{
-  const char* ALPHA_MASK_VERTEX_SHADER_SOURCE =
-  "precision mediump float;\n"
-  "uniform vec2 uImageSize;                                                       \n"
-  "uniform vec2 uMaskSize;                                                        \n"
-  "varying vec2 vMaskTexCoord;                                                    \n"
-  "                                                                               \n"
-  "void main()                                                                    \n"
-  "{                                                                              \n"
-  "  gl_Position = uMvpMatrix * vec4(aPosition, 1.0);                             \n"
-  "                                                                               \n"
-  "  // Ignore mask UVs for image                                                 \n"
-  "                                                                               \n"
-  "  highp vec2 halfImageSize = uImageSize * 0.5;                                 \n"
-  "  vTexCoord = (aPosition.xy + halfImageSize) / uImageSize;                     \n"
-  "                                                                               \n"
-  "  // UVs were calculated for image size, so convert for mask size              \n"
-  "                                                                               \n"
-  "  highp vec2 halfMaskSize  = uMaskSize * 0.5;                                  \n"
-  "  highp vec2 halfSizeDelta = halfImageSize - halfMaskSize;                     \n"
-  "                                                                               \n"
-  "  highp vec2 maskPosition = aPosition.xy;                                      \n"
-  "  maskPosition.x -= halfSizeDelta.x * sign(aPosition.x);                       \n"
-  "  maskPosition.y -= halfSizeDelta.y * sign(aPosition.y);                       \n"
-  "                                                                               \n"
-  "  vMaskTexCoord = (maskPosition + halfMaskSize) / uMaskSize;                   \n"
-  "}                                                                              \n";
-
-  const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE =
-  "varying mediump vec2 vMaskTexCoord;                                            \n"
-  "                                                                               \n"
-  "void main()                                                                    \n"
-  "{                                                                              \n"
-  "  highp vec4 mask = texture2D(sEffect, vMaskTexCoord);                         \n"
-  "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(1,1,1,mask.a); \n"
-  "}                                                                              \n";
-
-  ShaderEffect maskEffect = ShaderEffect::New(
-    ALPHA_MASK_VERTEX_SHADER_SOURCE,
-    ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
-    GeometryType( GEOMETRY_TYPE_IMAGE ),
-    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
-
-  maskEffect.SetEffectImage( ResourceImage::New( maskImage ) );
-
-  maskEffect.SetUniform( "uImageSize", Vector2(0,0) /*Constrained to actor size*/ );
-
-  Constraint constraint = Constraint::New<Vector2>( maskEffect, maskEffect.GetPropertyIndex("uImageSize"), NinePatchMaskEffectSizeConstraint );
-  constraint.AddSource( Source(actor, Actor::Property::SIZE) );
-  constraint.Apply();
-
-  maskEffect.SetUniform( "uMaskSize", maskSize );
-
-  // Actor must provide nine-patch style geometry for this effect to work
-  actor.SetStyle( ImageActor::STYLE_NINE_PATCH );
-  actor.SetNinePatchBorder( maskBorder );
-
-  actor.SetShaderEffect( maskEffect );
-}
-
-void Apply( ImageActor actor, const std::string& maskImage )
-{
-  const Uint16Pair maskSize = ResourceImage::GetImageSize( maskImage );
-
-  const float leftRight = (maskSize.GetWidth()  - 1.0f) * 0.5f;
-  const float topBottom = (maskSize.GetHeight() - 1.0f) * 0.5f;
-
-  DoApply( actor, maskImage, Vector2( maskSize.GetWidth(), maskSize.GetHeight() ), Vector4( leftRight, topBottom, leftRight, topBottom ) );
-}
-
-void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder )
-{
-  const Uint16Pair maskSize = ResourceImage::GetImageSize( maskImage );
-
-  DoApply( actor, maskImage, Vector2( maskSize.GetWidth(), maskSize.GetHeight() ), maskBorder );
-}
-
-} // namespace NinePatchMaskEffect
-
-} // namespace Toolkit
-
-} // namespace Dali
index 0b21228..931e5cd 100644 (file)
@@ -45,6 +45,73 @@ namespace Toolkit
 namespace NinePatchMaskEffect
 {
 
+static void NinePatchMaskEffectSizeConstraint( Vector2& current, const PropertyInputContainer& inputs )
+{
+  const Vector3& actorSize = inputs[0]->GetVector3();
+  current.x = actorSize.x;
+  current.y = actorSize.y;
+}
+
+inline void DoApply( ImageActor actor, const std::string& maskImage, const Vector2& maskSize, Vector4 maskBorder )
+{
+  const char* ALPHA_MASK_VERTEX_SHADER_SOURCE =
+  "precision mediump float;\n"
+  "uniform vec2 uImageSize;                                                       \n"
+  "uniform vec2 uMaskSize;                                                        \n"
+  "varying vec2 vMaskTexCoord;                                                    \n"
+  "                                                                               \n"
+  "void main()                                                                    \n"
+  "{                                                                              \n"
+  "  gl_Position = uMvpMatrix * vec4(aPosition, 1.0);                             \n"
+  "                                                                               \n"
+  "  // Ignore mask UVs for image                                                 \n"
+  "                                                                               \n"
+  "  highp vec2 halfImageSize = uImageSize * 0.5;                                 \n"
+  "  vTexCoord = (aPosition.xy + halfImageSize) / uImageSize;                     \n"
+  "                                                                               \n"
+  "  // UVs were calculated for image size, so convert for mask size              \n"
+  "                                                                               \n"
+  "  highp vec2 halfMaskSize  = uMaskSize * 0.5;                                  \n"
+  "  highp vec2 halfSizeDelta = halfImageSize - halfMaskSize;                     \n"
+  "                                                                               \n"
+  "  highp vec2 maskPosition = aPosition.xy;                                      \n"
+  "  maskPosition.x -= halfSizeDelta.x * sign(aPosition.x);                       \n"
+  "  maskPosition.y -= halfSizeDelta.y * sign(aPosition.y);                       \n"
+  "                                                                               \n"
+  "  vMaskTexCoord = (maskPosition + halfMaskSize) / uMaskSize;                   \n"
+  "}                                                                              \n";
+
+  const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE =
+  "varying mediump vec2 vMaskTexCoord;                                            \n"
+  "                                                                               \n"
+  "void main()                                                                    \n"
+  "{                                                                              \n"
+  "  highp vec4 mask = texture2D(sEffect, vMaskTexCoord);                         \n"
+  "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(1,1,1,mask.a); \n"
+  "}                                                                              \n";
+
+  ShaderEffect maskEffect = ShaderEffect::New(
+    ALPHA_MASK_VERTEX_SHADER_SOURCE,
+    ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
+    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+
+  maskEffect.SetEffectImage( ResourceImage::New( maskImage ) );
+
+  maskEffect.SetUniform( "uImageSize", Vector2(0,0) /*Constrained to actor size*/ );
+
+  Constraint constraint = Constraint::New<Vector2>( maskEffect, maskEffect.GetPropertyIndex("uImageSize"), NinePatchMaskEffectSizeConstraint );
+  constraint.AddSource( Source(actor, Actor::Property::SIZE) );
+  constraint.Apply();
+
+  maskEffect.SetUniform( "uMaskSize", maskSize );
+
+  // Actor must provide nine-patch style geometry for this effect to work
+  actor.SetStyle( ImageActor::STYLE_NINE_PATCH );
+  actor.SetNinePatchBorder( maskBorder );
+
+  actor.SetShaderEffect( maskEffect );
+}
+
 /**
  * @brief Apply the mask effect to an ImageActor.
  *
@@ -52,7 +119,15 @@ namespace NinePatchMaskEffect
  * @param [in] actor The actor which needs the effect. To remove the effect call actor.RemoveShaderEffect().
  * @param [in] maskImage The path to a file containing the mask. The center pixels of the mask will be stretched.
  */
-DALI_IMPORT_API void Apply( ImageActor actor, const std::string& maskImage );
+inline void Apply( ImageActor actor, const std::string& maskImage )
+{
+  const Uint16Pair maskSize = ResourceImage::GetImageSize( maskImage );
+
+  const float leftRight = (maskSize.GetWidth()  - 1.0f) * 0.5f;
+  const float topBottom = (maskSize.GetHeight() - 1.0f) * 0.5f;
+
+  DoApply( actor, maskImage, Vector2( maskSize.GetWidth(), maskSize.GetHeight() ), Vector4( leftRight, topBottom, leftRight, topBottom ) );
+}
 
 /**
  * @brief Apply the mask effect to an ImageActor.
@@ -62,7 +137,12 @@ DALI_IMPORT_API void Apply( ImageActor actor, const std::string& maskImage );
  * @param [in] maskImage The path to a file containing the mask.
  * @param [in] maskBorder Specifies the part of the mask image that will be stretched (left, top, right, bottom).
  */
-DALI_IMPORT_API void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder );
+inline void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder )
+{
+  const Uint16Pair maskSize = ResourceImage::GetImageSize( maskImage );
+
+  DoApply( actor, maskImage, Vector2( maskSize.GetWidth(), maskSize.GetHeight() ), maskBorder );
+}
 
 } // namespace NinePatchMaskEffect
 
diff --git a/dali-toolkit/devel-api/shader-effects/overlay-effect.cpp b/dali-toolkit/devel-api/shader-effects/overlay-effect.cpp
deleted file mode 100644 (file)
index c5eb1fc..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/overlay-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-OverlayEffect::OverlayEffect()
-{
-}
-
-OverlayEffect::~OverlayEffect()
-{
-}
-
-OverlayEffect OverlayEffect::New( Image overlayImage )
-{
-  // (Target > 0.5) * (1 - (1-2*(Target-0.5)) * (1-Blend)) + (Target <= 0.5) * ((2*Target) * Blend)
-  const char* OVERLAY_FRAGMENT_SHADER_SOURCE =
-  "void main()\n"
-  "{\n"
-  "  lowp vec4 target = texture2D(sTexture, vTexCoord);\n"
-  "  lowp vec4 overlay = texture2D(sEffect, vTexCoord);\n"
-  "  if ( length( target.rgb ) > 0.5 )\n"
-  "  {\n"
-  "    gl_FragColor = vec4( mix( target.rgb, 1.0 - ( 1.0 - 2.0 * ( target.rgb - 0.5 ) )  * ( 1.0 - overlay.rgb ), overlay.a ), min( 1.0, target.a + overlay.a ) );\n"
-  "  }\n"
-  "  else\n"
-  "  {\n"
-  "    gl_FragColor = vec4( mix( target.rgb, 2.0 * target.rgb * overlay.rgb, overlay.a ), target.a + overlay.a );\n"
-  "  }\n"
-  "}\n";
-
-  ShaderEffect shader = ShaderEffect::New( "", // Use default
-                                           OVERLAY_FRAGMENT_SHADER_SOURCE,
-                                           GeometryType( GEOMETRY_TYPE_IMAGE ),
-                                           ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
-
-  shader.SetEffectImage( overlayImage );
-
-  return OverlayEffect( shader );
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-OverlayEffect::OverlayEffect( ShaderEffect handle )
-: ShaderEffect( handle )
-{
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index ece950b..f013b25 100644 (file)
@@ -29,41 +29,47 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new OverlayEffect
+ *
  * OverlayEffect is used to apply an overlay image to the actor.
  * Typically overlay images should be the same size as the main image being viewed, but this isn't essential.
  *
  * Usage example:
  *
  *   ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) );
- *   OverlayEffect overlayEffect = OverlayEffect::New( Image::New( OVERLAY_IMAGE_PATH ) );
+ *   ShaderEffect overlayEffect = CreateOverlayEffect( Image::New( OVERLAY_IMAGE_PATH ) );
  *   actor.SetShaderEffect( overlayEffect );
+ *
+ *   @param[in] overlayImage The image to overlay on top of the actor
+ *   @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API OverlayEffect : public ShaderEffect
+inline ShaderEffect CreateOverlayEffect(Image overlayImage)
 {
-public:
-
-  /**
-   * Create an empty OverlayEffect handle.
-   */
-  OverlayEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~OverlayEffect();
+  // (Target > 0.5) * (1 - (1-2*(Target-0.5)) * (1-Blend)) + (Target <= 0.5) * ((2*Target) * Blend)
+  const char* OVERLAY_FRAGMENT_SHADER_SOURCE =
+      "void main()\n"
+      "{\n"
+      "  lowp vec4 target = texture2D(sTexture, vTexCoord);\n"
+      "  lowp vec4 overlay = texture2D(sEffect, vTexCoord);\n"
+      "  if ( length( target.rgb ) > 0.5 )\n"
+      "  {\n"
+      "    gl_FragColor = vec4( mix( target.rgb, 1.0 - ( 1.0 - 2.0 * ( target.rgb - 0.5 ) )  * ( 1.0 - overlay.rgb ), overlay.a ), min( 1.0, target.a + overlay.a ) );\n"
+      "  }\n"
+      "  else\n"
+      "  {\n"
+      "    gl_FragColor = vec4( mix( target.rgb, 2.0 * target.rgb * overlay.rgb, overlay.a ), target.a + overlay.a );\n"
+      "  }\n"
+      "}\n";
 
-  /**
-   * Create a OverlayEffect.
-   * @return A handle to a newly allocated OverlayEffect.
-   */
-  static OverlayEffect New( Image overlayImage );
+  ShaderEffect shaderEffect = ShaderEffect::New(
+      "", // Use default
+      OVERLAY_FRAGMENT_SHADER_SOURCE,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
 
-private: // Not intended for application developers
+  shaderEffect.SetEffectImage( overlayImage );
 
-  DALI_INTERNAL OverlayEffect( ShaderEffect handle );
-};
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.cpp b/dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.cpp
deleted file mode 100644 (file)
index 08d77a6..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/common/stage.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string SHADOW_WIDTH_PROPERTY_NAME("uShadowWidth");
-const std::string SPINE_SHADOW_PARAMETER_PROPERTY_NAME("uSpineShadowParameter");
-const std::string IS_BACK_IMAGE_VISIBLE_PROPERTY_NAME( "uIsBackImageVisible" );
-const std::string PAGE_WIDTH_PROPERTY_NAME( "uPageWidth" );
-
-// fake shadow is used to enhance the effect, with its default maximum width to be pageSize * 0.15
-const float DEFAULT_SHADOW_WIDTH(0.15f);
-
-// the major&minor radius (in pixels) to form an ellipse shape
-// the top-left quarter of this ellipse is used to calculate spine normal for simulating shadow
-const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
-
-}
-
-PageTurnBookSpineEffect::PageTurnBookSpineEffect()
-{
-}
-
-PageTurnBookSpineEffect::PageTurnBookSpineEffect( ShaderEffect handle )
-: ShaderEffect( handle )
-{
-}
-
-PageTurnBookSpineEffect::~PageTurnBookSpineEffect()
-{
-}
-
-PageTurnBookSpineEffect PageTurnBookSpineEffect::New()
-{
-  std::string vertexSource(
-  "precision mediump float;\n"
-  "uniform float uShadowWidth;\n"
-  "  void main()\n"
-  "  {\n"
-  "    gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
-  "    vTexCoord.x = (aTexCoord.x-sTextureRect.s) /( 1.0 - uShadowWidth ) + sTextureRect.s;\n"
-  "    vTexCoord.y = ( aTexCoord.y-sTextureRect.t-0.5*uShadowWidth*(sTextureRect.q-sTextureRect.t) )/( 1.0 - uShadowWidth ) + sTextureRect.t;\n"
-  "  }");
-
-  // the simplified version of the fragment shader of page turn effect
-  std::string fragmentSource(
-  "precision mediump float;\n"
-  "uniform float uIsBackImageVisible;\n"
-  "uniform float uPageWidth;\n"
-  "uniform vec2 uSpineShadowParameter;\n"
-  "  void main()\n"
-  "  {\n"
-      // leave the border for display shadow, not visible( out of the screen ) when the page is static
-  "    if( vTexCoord.y > sTextureRect.q || vTexCoord.y < sTextureRect.t || vTexCoord.x > sTextureRect.p  )\n"
-  "    {\n"
-  "      gl_FragColor = vec4( 0.0 );\n"
-  "    }\n"
-  "    else \n"
-  "    { \n"
-         // flip the image horizontally by changing the x component of the texture coordinate
-  "      if( uIsBackImageVisible == 1.0 )  gl_FragColor = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) ) * uColor; \n"
-  "      else gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n"
-  "      \n"
-         // display book spine, a stripe of shadowed texture
-  "      float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageWidth; \n"
-  "      if(pixelPos < uSpineShadowParameter.x) \n"
-  "      {\n"
-  "        float x = pixelPos - uSpineShadowParameter.x;\n"
-  "        float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x );\n"
-  "        vec2 spineNormal = normalize(vec2(uSpineShadowParameter.y*x/uSpineShadowParameter.x, y));\n"
-  "        gl_FragColor.rgb *= spineNormal.y; \n"
-  "      }"
-  "    }\n"
-  "  }" );
-
-  ShaderEffect shader;
-  shader = ShaderEffect::New( vertexSource, fragmentSource );
-  PageTurnBookSpineEffect handle( shader );
-  handle.SetUniform( IS_BACK_IMAGE_VISIBLE_PROPERTY_NAME, -1.f );
-  handle.SetUniform( SHADOW_WIDTH_PROPERTY_NAME, DEFAULT_SHADOW_WIDTH );
-  handle.SetUniform( SPINE_SHADOW_PARAMETER_PROPERTY_NAME, DEFAULT_SPINE_SHADOW_PARAMETER );
-  float defaultPageWidth = Dali::Stage::GetCurrent().GetSize().x;
-  handle.SetUniform( PAGE_WIDTH_PROPERTY_NAME, defaultPageWidth/(1.f-DEFAULT_SHADOW_WIDTH) );
-  return handle;
-}
-
-void PageTurnBookSpineEffect::SetIsBackImageVisible( bool isBackVisible )
-{
-  float direction = isBackVisible ? 1.0f : -1.0f;
-  SetUniform( IS_BACK_IMAGE_VISIBLE_PROPERTY_NAME, direction );
-}
-
-void PageTurnBookSpineEffect::SetPageWidth( float pageWidth )
-{
-  SetUniform( PAGE_WIDTH_PROPERTY_NAME, pageWidth );
-}
-
-void PageTurnBookSpineEffect::SetShadowWidth( float shadowWidth )
-{
-  SetUniform( SHADOW_WIDTH_PROPERTY_NAME, shadowWidth );
-}
-
-void PageTurnBookSpineEffect::SetSpineShadowParameter( const Vector2& spineShadowParameter )
-{
-  SetUniform( SPINE_SHADOW_PARAMETER_PROPERTY_NAME, spineShadowParameter);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.h b/dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.h
deleted file mode 100644 (file)
index cb41e99..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__
-#define __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__
-
-/*
- * Copyright (c) 2015 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 <dali/public-api/shader-effects/shader-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-/**
- * @brief This is an assisting effect of PageTurnEffect to display a book spine on _static_ pages, and also to flip the image horizontally when needed.
- *
- * When the page is turned over in landscape, call
- * SetIsBackImageVisible(true), this effect can display the back image
- * correctly after the imageActor been rotated 180 degrees.  To
- * display the pages visually consistent with its turning state,
- * please set the uniforms with the same values as the PageTurnEffect.
- **/
-class DALI_IMPORT_API PageTurnBookSpineEffect : public ShaderEffect
-{
-public:
-  /**
-   * @brief Create an uninitialized PageTurnBookSpineEffect; this can be initialized with PageTurnBookSpineEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  PageTurnBookSpineEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~PageTurnBookSpineEffect();
-
-  /**
-   * @brief Create an initialized PageTurnBookSpineEffect.
-   *
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static PageTurnBookSpineEffect New();
-
-  /**
-   * @brief Set whether the current page is with its backside visible.
-   *
-   * Need to pass the parameter as true for the page which is turned over but still visible in Landscape
-   * @param [in] isBackVisible True for page with its backside upwards
-   */
-  void SetIsBackImageVisible( bool isBackVisible );
-
-  /**
-   * @brief Set the page width of the PageTurnBookSpineEffect.
-   *
-   * @param [in] pageWidth The width of the page size.
-   */
-  void SetPageWidth( float pageWidth );
-
-  /**
-   * @brief Set the width of shadow to be pageSize * shadowWidth.
-   *
-   * this shadow appears at the edges of the actor which is not visible on static pages
-   * @param [in] shadowWidth The width for the simulated shadow
-   */
-  void SetShadowWidth( float shadowWidth );
-
-  /**
-   * @brief Set the spine shadow parameter.
-   *
-   * The two parameters are the major&minor radius (in pixels) to form an ellipse shape
-   * The top-left quarter of this ellipse is used to calculate spine normal for simulating shadow
-   * @param [in] spineShadowParameter The major&minor ellipse radius for the simulated spine shadow
-   */
-  void SetSpineShadowParameter( const Vector2& spineShadowParameter );
-
-
-private:// Helper for New()
-  DALI_INTERNAL PageTurnBookSpineEffect( ShaderEffect handle );
-
-}; // End of PageTurnBookSpineEffect class
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif /* __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__ */
diff --git a/dali-toolkit/devel-api/shader-effects/page-turn-effect.cpp b/dali-toolkit/devel-api/shader-effects/page-turn-effect.cpp
deleted file mode 100644 (file)
index f55bce0..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/page-turn-effect.h>
-
-// INTERNAL HEADERS
-#include <dali-toolkit/internal/shader-effects/page-turn-effect-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-PageTurnEffect::PageTurnEffect()
-{
-}
-
-// Call the Parent copy constructor to add reference to the implementation for this object
-PageTurnEffect::PageTurnEffect( ShaderEffect handle, Internal::PageTurnEffect* shaderExtension )
-: ShaderEffect( handle )
-{
-  AttachExtension( shaderExtension );
-}
-
-PageTurnEffect::~PageTurnEffect()
-{
-}
-
-PageTurnEffect PageTurnEffect::New( bool enableBlending )
-{
-  return Internal::PageTurnEffect::CreateShaderEffect( enableBlending );
-}
-
-void PageTurnEffect::SetPageSize(const Vector2& pageSize)
-{
-  GetImpl( *this ).SetPageSize( pageSize );
-}
-
-void PageTurnEffect::SetOriginalCenter(const Vector2& originalCenter)
-{
-  GetImpl( *this ).SetOriginalCenter( originalCenter );
-}
-
-void PageTurnEffect::SetCurrentCenter(const Vector2& currentCenter)
-{
-  GetImpl( *this ).SetCurrentCenter( currentCenter );
-}
-
-void PageTurnEffect::SetIsTurningBack(bool isTurningBack)
-{
-  GetImpl( *this ).SetIsTurningBack( isTurningBack );
-}
-
-void PageTurnEffect::SetShadowWidth(float shadowWidth)
-{
-  GetImpl( *this ).SetShadowWidth( shadowWidth );
-}
-
-void PageTurnEffect::SetSpineShadowParameter(const Vector2& spineShadowParameter)
-{
-  GetImpl( *this ).SetSpineShadowParameter( spineShadowParameter);
-}
-
-const std::string& PageTurnEffect::GetPageSizePropertyName() const
-{
-  return GetImpl( *this ).GetPageSizePropertyName();
-}
-
-const std::string& PageTurnEffect::GetOriginalCenterPropertyName() const
-{
-  return GetImpl( *this ).GetOriginalCenterPropertyName();
-}
-
-const std::string& PageTurnEffect::GetCurrentCenterPropertyName() const
-{
-  return GetImpl( *this ).GetCurrentCenterPropertyName();
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/devel-api/shader-effects/page-turn-effect.h b/dali-toolkit/devel-api/shader-effects/page-turn-effect.h
deleted file mode 100644 (file)
index 3e9abb4..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-#ifndef __DALI_PAGE_TURN_EFFECT_H_
-#define __DALI_PAGE_TURN_EFFECT_H_
-
-/*
- * Copyright (c) 2015 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 <dali/public-api/shader-effects/shader-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal DALI_INTERNAL
-{
-
-/**
- * @brief PageTurnEffect implementation class.
- */
-class PageTurnEffect;
-
-} // namespace Internal
-
-/**
- * @brief PageTurnEffect is a custom shader effect to achieve page turn effect for Image actors.
- *
- * Usage example:-
- *
- * // create shader used for doing page-turn effect\n
- * PageTurnEffect pageTurnEffect = PageTurnEffect::New();
- *
- * // set image actor shader to the page-turn one\n
- * // for portrait view, one image actor for each page\n
- * // for landscape view, the page turned over is still visible, so back image is needed \n
- * //     in this case, create another image Actor using the back image and added to the page actor \n
- * ImageActor pageActor = ImageActor::New(....); \n
- * ImageActor backImageActor = ImageActor::New(....); \n
- * pageActor.Add(backPageActor);\n
- * pageActor.SetShaderEffect ( pageTurnEffect ); \n
- *
- * //set initial values
- * pageTurnEffect.SetPageSize();\n
- * pageTurnEffect.SetOriginalCenter();\n
- * pageTurnEffect.SetIsTurningBack();\n
- * pageTurnEffect.SetCurrentCenter();\n
- *
- * //Animate it with the current center property\n
- * Animation animation[mAnimationIndex] = Animation::New( ... );\n
- * animation.AnimateTo(Property( pageTurnEffect, pageTurnEffect.PageTurnEffect::GetCurrentCenterPropertyName() ),
- *                            currentCenter,
- *                            AlphaFunction::...);\n
- * animation[mAnimationIndex].Play(); \n
- */
-
-class DALI_IMPORT_API PageTurnEffect : public ShaderEffect
-{
-public:
-  /**
-   * @brief Create an uninitialized PageTurnEffect; this can be initialized with PageTurnEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  PageTurnEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~PageTurnEffect();
-
-  /**
-   * @brief Create an initialized PageTurnEffect.
-   *
-   * If fake shadow is used, need to apply the ShaderEffect::HINT_BLENDING
-   * @param[in] enableBlending If true, apply HINT_BLENDING when creating the shader object; If false, disable the HINT_BLENDING
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static PageTurnEffect New( bool enableBlending = true );
-
-  /**
-   * @brief Set the page size of the PageTurnEffect.
-   *
-   * @param [in] pageSize The page size.
-   */
-  void SetPageSize(const Vector2& pageSize);
-
-  /**
-   * @brief Set the origin point of the PageTurnEffect, the position where the mouse/finger is pushed from.
-   *
-   * @param [in] originalCenter The new origin point.
-   */
-  void SetOriginalCenter(const Vector2& originalCenter);
-
-  /**
-   * @brief Set the center point of the PageTurnEffect, the current position of touch motion.
-   *
-   * @param [in] currentCenter The new center point.
-   */
-  void SetCurrentCenter(const Vector2& currentCenter);
-
-  /**
-   * @brief Set whether the current page is turning forward or backward.
-   *
-   * @param [in] isTurningBack True for turning backward or False for turning forward
-   */
-  void SetIsTurningBack(bool isTurningBack);
-
-  /**
-   * @brief Set the width of shadow to be pageSize * shadowWidth.
-   *
-   * @param [in] shadowWidth The width for the simulated shadow
-   */
-  void SetShadowWidth(float shadowWidth);
-
-  /**
-   * @brief Set the spine shadow parameter.
-   *
-   * The two parameters are the major&minor radius (in pixels) to form an ellipse shape
-   * The top-left quarter of this ellipse is used to calculate spine normal for simulating shadow
-   * @param [in] spineShadowParameter The major&minor ellipse radius for the simulated spine shadow
-   */
-  void SetSpineShadowParameter(const Vector2& spineShadowParameter);
-
-  /**
-   * @brief Get the name for the page size property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetPageSizePropertyName() const;
-
-  /**
-  * @brief Get the name for the origin center property.
-  *
-  * @return A std::string containing the property name
-  */
-  const std::string& GetOriginalCenterPropertyName() const;
-
-  /**
-   * @brief Get the name for the current center property.
-   *
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCurrentCenterPropertyName() const;
-
-public: // Not intended for application developers
-
-  DALI_INTERNAL PageTurnEffect( ShaderEffect handle, Internal::PageTurnEffect* shaderExtension );
-
-};  //end of PageTurnEffect class
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif /* __DALI_TOOLKIT_SC_CURVE_EFFECT_H_ */
diff --git a/dali-toolkit/devel-api/shader-effects/quadratic-bezier.cpp b/dali-toolkit/devel-api/shader-effects/quadratic-bezier.cpp
deleted file mode 100644 (file)
index 970fa6f..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/quadratic-bezier.h>
-
-//EXTERNAL HEADERS
-#include <sstream>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-const char* POINT_PROPERTY_NAME( "uPoint" );
-const char* LINEWIDTH_PROPERTY_NAME( "uLineWidth" );
-const char* COLOR_PROPERTY_NAME( "uColor" );
-} // namespace
-
-QuadraticBezier::QuadraticBezier()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-QuadraticBezier::QuadraticBezier(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-QuadraticBezier::~QuadraticBezier()
-{
-}
-
-QuadraticBezier QuadraticBezier::New(unsigned int pointCount, bool filled )
-{
-  std::string vertexShader = DALI_COMPOSE_SHADER
-  (
-      uniform mediump vec3 uPoint[MAX_POINT_COUNT];\n
-      varying highp vec2 vCoefficient;
-      void main()\n
-      {\n
-        int vertexId = int(aNormal.z);\n
-        gl_Position = uMvpMatrix * vec4(uPoint[vertexId], 1.0);\n
-        vCoefficient = aNormal.xy;\n
-      }\n
-  );
-
-  std::string fragmentShader;
-
-  if( filled )
-  {
-    fragmentShader = DALI_COMPOSE_SHADER
-    (
-        varying highp vec2 vCoefficient;\n
-
-        void main()\n
-        {\n
-          highp float C = (vCoefficient.x*vCoefficient.x-vCoefficient.y);\n
-          highp float Cdx = dFdx(C);\n
-          highp float Cdy = dFdy(C);\n
-
-          highp float distance = float(C / sqrt(Cdx*Cdx + Cdy*Cdy));\n
-
-          gl_FragColor = uColor;\n
-          highp float alpha = 0.5 - distance;\n
-          if( alpha < 0.0 )\n
-            discard;\n
-
-          gl_FragColor.w = alpha;\n
-        }\n
-    );
-  }
-  else
-  {
-    fragmentShader = DALI_COMPOSE_SHADER
-    (
-        varying highp vec2 vCoefficient;\n
-        uniform lowp float uLineWidth;\n
-
-        void main()\n
-        {\n
-          highp float C = (vCoefficient.x*vCoefficient.x-vCoefficient.y);\n
-          highp float Cdx = dFdx(C);\n
-          highp float Cdy = dFdy(C);\n
-          highp float distance = abs(float(C / sqrt(Cdx*Cdx + Cdy*Cdy)));\n
-          gl_FragColor = uColor*(uLineWidth-distance);\n
-        }\n
-    );
-  }
-
-  std::ostringstream vertexShaderPrefix;
-  vertexShaderPrefix << "#define MAX_POINT_COUNT "<< pointCount << "\n";
-
-  Dali::ShaderEffect shaderEffectCustom = Dali::ShaderEffect::NewWithPrefix( vertexShaderPrefix.str(),vertexShader,
-                                                                             "#extension GL_OES_standard_derivatives:enable\n", fragmentShader,
-                                                                             GEOMETRY_TYPE_UNTEXTURED_MESH );
-
-  Dali::Toolkit::QuadraticBezier handle( shaderEffectCustom );
-
-  //Set default uniform values
-  handle.SetUniform( COLOR_PROPERTY_NAME, Vector4(1.0f,1.0f,1.0f,1.0f) );
-  if( !filled )
-  {
-    //Set default line widht to 1 pixel
-    handle.SetUniform( LINEWIDTH_PROPERTY_NAME, 1.0f );
-  }
-
-  return handle;
-}
-
-void QuadraticBezier::SetPoint(unsigned int index, const Vector3& position)
-{
-  SetUniform( GetPointPropertyName(index), position );
-}
-
-void QuadraticBezier::SetLineWidth( float width )
-{
-  SetUniform( LINEWIDTH_PROPERTY_NAME, width );
-}
-
-void QuadraticBezier::SetColor( const Vector4& color )
-{
-  SetUniform( COLOR_PROPERTY_NAME, color );
-}
-
-std::string QuadraticBezier::GetPointPropertyName(unsigned int index) const
-{
-  std::ostringstream propertyName;
-  propertyName<<POINT_PROPERTY_NAME<<"["<<index<<"]";
-  return propertyName.str();
-}
-
-std::string QuadraticBezier::GetLineWidthPropertyName( ) const
-{
-  return LINEWIDTH_PROPERTY_NAME;
-}
-
-std::string QuadraticBezier::GetColorPropertyName( ) const
-{
-  return COLOR_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
index e3e0ad8..3848916 100644 (file)
@@ -27,7 +27,9 @@ namespace Dali
 namespace Toolkit
 {
 /**
- * @brief QuadraticBezier is a custom shader to render quadratic bezier curves and bounded regions.
+ * @brief Creates a new QuadraticBezier shader effect
+ *
+ * QuadraticBezier is a custom shader to render quadratic bezier curves and bounded regions.
  *
  * Implementation based on the paper "Resolution Independent Curve Rendering using Programmable Graphics Hardware"
  * by Charles Loop and Jim Blinn.
@@ -36,84 +38,90 @@ namespace Toolkit
  * aNormal attribute is used to pass the coefficients of each control point (xy coordinates) as well as the vertex ID (z coordinate).
  * A quadratic curve should have as normal for the first control point (0.0,0.0), (0.5,0.0) for the second and (1.0,1.0) for the third.
  * Triangles that do not contain curves should have coordinates (0.0,1.0) for each control point in order to be filled properly.
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uPoint"      - Position coordinates for the points in the curve
+ *  "uColor"      - The color of the curve or bounded region
+ *  "uLineWidth"  - The width of the path. Only for not filled curves
+ *
+ * @param[in] pointCount The maximum number of vertices
+ * @param[in] filled Specify whether the the bounded region should be filled or not
+ * @return A handle to a newly allocated ShaderEffect
  */
-
-class DALI_IMPORT_API QuadraticBezier : public ShaderEffect
+inline ShaderEffect CreateQuadraticBezier(unsigned int pointCount, bool filled)
 {
-public:
-
-  /**
-   * @brief Create an uninitialized QuadraticBezier; this can be initialized with QuadraticBezier::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  QuadraticBezier();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~QuadraticBezier();
-
-  /**
-   * @brief Create an initialized QuadraticBezier.
-   *
-   * @param[in] pointCount The maximum number of vertices
-   * @param[in] filled Specify whether the the bounded region should be filled or not
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static QuadraticBezier New(unsigned int pointCount, bool filled );
-
-  /**
-   * @brief Set position coordinates for a point in the curve
-   *
-   * @param[in] index The index of the vertex
-   * @param[in] position The new position
-   */
-  void SetPoint( unsigned int index, const Vector3& position );
-
-  /**
-   * @brief Set the width of the pathThis is only for not filled curves
-   *
-   * @param[in] width Width of the line in pixels
-   */
-  void SetLineWidth( float width );
-
-  /**
-   * @brief Sets the color of the curve
-   *
-   * @param[in] color The new color
-   */
-  void SetColor( const Vector4& color );
-
-  /**
-   * @brief Get the name of a the point property given its index
-   *
-   * @param[in] index Index of the vertex
-   * @return A std::string containing the property name
-   */
-  std::string GetPointPropertyName( unsigned int index ) const;
-
-  /**
-   * @brief Get the name of the line width property
-   *
-   * @return A std::string containing the property name
-   */
-  std::string GetLineWidthPropertyName( ) const;
-
-  /**
-   * @brief Get the name of the color property
-   *
-   * @return A std::string containing the property name
-   */
-  std::string GetColorPropertyName( ) const;
-
-private: // Not intended for application developers
-
-  DALI_INTERNAL QuadraticBezier(ShaderEffect handle);
-
-};
+  std::string vertexShader = DALI_COMPOSE_SHADER
+      (
+          uniform mediump vec3 uPoint[MAX_POINT_COUNT];\n
+          varying highp vec2 vCoefficient;
+          void main()\n
+              {\n
+            int vertexId = int(aNormal.z);\n
+            gl_Position = uMvpMatrix * vec4(uPoint[vertexId], 1.0);\n
+            vCoefficient = aNormal.xy;\n
+              }\n
+      );
+
+  std::string fragmentShader;
+
+  if( filled )
+  {
+    fragmentShader = DALI_COMPOSE_SHADER
+        (
+            varying highp vec2 vCoefficient;\n
+
+            void main()\n
+            {\n
+              highp float C = (vCoefficient.x*vCoefficient.x-vCoefficient.y);\n
+              highp float Cdx = dFdx(C);\n
+              highp float Cdy = dFdy(C);\n
+
+              highp float distance = float(C / sqrt(Cdx*Cdx + Cdy*Cdy));\n
+
+              gl_FragColor = uColor;\n
+              highp float alpha = 0.5 - distance;\n
+              if( alpha < 0.0 )\n
+              discard;\n
+
+              gl_FragColor.w = alpha;\n
+            }\n
+        );
+  }
+  else
+  {
+    fragmentShader = DALI_COMPOSE_SHADER
+        (
+            varying highp vec2 vCoefficient;\n
+            uniform lowp float uLineWidth;\n
+
+            void main()\n
+            {\n
+              highp float C = (vCoefficient.x*vCoefficient.x-vCoefficient.y);\n
+              highp float Cdx = dFdx(C);\n
+              highp float Cdy = dFdy(C);\n
+              highp float distance = abs(float(C / sqrt(Cdx*Cdx + Cdy*Cdy)));\n
+              gl_FragColor = uColor*(uLineWidth-distance);\n
+            }\n
+        );
+  }
+
+  std::ostringstream vertexShaderPrefix;
+  vertexShaderPrefix << "#define MAX_POINT_COUNT "<< pointCount << "\n";
+
+  Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::NewWithPrefix(
+      vertexShaderPrefix.str(),vertexShader,
+      "#extension GL_OES_standard_derivatives:enable\n", fragmentShader );
+
+  //Set default uniform values
+  shaderEffect.SetUniform( "uColor", Vector4(1.0f,1.0f,1.0f,1.0f) );
+  if( !filled )
+  {
+    //Set default line widht to 1 pixel
+    shaderEffect.SetUniform( "uLineWidth", 1.0f );
+  }
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/ripple-effect.cpp b/dali-toolkit/devel-api/shader-effects/ripple-effect.cpp
deleted file mode 100644 (file)
index f4c8a52..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/ripple-effect.h>
-
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string AMPLITUDE_PROPERTY_NAME( "uAmplitude" );
-const std::string CENTER_PROPERTY_NAME( "uCenter" );
-const std::string TIME_PROPERTY_NAME( "uTime" );
-
-} // namespace
-
-RippleEffect::RippleEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-RippleEffect::RippleEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-RippleEffect::~RippleEffect()
-{
-}
-
-
-RippleEffect RippleEffect::New()
-{
-
-  std::string vertexShader(
-       "precision mediump float;\n"
-       "uniform mediump   vec2  uCenter;\n"
-       "uniform mediump   float uTime;\n"
-       "uniform mediump   float uAmplitude;\n"
-       "uniform mediump   float uLighting;\n"
-       "uniform mediump   float uWaveLength;\n"
-       "varying mediump   float vLight;\n"
-       "varying mediump   float vShade;\n"
-       "void main()\n"
-       "{\n"
-          "float lighting = uAmplitude * 0.02;\n"
-          "float waveLength = uAmplitude * 0.0016;\n"
-          "vec4 world = uModelView * vec4(aPosition,1.0);\n"
-          "vec2 d = vec2(world.x - uCenter.x, world.y - uCenter.y);\n"
-          "float dist = length(d);\n"
-          "float amplitude = cos(uTime - dist*waveLength);\n"
-          "float slope     = sin(uTime - dist*waveLength);\n"
-          "world.z += amplitude * uAmplitude;\n"
-          "gl_Position = uProjection * world;\n"
-          "vec2 lightDirection = vec2(-0.707,0.707);\n"
-          "float dot = 0.0;\n"
-          "if(dist > 0.0)\n"
-          "{\n"
-          "  dot = dot(normalize(d),lightDirection) * lighting;\n"
-          "}\n"
-          "vShade = 1.0 - (dot * slope);\n"
-          "vLight = max(0.0, dot * -slope);\n"
-          "vTexCoord = aTexCoord;\n"
-        "}" );
-
-  // append the default version
-  std::string imageFragmentShader(
-        "precision mediump float;\n"
-        "varying mediump float  vLight;\n"
-        "varying mediump float  vShade;\n"
-        "void main()\n"
-        "{\n"
-        "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(vShade,vShade,vShade,1.0) + vec4(vLight, vLight, vLight,0.0);\n"
-        "}" );
-
-  // Create the implementation, temporarily owned on stack
-  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
-      vertexShader, imageFragmentShader, GeometryType(GEOMETRY_TYPE_IMAGE), GeometryHints(HINT_GRID) );
-
-  /* Pass ownership to RippleEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::RippleEffect handle( shaderEffect );
-
-  handle.SetUniform( AMPLITUDE_PROPERTY_NAME, 0.0f );
-  handle.SetUniform( CENTER_PROPERTY_NAME, Vector2(0.0f, 0.0f));
-  handle.SetUniform( TIME_PROPERTY_NAME, 0.0f );
-
-  return handle;
-}
-
-void RippleEffect::SetAmplitude(float amplitude)
-{
-  SetUniform( AMPLITUDE_PROPERTY_NAME, amplitude );
-}
-
-void RippleEffect::SetCenter(const Vector2& center)
-{
-  SetUniform( CENTER_PROPERTY_NAME, center );
-}
-
-void RippleEffect::SetTime(float time)
-{
-  SetUniform( TIME_PROPERTY_NAME, time );
-}
-
-const std::string& RippleEffect::GetAmplitudePropertyName() const
-{
-  return AMPLITUDE_PROPERTY_NAME;
-}
-
-const std::string& RippleEffect::GetCenterPropertyName() const
-{
-  return CENTER_PROPERTY_NAME;
-}
-
-const std::string& RippleEffect::GetTimePropertyName() const
-{
-  return TIME_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 72e3883..39d0a13 100644 (file)
@@ -28,81 +28,70 @@ namespace Toolkit
 {
 
 /**
- * @brief RippleEffect is a custom shader effect to achieve ripple effects on Image actors.
+ * @brief Creates a new RippleEffect
+ *
+ * RippleEffect is a custom shader effect to achieve ripple effects on Image actors.
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uAmplitude"  - The amplitude of the effect
+ *  "uCenter"     - The center point of the effect as screen coordinates
+ *  "uTime"       - The time duration for the ripple
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API RippleEffect : public ShaderEffect
+inline ShaderEffect CreateRippleEffect()
 {
-public:
-
-  /**
-   * @brief Create an uninitialized RippleEffect; this can be initialized with RippleEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  RippleEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~RippleEffect();
-
-  /**
-   * @brief Create an initialized RippleEffect.
-   *
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static RippleEffect New();
-
-  /**
-   * @brief Set the amplitude of the effect.
-   *
-   * @param [in] amplitude The new amplitude.
-   */
-  void SetAmplitude(float amplitude);
-
-  /**
-   * @brief Set the center point of the effect as screen coordinates.
-   *
-   * @param [in] center The new center point.
-   */
-  void SetCenter(const Vector2& center);
-
-  /**
-   * @brief Set the time duration for the ripple.
-   *
-   * @param[in] time The time duration in float.
-   */
-  void SetTime(float time);
-
-  /**
-   * @brief Get the name for the amplitude property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAmplitudePropertyName() const;
-
-  /**
-   * @brief Get the name for the center property.
-   *
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCenterPropertyName() const;
-
-  /**
-   * @brief Get the name for the time property.
-   *
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetTimePropertyName() const;
-
-private:
-  DALI_INTERNAL RippleEffect(ShaderEffect handle);
-
-};
+  std::string vertexShader(
+      "precision mediump float;\n"
+      "uniform mediump   vec2  uCenter;\n"
+      "uniform mediump   float uTime;\n"
+      "uniform mediump   float uAmplitude;\n"
+      "varying mediump   float vLight;\n"
+      "varying mediump   float vShade;\n"
+      "void main()\n"
+      "{\n"
+      "float lighting = uAmplitude * 0.02;\n"
+      "float waveLength = uAmplitude * 0.0016;\n"
+      "vec4 world = uModelView * vec4(aPosition,1.0);\n"
+      "vec2 d = vec2(world.x - uCenter.x, world.y - uCenter.y);\n"
+      "float dist = length(d);\n"
+      "float amplitude = cos(uTime - dist*waveLength);\n"
+      "float slope     = sin(uTime - dist*waveLength);\n"
+      "world.z += amplitude * uAmplitude;\n"
+      "gl_Position = uProjection * world;\n"
+      "vec2 lightDirection = vec2(-0.707,0.707);\n"
+      "float dot = 0.0;\n"
+      "if(dist > 0.0)\n"
+      "{\n"
+      "  dot = dot(normalize(d),lightDirection) * lighting;\n"
+      "}\n"
+      "vShade = 1.0 - (dot * slope);\n"
+      "vLight = max(0.0, dot * -slope);\n"
+      "vTexCoord = aTexCoord;\n"
+      "}" );
+
+  // append the default version
+  std::string imageFragmentShader(
+      "precision mediump float;\n"
+      "varying mediump float  vLight;\n"
+      "varying mediump float  vShade;\n"
+      "void main()\n"
+      "{\n"
+      "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(vShade,vShade,vShade,1.0) + vec4(vLight, vLight, vLight,0.0);\n"
+      "}" );
+
+
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      vertexShader, imageFragmentShader,
+      ShaderEffect::GeometryHints(ShaderEffect::HINT_GRID) );
+
+
+  shaderEffect.SetUniform( "uAmplitude", 0.0f );
+  shaderEffect.SetUniform( "uCenter", Vector2(0.0f, 0.0f));
+  shaderEffect.SetUniform( "uTime", 0.0f );
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/ripple2d-effect.cpp b/dali-toolkit/devel-api/shader-effects/ripple2d-effect.cpp
deleted file mode 100644 (file)
index ffd11ac..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/ripple2d-effect.h>
-
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string TEXTURE_SIZE_PROPERTY_NAME( "uTextureSize" );
-const std::string AMPLITUDE_PROPERTY_NAME( "uAmplitude" );
-const std::string TIME_PROPERTY_NAME( "uTime" );
-
-} // namespace
-
-Ripple2DEffect::Ripple2DEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-Ripple2DEffect::Ripple2DEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-Ripple2DEffect::~Ripple2DEffect()
-{
-}
-
-
-Ripple2DEffect Ripple2DEffect::New()
-{
-    // append the default version
-    std::string fragmentShader(
-        "precision mediump float;\n"
-        "uniform float uAmplitude;\n"
-        "uniform float uTime;\n"
-        "void main()\n"
-        "{\n"
-        "  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\n"
-        "  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\n"
-        "  highp float len = length(pos);\n"
-        "  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n"
-        "  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\n"
-        "}" );
-
-  // Create the implementation, temporarily owned on stack
-  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
-    "", fragmentShader,
-    Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
-    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
-
-  /* Pass ownership to Ripple2DEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::Ripple2DEffect handle( shaderEffect );
-
-  handle.SetUniform( TEXTURE_SIZE_PROPERTY_NAME, Vector2(0.0f, 0.0f) );
-  handle.SetUniform( AMPLITUDE_PROPERTY_NAME, 0.0f );
-  handle.SetUniform( TIME_PROPERTY_NAME, 0.0f );
-
-  return handle;
-
-}
-
-void Ripple2DEffect::SetAmplitude(float amplitude)
-{
-  SetUniform( AMPLITUDE_PROPERTY_NAME, amplitude );
-}
-
-void Ripple2DEffect::SetTime(float time)
-{
-  SetUniform( TIME_PROPERTY_NAME, time );
-}
-
-const std::string& Ripple2DEffect::GetAmplitudePropertyName() const
-{
-  return AMPLITUDE_PROPERTY_NAME;
-}
-
-const std::string& Ripple2DEffect::GetTimePropertyName() const
-{
-  return TIME_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index f93ce79..cbef85b 100644 (file)
@@ -28,66 +28,44 @@ namespace Toolkit
 {
 
 /**
- * @brief Ripple2DEffect is a custom shader effect to achieve 2d ripple effects on Image actors.
+ * @brief Creates a new Ripple2DEffect
+ *
+ * Ripple2DEffect is a custom shader effect to achieve 2d ripple effects on Image actors.
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uTime"       - The time duration for the 2d ripple
+ *  "uAmplitude"  - The amplitude of the 2d ripple
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API Ripple2DEffect : public ShaderEffect
+inline ShaderEffect CreateRipple2DEffect()
 {
-public:
-
-  /**
-   * @brief Create an uninitialized Ripple2DEffect; this can be initialized with Ripple2DEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  Ripple2DEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~Ripple2DEffect();
-
-  /**
-   * @brief Create an initialized Ripple2DEffect.
-   *
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static Ripple2DEffect New();
-
-  /**
-   * @brief Set the amplitude of the 2d ripple.
-   *
-   * @param[in] amplitude The amplitude in float.
-   */
-  void SetAmplitude(float amplitude);
-
-  /**
-   * @brief Set the time duration for the 2d ripple.
-   *
-   * @param[in] time The time duration in float.
-   */
-  void SetTime(float time);
-
-  /**
-   * @brief Get the name for the amplitude property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAmplitudePropertyName() const;
-
-  /**
-   * @brief Get the name for the time property.
-   *
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetTimePropertyName() const;
-
-private:
-  DALI_INTERNAL Ripple2DEffect(ShaderEffect handle);
-
-};
+  // append the default version
+  std::string fragmentShader(
+      "precision mediump float;\n"
+      "uniform float uAmplitude;\n"
+      "uniform float uTime;\n"
+      "void main()\n"
+      "{\n"
+      "  highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\n"
+      "  highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\n"
+      "  highp float len = length(pos);\n"
+      "  highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n"
+      "  gl_FragColor = texture2D(sTexture, texCoord) * uColor;\n"
+      "}" );
+
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      "", fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
+
+
+
+  shaderEffect.SetUniform( "uTextureSize", Vector2(0.0f, 0.0f) ); //@note: Is this needed?
+  shaderEffect.SetUniform( "uAmplitude", 0.0f );
+  shaderEffect.SetUniform( "uTime", 0.0f );
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/shear-effect.cpp b/dali-toolkit/devel-api/shader-effects/shear-effect.cpp
deleted file mode 100644 (file)
index 994d0c5..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/shear-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string CENTER_PROPERTY_NAME( "uCenter" );
-const std::string ANGLE_X_AXIS_PROPERTY_NAME( "uAngleXAxis" );
-const std::string ANGLE_Y_AXIS_PROPERTY_NAME( "uAngleYAxis" );
-
-} // namespace
-
-ShearEffect::ShearEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-ShearEffect::ShearEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-ShearEffect::~ShearEffect()
-{
-}
-
-
-ShearEffect ShearEffect::New()
-{
-  // append the default version
-  std::string vertexShader(
-              "uniform mediump  vec2  uCenter;\n"
-              "uniform mediump  float uAngleXAxis;\n"
-              "uniform mediump  float uAngleYAxis;\n"
-              "\n"
-              "void main()\n"
-              "{\n"
-                  "mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
-                  "\n"
-                  "world.x = world.x + tan(radians(uAngleXAxis)) * (world.y - uCenter.y * world.w);\n"
-                  "world.y = world.y + tan(radians(uAngleYAxis)) * (world.x - uCenter.x * world.w);\n"
-                  "\n"
-                  "gl_Position = uProjection * world;\n"
-                  "\n"
-                  "vTexCoord = aTexCoord;\n"
-              "}" );
-
-  // Create the implementation, temporarily owned on stack,
-  ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      vertexShader,
-      "",
-      GeometryType( GEOMETRY_TYPE_IMAGE ),
-      GeometryHints( HINT_GRID ));
-
-  // Pass ownership to ShearEffect through overloaded constructor, So that it now has access to the
-  // Dali::ShaderEffect implementation
-  Dali::Toolkit::ShearEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( CENTER_PROPERTY_NAME, Vector2(0.0f, 0.0f), COORDINATE_TYPE_VIEWPORT_POSITION );
-  handle.SetUniform( ANGLE_X_AXIS_PROPERTY_NAME, 0.0f);
-  handle.SetUniform( ANGLE_Y_AXIS_PROPERTY_NAME, 0.0f);
-
-  return handle;
-}
-
-void ShearEffect::SetCenter( const Vector2& center )
-{
-  SetUniform( CENTER_PROPERTY_NAME, center, COORDINATE_TYPE_VIEWPORT_POSITION );
-}
-
-void ShearEffect::SetAngleXAxis( float angle )
-{
-  SetUniform( ANGLE_X_AXIS_PROPERTY_NAME, angle );
-};
-
-void ShearEffect::SetAngleYAxis( float angle )
-{
-  SetUniform( ANGLE_Y_AXIS_PROPERTY_NAME, angle );
-};
-
-const std::string& ShearEffect::GetCenterPropertyName() const
-{
-  return CENTER_PROPERTY_NAME;
-}
-
-const std::string& ShearEffect::GetAngleXAxisPropertyName() const
-{
-  return ANGLE_X_AXIS_PROPERTY_NAME;
-}
-
-const std::string& ShearEffect::GetAngleYAxisPropertyName() const
-{
-  return ANGLE_Y_AXIS_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index a9b819b..edea72e 100644 (file)
@@ -28,71 +28,50 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new ShearEffect
+ *
  * ShearEffect is a custom shader effect to achieve shear effects in Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uCenter"     - The center point of the shear effect in screen coordinates
+ *  "uAngleXAxis" - The angle of the shear effect in the X axis
+ *  "uAngleYAxis" - The angle of the shear effect in the Y axis
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API ShearEffect : public ShaderEffect
+inline ShaderEffect CreateShearEffect()
 {
-public:
-
-  /**
-   * Create an uninitialized ShearEffect; this can be initialized with ShearEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  ShearEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~ShearEffect();
-
-  /**
-   * Create an initialized ShearEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static ShearEffect New();
-
-  /**
-   * Set the center point of the shear effect in screen coordinates.
-   * @param [in] center The new center point.
-   */
-  void SetCenter(const Vector2& center);
-
-  /**
-   * Set the angle of the shear effect in the X axis.
-   * @param [in] angle The new angle.
-   */
-  void SetAngleXAxis(float angle);
-
-  /**
-   * Set the angle of the shear effect in the Y axis.
-   * @param [in] angle The new angle.
-   */
-  void SetAngleYAxis(float angle);
-
-  /**
-   * Get the name for the center property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCenterPropertyName() const;
-
-  /**
-   * Get the name for the X axis property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAngleXAxisPropertyName() const;
-
-  /**
-   * Get the name for the Y axis property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAngleYAxisPropertyName() const;
-
-
-private: // Not intended for application developers
-  DALI_INTERNAL ShearEffect(ShaderEffect handle);
-};
+  // append the default version
+  std::string vertexShader(
+      "uniform mediump  vec2  uCenter;\n"
+      "uniform mediump  float uAngleXAxis;\n"
+      "uniform mediump  float uAngleYAxis;\n"
+      "\n"
+      "void main()\n"
+      "{\n"
+      "mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+      "\n"
+      "world.x = world.x + tan(radians(uAngleXAxis)) * (world.y - uCenter.y * world.w);\n"
+      "world.y = world.y + tan(radians(uAngleYAxis)) * (world.x - uCenter.x * world.w);\n"
+      "\n"
+      "gl_Position = uProjection * world;\n"
+      "\n"
+      "vTexCoord = aTexCoord;\n"
+      "}" );
+
+  // Create the implementation, temporarily owned on stack,
+  ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      vertexShader,
+      "",
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID ));
+
+
+  shaderEffect.SetUniform( "uCenter", Vector2(0.0f, 0.0f), ShaderEffect::COORDINATE_TYPE_VIEWPORT_POSITION );
+  shaderEffect.SetUniform( "uAngleXAxis", 0.0f);
+  shaderEffect.SetUniform( "uAngleYAxis", 0.0f);
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/soft-button-effect.cpp b/dali-toolkit/devel-api/shader-effects/soft-button-effect.cpp
deleted file mode 100644 (file)
index b7ed625..0000000
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali/public-api/animation/constraint.h>
-#include <dali/public-api/object/property-input.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/shader-effects/soft-button-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string SOFT_BUTTON_LIGHTING_INDENTATION_AMOUNT_PROPERTY_NAME( "uLightingIndentationAmount" );
-const std::string SOFT_BUTTON_TEXTURE_DISTORTION_AMOUNT_PROPERTY_NAME( "uTextureDistortAmount" );
-const std::string SOFT_BUTTON_AMBIENT_LIGHT_AMOUNT_PROPERTY_NAME( "uAmbientLight" );
-const std::string SOFT_BUTTON_DIFFUSE_LIGHT_PROPERTY_NAME( "uDiffuseLight" );
-const std::string SOFT_BUTTON_LIGHTING_MULTIPLIER_PROPERTY_NAME( "uLightMultiplier" );
-const std::string SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME( "uInsideCircleSizeScale" );
-const std::string SOFT_BUTTON_RECIP_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME( "uRecipInsideCircleSizeScale" );
-const std::string SOFT_BUTTON_OUTSIDE_SHAPE_DEPTH_PROPERTY_NAME( "uOutsideCircleDepth" );
-const std::string SOFT_BUTTON_EFFECT_PIXEL_AREA_PROPERTY_NAME( "uEffectRegion" );
-const std::string SOFT_BUTTON_RECTANGLE_SIZE_SCALE_PROPERTY_NAME( "uRectangleSizeScale" );
-
-
-// factors that scale the look, defaults
-const float SOFT_BUTTON_LIGHTING_INDENTATION_AMOUNT_DEFAULT = 0.0f;
-const float SOFT_BUTTON_TEXTURE_DISTORTION_AMOUNT_DEFAULT = 0.0f;
-const float SOFT_BUTTON_AMBIENT_LIGHT_AMOUNT_DEFAULT = 0.15f;
-const Vector3 SOFT_BUTTON_DIFFUSE_LIGHT_DEFAULT = Vector3(0.0f, 0.7070168f, 0.7071068f);
-const float SOFT_BUTTON_LIGHTING_MULTIPLIER_DEFAULT = 1.2f;
-const float SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_DEFAULT = 0.75f;
-const float SOFT_BUTTON_OUTSIDE_SHAPE_DEPTH_DEFAULT = Math::PI * 0.05f;
-const Vector4 SOFT_BUTTON_EFFECT_PIXEL_AREA_DEFAULT = Vector4(0.0f, 0.0f, 1.0f, 1.0f);
-const float SOFT_BUTTON_RECTANGLE_SIZE_SCALE_DEFAULT = 0.5f;
-
-} // namespace
-
-/**
- * InverseConstraint
- *
- * f(current, property) = 1.0 / property
- */
-void InverseConstraint( float& current, const PropertyInputContainer& inputs )
-{
-  current = 1.0f / inputs[0]->GetFloat();
-}
-
-////////////////////////////////////////////////////
-//
-// Soft button shader / actor tweaking parameters
-//
-
-
-SoftButtonEffect::SoftButtonEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-SoftButtonEffect::SoftButtonEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-SoftButtonEffect::~SoftButtonEffect()
-{
-}
-
-SoftButtonEffect SoftButtonEffect::New(Type type)
-{
-  std::string vertexSource;
-  vertexSource =  "precision mediump float;\n"
-    "uniform vec3 uDiffuseLight;\n"
-    "uniform float uAmbientLight;\n"
-    "uniform float uLightMultiplier;\n"
-    "uniform vec4 uEffectRegion;\n"
-    "varying vec2 vCentredCoord;\n"
-
-    "const vec3 norm = vec3(0.0, 0.0, 1.0);\n"
-
-    "void main()\n"
-    "{\n"
-    "  vTexCoord = aTexCoord;\n"
-    // Get the rect coords of the effect region in -1..1 range, i.e. circle centred around the center of the rect
-    // Done in the vertex shader itself to make use of gl interpolation for varying.
-    "  vCentredCoord = vec2( ( (vTexCoord.x - uEffectRegion.x)/(uEffectRegion.z - uEffectRegion.x) * 2.0 - 1.0 ), ( (vTexCoord.y - uEffectRegion.y)/(uEffectRegion.w - uEffectRegion.y) * 2.0 - 1.0  ) );\n"
-    "  gl_Position = uMvpMatrix * vec4(aPosition, 1.0);\n"
-    "}\n";
-
-  std::string fragmentSourceFixed;
-  fragmentSourceFixed =  "precision mediump float;\n"
-
-    "uniform vec3 uDiffuseLight;\n"
-    "uniform float uAmbientLight;\n"
-    "uniform float uLightMultiplier;\n"
-    "varying vec2 vCentredCoord;\n"
-
-    "const vec3 norm = vec3(0.0, 0.0, 1.0);\n"
-
-    "void main()\n"
-    "{\n"
-    "   vec4 col = texture2D(sTexture, vTexCoord);\n"
-    // calc lighting
-    "   float lighting = (dot(uDiffuseLight, norm) + uAmbientLight) * uLightMultiplier;\n"
-    // output col = image * light
-    // use the lighting value for colors only
-    "   gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
-    "}\n";
-
-  std::string fragmentSourceElliptical;
-  fragmentSourceElliptical =  "precision mediump float;\n"
-
-    "uniform float uLightingIndentationAmount;\n"
-    "uniform float uTextureDistortAmount;\n"
-    "uniform vec3 uDiffuseLight;\n"
-    "uniform float uAmbientLight;\n"
-    "uniform float uLightMultiplier;\n"
-    "uniform float uInsideCircleSizeScale;\n"
-    "uniform float uRecipInsideCircleSizeScale;\n"
-    "uniform float uOutsideCircleDepth;\n"
-    "uniform vec4 uEffectRegion;\n"
-    "varying vec2 vCentredCoord;\n"
-
-    "const float PI = 3.1415927;\n"
-
-    "void main()\n"
-    "{\n"
-      // Apply distortion only if the pixel is within the rect specified
-      "if( (vTexCoord.x > uEffectRegion.x) && (vTexCoord.x < uEffectRegion.z) && (vTexCoord.y > uEffectRegion.y) && (vTexCoord.y < uEffectRegion.w) )\n"
-      "{\n"
-      "   vec2 coord = vCentredCoord;\n"
-
-      // find a coordinate representing distance from circle centre, such that we split into inside / outside circles that can have different gradients / normals
-      "   float realDistFromCentre = length(coord);\n"
-      "   realDistFromCentre = min(1.0, realDistFromCentre);\n" // clamp corners of square to vertical normal
-      "   float distFromCentre;\n"
-      "   if(realDistFromCentre <= uInsideCircleSizeScale)\n"
-      "   {\n"
-      "     distFromCentre = realDistFromCentre * uRecipInsideCircleSizeScale * (1.0 - uOutsideCircleDepth);\n" // inside circle indent, up to outline depth
-      "   }\n"
-      "   else                                                                                                                      \n"
-      "   {\n"
-      "     distFromCentre = mix(1.0 - uOutsideCircleDepth, 1.0, (realDistFromCentre - ( uInsideCircleSizeScale)) / (1.0 - uInsideCircleSizeScale));\n" // outside circle
-      "   }\n"
-
-      // get coords in -PI..PI range, i.e. scale the circle for use by trig functions
-      "  coord *= PI;\n"
-
-      // get a z value for the distorted surface in 0..1 range, using cos for a smooth curve (note, we ignore inside / outside circles since the difference isn't noticeable visually)
-      "   vec2 cosThetaCoord = (cos(coord) * 0.5) + 0.5;\n"
-      "   float z = cosThetaCoord.x * cosThetaCoord.y;\n"
-
-      // get the normal for the distorted surface, using the fact that the derivative of cos is -sin, finding tangent vector from slope and then normal by cross product...
-      "   float sinThetaCoord = sin(distFromCentre*PI) * uLightingIndentationAmount;\n" // slope, so tangent vec is (1.0, -sin)
-      // ...2D normal vector along distFromCentre vec is (sin, 1.0), convert to components in 3D.
-      "   vec3 norm = normalize(vec3(coord.x * sinThetaCoord, coord.y * sinThetaCoord, 1.0));\n"
-
-      // form surface z and project texture onto it.
-      "   float indentAmount = 1.0 / (1.0 - (z * uTextureDistortAmount));\n"
-      "   vec2 distortedCoord = vCentredCoord * indentAmount;\n"
-
-      // Convert the rect coordinates in -1 to 1 range back to the original coordinates
-      "   vec2 texCoord = vec2( ( (distortedCoord.x + 1.0)*(0.5) * (uEffectRegion.z - uEffectRegion.x) + uEffectRegion.x ), ( (distortedCoord.y + 1.0)*(0.5) * (uEffectRegion.w - uEffectRegion.y) + uEffectRegion.y  ) );  \n"
-      "   vec4 col = texture2D(sTexture, texCoord);\n"
-
-      // calc lighting
-      "   float lighting = (dot(uDiffuseLight, norm) + uAmbientLight) * uLightMultiplier;\n"
-      "  gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
-      "}\n"
-      "else\n"
-      "{\n"
-      "  vec4 col = texture2D(sTexture, vTexCoord);\n"
-      "  float lighting = (dot(uDiffuseLight, vec3(0.0, 0.0, 1.0)) + uAmbientLight) * uLightMultiplier;\n"
-      "  gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
-      "}\n"
-    "}\n";
-
-  std::string fragmentSourceRectangular;
-  fragmentSourceRectangular =  "precision mediump float;\n"
-
-    "uniform float uLightingIndentationAmount;\n"
-    "uniform float uTextureDistortAmount;\n"
-    "uniform vec3 uDiffuseLight;\n"
-    "uniform float uAmbientLight;\n"
-    "uniform float uLightMultiplier;\n"
-    "uniform float uInsideCircleSizeScale;\n"
-    "uniform float uRecipInsideCircleSizeScale;\n"
-    "uniform float uOutsideCircleDepth;\n"
-    "uniform float uRectangleSizeScale;\n"
-    "uniform vec4 uEffectRegion;\n"
-    "varying vec2 vCentredCoord;\n"
-
-    "const float PI = 3.1415927;\n"
-
-    "void main()\n"
-    "{\n"
-      // Apply distortion only if the pixel is within the rect specified
-      "if( (vTexCoord.x > uEffectRegion.x) && (vTexCoord.x < uEffectRegion.z) && (vTexCoord.y > uEffectRegion.y) && (vTexCoord.y < uEffectRegion.w) )\n"
-      "{ \n"
-        // get the rect coords to -1..1 range, i.e. circle centred around the center of the rect
-        "   vec2 centredCoord = vCentredCoord;\n"
-        // clamp coords such that the circle is split into 4 pieces that lie in the corners of the actor. uRectangleScale is the distance along each axis from the centre
-        // of the actor, e.g. 0.5 is half way along an axis from centre to actor edge.
-        "   vec2 clampedCoord;\n"
-        "   if(centredCoord.x > 0.0)\n"
-        "   {\n"
-        "     if(centredCoord.x < uRectangleSizeScale)\n"
-        "     {\n"
-                // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
-        "       clampedCoord.x = 0.0;\n"
-        "     }\n"
-        "     else\n"
-        "     {\n"
-                // we are outside rectangular region along this axis, so we want curvature.
-        "       clampedCoord.x = smoothstep(0.0, 1.0, (centredCoord.x - uRectangleSizeScale) / (1.0 - uRectangleSizeScale));\n"
-        "     }\n"
-        "   }\n"
-        "   else\n"
-        "   {\n"
-        "     if(centredCoord.x > -uRectangleSizeScale)\n"
-        "     {\n"
-                // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
-        "       clampedCoord.x = 0.0;\n"
-        "     }\n"
-        "     else\n"
-        "     {\n"
-                // we are outside rectangular region along this axis, so we want curvature.
-        "       clampedCoord.x = -smoothstep(0.0, 1.0, (centredCoord.x + uRectangleSizeScale) / (uRectangleSizeScale - 1.0));\n"
-        "     }\n"
-        "   }\n"
-        "   if(centredCoord.y > 0.0)\n"
-        "   {\n"
-        "     if(centredCoord.y < uRectangleSizeScale)\n"
-        "     {\n"
-                // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
-        "       clampedCoord.y = 0.0;\n"
-        "     }\n"
-        "     else\n"
-        "     {\n"
-                // we are outside rectangular region along this axis, so we want curvature.
-        "       clampedCoord.y = smoothstep(0.0, 1.0, (centredCoord.y - uRectangleSizeScale) / (1.0 - uRectangleSizeScale));\n"
-        "     }\n"
-        "   }\n"
-        "   else\n"
-        "   {\n"
-        "     if(centredCoord.y > -uRectangleSizeScale)\n"
-        "     {\n"
-                // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
-        "       clampedCoord.y = 0.0;\n"
-        "     }\n"
-        "     else\n"
-        "     {\n"
-                // we are outside rectangular region along this axis, so we want curvature.
-        "       clampedCoord.y = -smoothstep(0.0, 1.0, (centredCoord.y + uRectangleSizeScale) / (uRectangleSizeScale - 1.0));\n"
-        "     }\n"
-        "   }\n"
-        // get coords in -PI..PI range, i.e. scale above circle for use by trig functions
-        "   vec2 thetaCoord = clampedCoord * PI;\n"
-        // get a z value for the distorted surface in 0..1 range, using cos for a smooth curve (note, we ignore inside / outside circles since the difference isn't noticeable visually)
-        "   vec2 cosThetaCoord = (cos(thetaCoord) * 0.5) + 0.5;\n"
-        "   float z = cosThetaCoord.x * cosThetaCoord.y;\n"
-        // find a coordinate representing distance from circle centre, such that we split into inside / outside circles that can have different gradients / normals
-        "   float realDistFromCentre = length(thetaCoord);\n"
-        "   realDistFromCentre = min(PI, realDistFromCentre);\n" // clamp corners of square to vertical normal
-        "   float distFromCentre;\n"
-        "   if(realDistFromCentre <= PI * uInsideCircleSizeScale)\n"
-        "   {\n"
-        "     distFromCentre = realDistFromCentre * uRecipInsideCircleSizeScale * (PI - (uOutsideCircleDepth * PI)) / PI;\n" // inside circle indent, up to outline depth
-        "   }\n"
-        "   else\n"
-        "   {\n"
-        "     distFromCentre = mix(PI - (uOutsideCircleDepth * PI), PI, (realDistFromCentre - ( PI * uInsideCircleSizeScale)) / (PI - (PI * uInsideCircleSizeScale)));\n" // outside circle
-        "   }\n"
-        // get the normal for the distorted surface, using the fact that the derivative of cos is -sin, finding tangent vector from slope and then normal by cross product...
-        "   float sinThetaCoord = sin(distFromCentre) * uLightingIndentationAmount;\n" // slope, so tangent vec is (1.0, -sin)
-        // ...2D normal vector along distFromCentre vec is (sin, 1.0), convert to components in 3D.
-        "   vec3 norm = normalize(vec3(thetaCoord.x * sinThetaCoord, thetaCoord.y * sinThetaCoord, 1.0));\n"
-        // form surface z and project texture onto it.
-        "   float indentAmount = 1.0 / (1.0 - (z * uTextureDistortAmount));\n"
-        "   vec2 distortedCoord = centredCoord * indentAmount;\n"
-        // Convert the rect coordinates in -1 to 1 range back to the original coordinates
-        "   vec2 texCoord = vec2( ( (distortedCoord.x + 1.0)/(2.0) * (uEffectRegion.z - uEffectRegion.x) + uEffectRegion.x ), ( (distortedCoord.y + 1.0)/(2.0) * (uEffectRegion.w - uEffectRegion.y) + uEffectRegion.y  ) );\n"
-        "   vec4 col = texture2D(sTexture, texCoord);\n"
-        // calc lighting
-        "   float lighting = (dot(uDiffuseLight, norm) + uAmbientLight) * uLightMultiplier;\n"
-        // output col = image * light
-        // use the lighting value for colors only
-        "   gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
-
-      "}\n"
-      "else\n"
-      "{\n"
-        "   vec4 col = texture2D(sTexture, vTexCoord);\n"
-        "   float lighting = (dot(uDiffuseLight, vec3(0.0, 0.0, 1.0)) + uAmbientLight) * uLightMultiplier;\n"
-        "   gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
-      "} \n"
-    "}\n";
-
-
-  //////////////////////////////////////
-  // Create shader effect
-  //
-  //
-
-  ShaderEffect shader;
-  switch(type)
-  {
-    case RECTANGULAR:
-      shader = ShaderEffect::New( vertexSource, fragmentSourceRectangular, GeometryType( GEOMETRY_TYPE_IMAGE ), ShaderEffect::GeometryHints( ShaderEffect::HINT_NONE ));
-      break;
-
-    case ELLIPTICAL:
-      shader = ShaderEffect::New( vertexSource, fragmentSourceElliptical, GeometryType( GEOMETRY_TYPE_IMAGE ), ShaderEffect::GeometryHints( ShaderEffect::HINT_NONE ));
-      break;
-
-    case FIXED:
-    default:
-      shader = ShaderEffect::New( vertexSource, fragmentSourceFixed, GeometryType( GEOMETRY_TYPE_IMAGE ), ShaderEffect::GeometryHints( ShaderEffect::HINT_NONE ));
-      break;
-  }
-  SoftButtonEffect handle( shader );
-
-
-  //////////////////////////////////////
-  // Register uniform properties
-  //
-  //
-
-  // factors that scale the look, defaults
-  handle.SetUniform(SOFT_BUTTON_AMBIENT_LIGHT_AMOUNT_PROPERTY_NAME, SOFT_BUTTON_AMBIENT_LIGHT_AMOUNT_DEFAULT);
-  handle.SetUniform(SOFT_BUTTON_DIFFUSE_LIGHT_PROPERTY_NAME, SOFT_BUTTON_DIFFUSE_LIGHT_DEFAULT);
-  handle.SetUniform(SOFT_BUTTON_LIGHTING_MULTIPLIER_PROPERTY_NAME, SOFT_BUTTON_LIGHTING_MULTIPLIER_DEFAULT);
-  if(FIXED != type)
-  {
-    handle.SetUniform(SOFT_BUTTON_LIGHTING_INDENTATION_AMOUNT_PROPERTY_NAME, SOFT_BUTTON_LIGHTING_INDENTATION_AMOUNT_DEFAULT);
-    handle.SetUniform(SOFT_BUTTON_TEXTURE_DISTORTION_AMOUNT_PROPERTY_NAME, SOFT_BUTTON_TEXTURE_DISTORTION_AMOUNT_DEFAULT);
-    handle.SetUniform(SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME, SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_DEFAULT);
-    handle.SetUniform(SOFT_BUTTON_RECIP_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME, 1.0f / SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_DEFAULT);
-    handle.SetUniform(SOFT_BUTTON_OUTSIDE_SHAPE_DEPTH_PROPERTY_NAME, SOFT_BUTTON_OUTSIDE_SHAPE_DEPTH_DEFAULT);
-    handle.SetUniform(SOFT_BUTTON_EFFECT_PIXEL_AREA_PROPERTY_NAME, SOFT_BUTTON_EFFECT_PIXEL_AREA_DEFAULT);
-    if(RECTANGULAR == type)
-    {
-      handle.SetUniform(SOFT_BUTTON_RECTANGLE_SIZE_SCALE_PROPERTY_NAME, SOFT_BUTTON_RECTANGLE_SIZE_SCALE_DEFAULT);
-    }
-
-    // precalc 1.0 / uInsideCircleSizeScale on CPU to save shader insns, using constraint to tie to the normal property
-    Dali::Property::Index insideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME);
-    Dali::Property::Index recipInsideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_RECIP_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME);
-    Constraint constraint = Constraint::New<float>( handle, recipInsideCircleSizeScalePropertyIndex, InverseConstraint );
-    constraint.AddSource( LocalSource(insideCircleSizeScalePropertyIndex) );
-    constraint.Apply();
-  }
-
-  return handle;
-}
-
-const std::string& SoftButtonEffect::GetLightingIndentationAmountPropertyName() const
-{
-  return SOFT_BUTTON_LIGHTING_INDENTATION_AMOUNT_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetTextureDistortionAmountPropertyName() const
-{
-  return SOFT_BUTTON_TEXTURE_DISTORTION_AMOUNT_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetAmbientLightAmountPropertyName() const
-{
-  return SOFT_BUTTON_AMBIENT_LIGHT_AMOUNT_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetDiffuseLightPropertyName() const
-{
-  return SOFT_BUTTON_DIFFUSE_LIGHT_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetLightingMultiplierPropertyName() const
-{
-  return SOFT_BUTTON_LIGHTING_MULTIPLIER_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetInsideShapeSizeScalePropertyName() const
-{
-  return SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetOutsideShapeDepthPropertyName() const
-{
-  return SOFT_BUTTON_OUTSIDE_SHAPE_DEPTH_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetEffectPixelAreaPropertyName() const
-{
-  return SOFT_BUTTON_EFFECT_PIXEL_AREA_PROPERTY_NAME;
-}
-
-const std::string& SoftButtonEffect::GetRectangleSizeScalePropertyName() const
-{
-  return SOFT_BUTTON_RECTANGLE_SIZE_SCALE_PROPERTY_NAME;
-}
-
-}
-
-}
index 2464aa0..710537e 100644 (file)
@@ -28,13 +28,15 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new soft button shader effect
  *
- * Class for soft button shader that works on a per object basis. Using animatable parameters user can create effect of button pushing in / out. Can be applied to ImageActor only.
+ * Soft button shader effect works on a per object basis. Using animatable parameters user can create
+ * effect of button pushing in / out. Can be applied to ImageActor only.
  *
  * Usage example:-
  *
  * // Create shader used for doing soft button\n
- * SoftButtonEffect softButtonEffect = SoftButtonEffect::New();
+ * ShaderEffect softButtonEffect = CreateSoftButtonEffect();
  *
  * // set image actor shader to the soft button one\n
  * ImageActor imageActor = ImageActor::New( ... );\n
@@ -42,133 +44,359 @@ namespace Toolkit
  *
  * // animate a button push, using e.g. AlphaFunction::BOUNCE. With these values the button pushes in and pops out slightly at the end\n
  * Animation animation = Animation::New( ... );\n
- * animation.AnimateTo( Property(softButtonEffect, softButtonEffect.GetLightingIndentationAmountPropertyName()), 0.25f, AlphaFunction::BOUNCE, ... );\n
- * animation.AnimateTo( Property(softButtonEffect, softButtonEffect.GetLightingIndentationAmountPropertyName()), -0.05f, AlphaFunction::BOUNCE, ... );\n
- * animation.AnimateTo( Property(softButtonEffect, softButtonEffect.GetTextureDistortionAmountPropertyName()), 0.25f, AlphaFunction::BOUNCE, ... );\n
- * animation.AnimateTo( Property(softButtonEffect, softButtonEffect.GetTextureDistortionAmountPropertyName()), -0.05f, AlphaFunction::BOUNCE, ... );\n
+ * animation.AnimateTo( Property(softButtonEffect, "uLightingIndentationAmount), 0.25f, AlphaFunction::BOUNCE, ... );\n
+ * animation.AnimateTo( Property(softButtonEffect, "uLightingIndentationAmount"), -0.05f, AlphaFunction::BOUNCE, ... );\n
+ * animation.AnimateTo( Property(softButtonEffect, "uTextureDistortAmount"), 0.25f, AlphaFunction::BOUNCE, ... );\n
+ * animation.AnimateTo( Property(softButtonEffect, "uTextureDistortAmount"), -0.05f, AlphaFunction::BOUNCE, ... );\n
  * animation.Play();\n
  *
+ * Animatable/Constrainable uniforms:
+ *
+ *  "uLightingIndentationAmount"  - This property changes the lighting, to make it look like the button is pushed in. User should animate
+ *                                  this in conjunction with texture distortion. Allowable values range from [-1..1], higher values give
+ *                                  more change in lighting. Default 0.0 (no lighting change).
+ *  "uTextureDistortAmount"       - This property changes the distortion, to make it look like the button is pushed in. User should animate
+ *                                  this in conjunction with lighting indentation. Allowable values range from [-1..1) - note 1.0 is NOT
+ *                                  allowed - higher values give more distortion. Default 0.0 (no distortion).
+ *  "uAmbientLight"               - The ambient light is used in the lighting calculation. Care must be taken to not saturate the image by
+ *                                  setting this value too high, or the indentation will not look correct. Default 0.15
+ *  "uDiffuseLight"               - The diffuse light is used in the lighting calculation. Default is (0.0, 0.7070168, 0.7070168),
+ *                                  i.e. a light angled at the surface from in front and above. Note that you need to Normalize()
+ *                                  the Vector3 that you set with this property
+ *  "uLightMultiplier"            - The ambient and diffuse lighting is multiplied by this factor. Since a diffuse light at an angle will
+ *                                  cause the whole image to darken, even outside the soft button indentation, this property can be used
+ *                                  to scale the image back up closer to the pixel values of the original diffuse texture. Care must be
+ *                                  taken to not saturate the image,or the indentation will not look correct. Default 1.2.
+ *  "uInsideCircleSizeScale"      - The SoftButtonEffect consists of two shapes, one inside the other. The outside shape fits exactly to
+ *                                  the actor, touching its edges but completely contained. The inside shape size is given by a multiplier
+ *                                  of the outside shape size. For example a value of 0.5 means that the inside shape is half the size of
+ *                                  the outside one. Allowable values are in the range (0.0 - 1.0), note that 0.0 and 1.0 themselves are
+ *                                  not allowed. Default 0.75.
+ *  "uOutsideCircleDepth"         - The SoftButtonEffect consists of two shapes, one inside the other. The depth of the indentation at the
+ *                                  transition between the inside and outside shapes is controlled by this property. The values lies in the
+ *                                  range [0.0 - 1.0]. A value of 0.0 means the outside shape has no depth (and is thus invisible), value of
+ *                                  1.0 means the outside shape has maximum depth (and the inside shape is thus invisible). Default 0.05
+ *  "uEffectRegion"               - The soft button effect is applied within the supplied rect region of the texture. Default values for this
+ *                                  is (0.0, 0.0, 1.0, 1.0) which is the entire image with 0,0 being the top left and 1.0, 1.0 being the bottom
+ *                                  right. If the image texture is split between multiple ImageActors then the developer should specify the pixel
+ *                                  area of the texture the effect should be applied with. Example, If the Image is split among two ImageActors
+ *                                  side by side, with the left one using left half of the texture and right one using the right half of the
+ *                                  texture then the pixel area value for the left ImageActor will be (0.0, 0.0, 0.5, 1.0) and the pixel area for
+ *                                  the right will be (0.5,0.0,1.0,1.0).
+ * "uRectangleSizeScale"          - This property can be used to set the mix between proportion of rectangle and proportion of ellipse - the
+ *                                  result is a rectangle with rounded corners. If the value is 0.0, the shape is an ellipse. If the value is
+ *                                  close to 1.0, the shape is close to a rectangle. The value lies in the range [0.0 - 1.0). Note that a value
+ *                                  of 1.0 is NOT allowed.Default 0.5.
+ *
+ * @param type The type of the soft button, can be either ELLIPTICAL, RECTANGULAR, or FIXED.
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API SoftButtonEffect : public ShaderEffect
+typedef enum
 {
+  SOFT_BUTTON_ELLIPTICAL = 0,   /// Button is elliptical
+  SOFT_BUTTON_RECTANGULAR,      /// Button is rectangular
+  SOFT_BUTTON_FIXED             /// Button does not indent (move). Useful for matching lighting between areas that do not indent (which can thus use a cheaper shader) and those that do indent.
+}SoftButtonEffectType;
+
+static void InverseConstraint( float& current, const PropertyInputContainer& inputs )
+{
+  current = 1.0f / inputs[0]->GetFloat();
+}
+
+inline ShaderEffect CreateSoftButtonEffect(SoftButtonEffectType type)
+{
+  std::string vertexSource;
+  vertexSource =  "precision mediump float;\n"
+      "uniform vec3 uDiffuseLight;\n"
+      "uniform float uAmbientLight;\n"
+      "uniform float uLightMultiplier;\n"
+      "uniform vec4 uEffectRegion;\n"
+      "varying vec2 vCentredCoord;\n"
+
+      "const vec3 norm = vec3(0.0, 0.0, 1.0);\n"
+
+      "void main()\n"
+      "{\n"
+      "  vTexCoord = aTexCoord;\n"
+      // Get the rect coords of the effect region in -1..1 range, i.e. circle centred around the center of the rect
+      // Done in the vertex shader itself to make use of gl interpolation for varying.
+      "  vCentredCoord = vec2( ( (vTexCoord.x - uEffectRegion.x)/(uEffectRegion.z - uEffectRegion.x) * 2.0 - 1.0 ), ( (vTexCoord.y - uEffectRegion.y)/(uEffectRegion.w - uEffectRegion.y) * 2.0 - 1.0  ) );\n"
+      "  gl_Position = uMvpMatrix * vec4(aPosition, 1.0);\n"
+      "}\n";
+
+  std::string fragmentSourceFixed;
+  fragmentSourceFixed =  "precision mediump float;\n"
+
+      "uniform vec3 uDiffuseLight;\n"
+      "uniform float uAmbientLight;\n"
+      "uniform float uLightMultiplier;\n"
+      "varying vec2 vCentredCoord;\n"
+
+      "const vec3 norm = vec3(0.0, 0.0, 1.0);\n"
+
+      "void main()\n"
+      "{\n"
+      "   vec4 col = texture2D(sTexture, vTexCoord);\n"
+      // calc lighting
+      "   float lighting = (dot(uDiffuseLight, norm) + uAmbientLight) * uLightMultiplier;\n"
+      // output col = image * light
+      // use the lighting value for colors only
+      "   gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
+      "}\n";
+
+  std::string fragmentSourceElliptical;
+  fragmentSourceElliptical =  "precision mediump float;\n"
+
+      "uniform float uLightingIndentationAmount;\n"
+      "uniform float uTextureDistortAmount;\n"
+      "uniform vec3 uDiffuseLight;\n"
+      "uniform float uAmbientLight;\n"
+      "uniform float uLightMultiplier;\n"
+      "uniform float uInsideCircleSizeScale;\n"
+      "uniform float uRecipInsideCircleSizeScale;\n"
+      "uniform float uOutsideCircleDepth;\n"
+      "uniform vec4 uEffectRegion;\n"
+      "varying vec2 vCentredCoord;\n"
+
+      "const float PI = 3.1415927;\n"
+
+      "void main()\n"
+      "{\n"
+      // Apply distortion only if the pixel is within the rect specified
+      "if( (vTexCoord.x > uEffectRegion.x) && (vTexCoord.x < uEffectRegion.z) && (vTexCoord.y > uEffectRegion.y) && (vTexCoord.y < uEffectRegion.w) )\n"
+      "{\n"
+      "   vec2 coord = vCentredCoord;\n"
+
+      // find a coordinate representing distance from circle centre, such that we split into inside / outside circles that can have different gradients / normals
+      "   float realDistFromCentre = length(coord);\n"
+      "   realDistFromCentre = min(1.0, realDistFromCentre);\n" // clamp corners of square to vertical normal
+      "   float distFromCentre;\n"
+      "   if(realDistFromCentre <= uInsideCircleSizeScale)\n"
+      "   {\n"
+      "     distFromCentre = realDistFromCentre * uRecipInsideCircleSizeScale * (1.0 - uOutsideCircleDepth);\n" // inside circle indent, up to outline depth
+      "   }\n"
+      "   else                                                                                                                      \n"
+      "   {\n"
+      "     distFromCentre = mix(1.0 - uOutsideCircleDepth, 1.0, (realDistFromCentre - ( uInsideCircleSizeScale)) / (1.0 - uInsideCircleSizeScale));\n" // outside circle
+      "   }\n"
 
-public:
+      // get coords in -PI..PI range, i.e. scale the circle for use by trig functions
+      "  coord *= PI;\n"
 
-  /**
-   * Create an uninitialized SoftButtonEffect; this can be initialized with SoftButtonEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  SoftButtonEffect();
+      // get a z value for the distorted surface in 0..1 range, using cos for a smooth curve (note, we ignore inside / outside circles since the difference isn't noticeable visually)
+      "   vec2 cosThetaCoord = (cos(coord) * 0.5) + 0.5;\n"
+      "   float z = cosThetaCoord.x * cosThetaCoord.y;\n"
 
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~SoftButtonEffect();
+      // get the normal for the distorted surface, using the fact that the derivative of cos is -sin, finding tangent vector from slope and then normal by cross product...
+      "   float sinThetaCoord = sin(distFromCentre*PI) * uLightingIndentationAmount;\n" // slope, so tangent vec is (1.0, -sin)
+      // ...2D normal vector along distFromCentre vec is (sin, 1.0), convert to components in 3D.
+      "   vec3 norm = normalize(vec3(coord.x * sinThetaCoord, coord.y * sinThetaCoord, 1.0));\n"
 
-  typedef enum
+      // form surface z and project texture onto it.
+      "   float indentAmount = 1.0 / (1.0 - (z * uTextureDistortAmount));\n"
+      "   vec2 distortedCoord = vCentredCoord * indentAmount;\n"
+
+      // Convert the rect coordinates in -1 to 1 range back to the original coordinates
+      "   vec2 texCoord = vec2( ( (distortedCoord.x + 1.0)*(0.5) * (uEffectRegion.z - uEffectRegion.x) + uEffectRegion.x ), ( (distortedCoord.y + 1.0)*(0.5) * (uEffectRegion.w - uEffectRegion.y) + uEffectRegion.y  ) );  \n"
+      "   vec4 col = texture2D(sTexture, texCoord);\n"
+
+      // calc lighting
+      "   float lighting = (dot(uDiffuseLight, norm) + uAmbientLight) * uLightMultiplier;\n"
+      "  gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
+      "}\n"
+      "else\n"
+      "{\n"
+      "  vec4 col = texture2D(sTexture, vTexCoord);\n"
+      "  float lighting = (dot(uDiffuseLight, vec3(0.0, 0.0, 1.0)) + uAmbientLight) * uLightMultiplier;\n"
+      "  gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
+      "}\n"
+      "}\n";
+
+  std::string fragmentSourceRectangular;
+  fragmentSourceRectangular =  "precision mediump float;\n"
+
+      "uniform float uLightingIndentationAmount;\n"
+      "uniform float uTextureDistortAmount;\n"
+      "uniform vec3 uDiffuseLight;\n"
+      "uniform float uAmbientLight;\n"
+      "uniform float uLightMultiplier;\n"
+      "uniform float uInsideCircleSizeScale;\n"
+      "uniform float uRecipInsideCircleSizeScale;\n"
+      "uniform float uOutsideCircleDepth;\n"
+      "uniform float uRectangleSizeScale;\n"
+      "uniform vec4 uEffectRegion;\n"
+      "varying vec2 vCentredCoord;\n"
+
+      "const float PI = 3.1415927;\n"
+
+      "void main()\n"
+      "{\n"
+      // Apply distortion only if the pixel is within the rect specified
+      "if( (vTexCoord.x > uEffectRegion.x) && (vTexCoord.x < uEffectRegion.z) && (vTexCoord.y > uEffectRegion.y) && (vTexCoord.y < uEffectRegion.w) )\n"
+      "{ \n"
+      // get the rect coords to -1..1 range, i.e. circle centred around the center of the rect
+      "   vec2 centredCoord = vCentredCoord;\n"
+      // clamp coords such that the circle is split into 4 pieces that lie in the corners of the actor. uRectangleScale is the distance along each axis from the centre
+      // of the actor, e.g. 0.5 is half way along an axis from centre to actor edge.
+      "   vec2 clampedCoord;\n"
+      "   if(centredCoord.x > 0.0)\n"
+      "   {\n"
+      "     if(centredCoord.x < uRectangleSizeScale)\n"
+      "     {\n"
+      // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
+      "       clampedCoord.x = 0.0;\n"
+      "     }\n"
+      "     else\n"
+      "     {\n"
+      // we are outside rectangular region along this axis, so we want curvature.
+      "       clampedCoord.x = smoothstep(0.0, 1.0, (centredCoord.x - uRectangleSizeScale) / (1.0 - uRectangleSizeScale));\n"
+      "     }\n"
+      "   }\n"
+      "   else\n"
+      "   {\n"
+      "     if(centredCoord.x > -uRectangleSizeScale)\n"
+      "     {\n"
+      // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
+      "       clampedCoord.x = 0.0;\n"
+      "     }\n"
+      "     else\n"
+      "     {\n"
+      // we are outside rectangular region along this axis, so we want curvature.
+      "       clampedCoord.x = -smoothstep(0.0, 1.0, (centredCoord.x + uRectangleSizeScale) / (uRectangleSizeScale - 1.0));\n"
+      "     }\n"
+      "   }\n"
+      "   if(centredCoord.y > 0.0)\n"
+      "   {\n"
+      "     if(centredCoord.y < uRectangleSizeScale)\n"
+      "     {\n"
+      // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
+      "       clampedCoord.y = 0.0;\n"
+      "     }\n"
+      "     else\n"
+      "     {\n"
+      // we are outside rectangular region along this axis, so we want curvature.
+      "       clampedCoord.y = smoothstep(0.0, 1.0, (centredCoord.y - uRectangleSizeScale) / (1.0 - uRectangleSizeScale));\n"
+      "     }\n"
+      "   }\n"
+      "   else\n"
+      "   {\n"
+      "     if(centredCoord.y > -uRectangleSizeScale)\n"
+      "     {\n"
+      // we are in a rectangular region along this axis, clamp coord to be same as centre pixel
+      "       clampedCoord.y = 0.0;\n"
+      "     }\n"
+      "     else\n"
+      "     {\n"
+      // we are outside rectangular region along this axis, so we want curvature.
+      "       clampedCoord.y = -smoothstep(0.0, 1.0, (centredCoord.y + uRectangleSizeScale) / (uRectangleSizeScale - 1.0));\n"
+      "     }\n"
+      "   }\n"
+      // get coords in -PI..PI range, i.e. scale above circle for use by trig functions
+      "   vec2 thetaCoord = clampedCoord * PI;\n"
+      // get a z value for the distorted surface in 0..1 range, using cos for a smooth curve (note, we ignore inside / outside circles since the difference isn't noticeable visually)
+      "   vec2 cosThetaCoord = (cos(thetaCoord) * 0.5) + 0.5;\n"
+      "   float z = cosThetaCoord.x * cosThetaCoord.y;\n"
+      // find a coordinate representing distance from circle centre, such that we split into inside / outside circles that can have different gradients / normals
+      "   float realDistFromCentre = length(thetaCoord);\n"
+      "   realDistFromCentre = min(PI, realDistFromCentre);\n" // clamp corners of square to vertical normal
+      "   float distFromCentre;\n"
+      "   if(realDistFromCentre <= PI * uInsideCircleSizeScale)\n"
+      "   {\n"
+      "     distFromCentre = realDistFromCentre * uRecipInsideCircleSizeScale * (PI - (uOutsideCircleDepth * PI)) / PI;\n" // inside circle indent, up to outline depth
+      "   }\n"
+      "   else\n"
+      "   {\n"
+      "     distFromCentre = mix(PI - (uOutsideCircleDepth * PI), PI, (realDistFromCentre - ( PI * uInsideCircleSizeScale)) / (PI - (PI * uInsideCircleSizeScale)));\n" // outside circle
+      "   }\n"
+      // get the normal for the distorted surface, using the fact that the derivative of cos is -sin, finding tangent vector from slope and then normal by cross product...
+      "   float sinThetaCoord = sin(distFromCentre) * uLightingIndentationAmount;\n" // slope, so tangent vec is (1.0, -sin)
+      // ...2D normal vector along distFromCentre vec is (sin, 1.0), convert to components in 3D.
+      "   vec3 norm = normalize(vec3(thetaCoord.x * sinThetaCoord, thetaCoord.y * sinThetaCoord, 1.0));\n"
+      // form surface z and project texture onto it.
+      "   float indentAmount = 1.0 / (1.0 - (z * uTextureDistortAmount));\n"
+      "   vec2 distortedCoord = centredCoord * indentAmount;\n"
+      // Convert the rect coordinates in -1 to 1 range back to the original coordinates
+      "   vec2 texCoord = vec2( ( (distortedCoord.x + 1.0)/(2.0) * (uEffectRegion.z - uEffectRegion.x) + uEffectRegion.x ), ( (distortedCoord.y + 1.0)/(2.0) * (uEffectRegion.w - uEffectRegion.y) + uEffectRegion.y  ) );\n"
+      "   vec4 col = texture2D(sTexture, texCoord);\n"
+      // calc lighting
+      "   float lighting = (dot(uDiffuseLight, norm) + uAmbientLight) * uLightMultiplier;\n"
+      // output col = image * light
+      // use the lighting value for colors only
+      "   gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
+
+      "}\n"
+      "else\n"
+      "{\n"
+      "   vec4 col = texture2D(sTexture, vTexCoord);\n"
+      "   float lighting = (dot(uDiffuseLight, vec3(0.0, 0.0, 1.0)) + uAmbientLight) * uLightMultiplier;\n"
+      "   gl_FragColor = vec4(col.rgb * uColor.rgb * lighting, col.a * uColor.a);\n"
+      "} \n"
+      "}\n";
+
+
+  //////////////////////////////////////
+  // Create shader effectCreateSoftButtonEffect
+  //
+  //
+
+  ShaderEffect shader;
+  switch(type)
   {
-    ELLIPTICAL = 0,   /// Button is elliptical
-    RECTANGULAR,      /// Button is rectangular
-    FIXED             /// Button does not indent (move). Useful for matching lighting between areas that do not indent (which can thus use a cheaper shader) and those that do indent.
-  }Type;
-
-  /**
-   * Create an initialized SoftButtonEffect
-   * @param type The type of the soft button, can be either ELLIPTICAL, RECTANGULAR, or FIXED.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static SoftButtonEffect New(Type type);
-
-  /**
-   * Get the name for the lighting indentation amount property (float). Useful for animation.
-   * This property changes the lighting, to make it look like the button is pushed in. User should animate this in conjunction
-   * with texture distortion. Allowable values range from [-1..1], higher values give more change in lighting. Default 0.0 (no lighting change).
-   * See also GetTextureDistortionAmountPropertyName().
-   * @return A std::string containing the property name
-   */
-  const std::string& GetLightingIndentationAmountPropertyName() const;
-
-  /**
-   * Get the name for the texture distortion amount property (float). Useful for animation.
-   * This property changes the distortion, to make it look like the button is pushed in. User should animate this is conjunction
-   * with lighting indentation. Allowable values range from [-1..1) - note 1.0 is NOT allowed - higher values give more distortion. Default 0.0 (no distortion).
-   * See also GetLightingIndentationAmountPropertyName().
-   * @return A std::string containing the property name
-   */
-  const std::string& GetTextureDistortionAmountPropertyName() const;
-
-  /**
-   * Get the name for the ambient lighting amount property (float)
-   * The ambient light is used in the lighting calculation. Care must be taken to not saturate the image by setting this value too high,
-   * or the indentation will not look correct. Default 0.15.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAmbientLightAmountPropertyName() const;
-
-  /**
-   * Get the name for the diffuse light property (Vector3).
-   * The diffuse light is used in the lighting calculation. Default is (0.0, 0.7070168, 0.7070168), i.e. a light angled at the surface from in front and above. Note that
-   * you need to Normalize() the Vector3 that you set with this property.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetDiffuseLightPropertyName() const;
-
-  /**
-   * Get the name for the lighting multiplier property (float).
-   * The ambient and diffuse lighting is multiplied by this factor. Since a diffuse light at an angle will cause the whole image to darken, even outside the soft button
-   * indentation, this property can be used to scale the image back up closer to the pixel values of the original diffuse texture. Care must be taken to not saturate the image,
-   * or the indentation will not look correct. Default 1.2.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetLightingMultiplierPropertyName() const;
-
-  /**
-   * Get the name for the inside shape size scale property (float).
-   * The SoftButtonEffect consists of two shapes, one inside the other. The outside shape fits exactly to the actor, touching its edges but completely contained. The inside
-   * shape size is given by a multiplier of the outside shape size. For example a value of 0.5 means that the inside shape is half the size of the outside one. Allowable
-   * values are in the range (0.0 - 1.0), note that 0.0 and 1.0 themselves are not allowed. Default 0.75.
-   * See also GetOutsideShapeDepthPropertyName().
-   * @return A std::string containing the property name
-   */
-  const std::string& GetInsideShapeSizeScalePropertyName() const;
-
-  /**
-   * Get the name for the outside shape depth property (float).
-   * The SoftButtonEffect consists of two shapes, one inside the other. The depth of the indentation at the transition between the inside and outside shapes is controlled by
-   * this property. The values lies in the range [0.0 - 1.0]. A value of 0.0 means the outside shape has no depth (and is thus invisible), value of 1.0 means the outside shape
-   * has maximum depth (and the inside shape is thus invisible). Default 0.05.
-   * See also GetInsideShapeSizeScalePropertyName().
-   * @return A std::string containing the property name
-   */
-  const std::string& GetOutsideShapeDepthPropertyName() const;
-
-  /**
-   * Get the name for the effect pixel area property (Vector4).
-   * The soft button effect is applied within the supplied rect region of the texture. Default values for this is (0.0, 0.0, 1.0, 1.0) which is the entire image with
-   * 0,0 being the top left and 1.0, 1.0 being the bottom right. If the image texture is split between multiple ImageActors then the developer should specify the
-   * pixel area of the texture the effect should be applied with. Example, If the Image is split among two ImageActors side by side, with the left one using left half of the
-   * texture and right one using the right half of the texture then the pixel area value for the left ImageActor will be (0.0, 0.0, 0.5, 1.0) and the pixel area for the right
-   * will be (0.5, 0.0, 1.0, 1.0).
-   * @return A std::string containing the property name
-   */
-  const std::string& GetEffectPixelAreaPropertyName() const;
-
-  /**
-   * Get the name for the rectangle size scale property (float). Only applicable having created this SoftButtonEffect via a call to New() with RECTANGULAR as the type.
-   * This property can be used to set the mix between proportion of rectangle and proportion of ellipse - the result is a rectangle with rounded corners. If the value is 0.0,
-   * the shape is an ellipse. If the value is close to 1.0, the shape is close to a rectangle. The value lies in the range [0.0 - 1.0). Note that a value of 1.0 is NOT allowed.
-   * Default 0.5.
-   * @return A std::string containing the property name
-   */
-  const std::string& GetRectangleSizeScalePropertyName() const;
-
-
-private:
-  // Not intended for application developers
-  DALI_INTERNAL SoftButtonEffect(ShaderEffect handle);
-};
+    case SOFT_BUTTON_RECTANGULAR:
+      shader = ShaderEffect::New( vertexSource, fragmentSourceRectangular, ShaderEffect::GeometryHints( ShaderEffect::HINT_NONE ));
+      break;
+
+    case SOFT_BUTTON_ELLIPTICAL:
+      shader = ShaderEffect::New( vertexSource, fragmentSourceElliptical, ShaderEffect::GeometryHints( ShaderEffect::HINT_NONE ));
+      break;
+
+    case SOFT_BUTTON_FIXED:
+    default:
+      shader = ShaderEffect::New( vertexSource, fragmentSourceFixed, ShaderEffect::GeometryHints( ShaderEffect::HINT_NONE ));
+      break;
+  }
+
+  //////////////////////////////////////
+  // Register uniform properties
+  //
+  //
+  static const float SOFT_BUTTON_LIGHTING_INDENTATION_AMOUNT_DEFAULT = 0.0f;
+  static const float SOFT_BUTTON_TEXTURE_DISTORTION_AMOUNT_DEFAULT = 0.0f;
+  static const float SOFT_BUTTON_AMBIENT_LIGHT_AMOUNT_DEFAULT = 0.15f;
+  static const Vector3 SOFT_BUTTON_DIFFUSE_LIGHT_DEFAULT = Vector3(0.0f, 0.7070168f, 0.7071068f);
+  static const float SOFT_BUTTON_LIGHTING_MULTIPLIER_DEFAULT = 1.2f;
+  static const float SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_DEFAULT = 0.75f;
+  static const float SOFT_BUTTON_OUTSIDE_SHAPE_DEPTH_DEFAULT = Math::PI * 0.05f;
+  static const Vector4 SOFT_BUTTON_EFFECT_PIXEL_AREA_DEFAULT = Vector4(0.0f, 0.0f, 1.0f, 1.0f);
+  static const float SOFT_BUTTON_RECTANGLE_SIZE_SCALE_DEFAULT = 0.5f;
+
+  // factors that scale the look, defaults
+  shader.SetUniform("uAmbientLight", SOFT_BUTTON_AMBIENT_LIGHT_AMOUNT_DEFAULT);
+  shader.SetUniform("uDiffuseLight", SOFT_BUTTON_DIFFUSE_LIGHT_DEFAULT);
+  shader.SetUniform("uLightMultiplier", SOFT_BUTTON_LIGHTING_MULTIPLIER_DEFAULT);
+  if(SOFT_BUTTON_FIXED != type)
+  {
+    shader.SetUniform("uLightingIndentationAmount", SOFT_BUTTON_LIGHTING_INDENTATION_AMOUNT_DEFAULT);
+    shader.SetUniform("uTextureDistortAmount", SOFT_BUTTON_TEXTURE_DISTORTION_AMOUNT_DEFAULT);
+    shader.SetUniform("uInsideCircleSizeScale", SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_DEFAULT);
+    shader.SetUniform("uRecipInsideCircleSizeScale", 1.0f / SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_DEFAULT);
+    shader.SetUniform("uOutsideCircleDepth", SOFT_BUTTON_OUTSIDE_SHAPE_DEPTH_DEFAULT);
+    shader.SetUniform("uEffectRegion", SOFT_BUTTON_EFFECT_PIXEL_AREA_DEFAULT);
+    if(SOFT_BUTTON_RECTANGULAR == type)
+    {
+      shader.SetUniform("uRectangleSizeScale", SOFT_BUTTON_RECTANGLE_SIZE_SCALE_DEFAULT);
+    }
+
+    // precalc 1.0 / uInsideCircleSizeScale on CPU to save shader insns, using constraint to tie to the normal property
+    Dali::Property::Index insideCircleSizeScalePropertyIndex = shader.GetPropertyIndex("uInsideCircleSizeScale");
+    Dali::Property::Index recipInsideCircleSizeScalePropertyIndex = shader.GetPropertyIndex("uRecipInsideCircleSizeScale");
+    Constraint constraint = Constraint::New<float>( shader, recipInsideCircleSizeScalePropertyIndex, InverseConstraint );
+    constraint.AddSource( LocalSource(insideCircleSizeScalePropertyIndex) );
+    constraint.Apply();
+  }
+
+  return shader;
+}
 
 }
 
diff --git a/dali-toolkit/devel-api/shader-effects/spot-effect.cpp b/dali-toolkit/devel-api/shader-effects/spot-effect.cpp
deleted file mode 100644 (file)
index 4400cad..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/spot-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const float DEFAULT_RADIUS = 0.0f;
-const std::string CENTER_PROPERTY_NAME( "uCenter" );
-const std::string RADIUS_PROPERTY_NAME( "uRadius" );
-
-} // namespace
-
-SpotEffect::SpotEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-SpotEffect::SpotEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-SpotEffect::~SpotEffect()
-{
-}
-
-SpotEffect SpotEffect::New()
-{
-  // append the default version
-  std::string vertexShader(
-      "uniform mediump   vec2  uCenter;\n"
-      "uniform mediump   float  uRadius;\n"
-      "varying mediump   float  vRange;\n"
-      "\n"
-      "void main()\n"
-      "{\n"
-      "  mediump vec4 world = vec4(aPosition, 1.0);\n"
-      "  \n"
-      "  mediump vec2 d = vec2(world.xy - uCenter);\n"
-      "  mediump float dist = length(d);\n"
-      "  \n"
-      "  mediump float range = (uRadius - dist) / (uRadius);\n"
-      "  vRange = max(0.1, range);\n"
-      "  \n"
-      "  gl_Position = uMvpMatrix * world;\n"
-      "  vTexCoord = aTexCoord;\n"
-      "}");
-
-  std::string fragmentShader(
-      "varying mediump   float  vRange;\n"
-      "\n"
-      "void main()\n"
-      "{\n"
-      "  gl_FragColor = texture2D(sTexture, vTexCoord) * vec4(vRange, vRange, vRange, 1.0) * uColor;\n"
-      "}" );
-
-  // Create the implementation, temporarily owned on stack
-  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(vertexShader, fragmentShader,
-                                                             Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
-                                                             ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID ));
-
-  /* Pass ownership to SpotEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::SpotEffect handle( shaderEffect );
-
-  handle.SetUniform( CENTER_PROPERTY_NAME, Vector2(0.0f, 0.0f) );
-  handle.SetUniform( RADIUS_PROPERTY_NAME, DEFAULT_RADIUS );
-
-  return handle;
-
-}
-
-void SpotEffect::SetCenter(const Vector2& center)
-{
-  SetUniform( CENTER_PROPERTY_NAME, center );
-}
-
-void SpotEffect::SetRadius(float radius)
-{
-  SetUniform( RADIUS_PROPERTY_NAME, radius );
-}
-
-const std::string& SpotEffect::GetCenterPropertyName() const
-{
-  return CENTER_PROPERTY_NAME;
-}
-
-const std::string& SpotEffect::GetRadiusPropertyName() const
-{
-  return RADIUS_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 0788309..7880421 100644 (file)
@@ -28,58 +28,55 @@ namespace Toolkit
 {
 
 /**
- * SpotEffect2D is a custom shader effect to achieve spot effects on Image actors
+ * @brief Creates a new SpotEffect
+ *
+ * SpotEffect is a custom shader effect to achieve spot effects on Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uCenter" - The center of the spot. Default value (0.0,0.0)
+ *  "uRadius" - The radius of the spot. Default value 0.0
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API SpotEffect : public ShaderEffect
+inline ShaderEffect CreateSpotEffect()
 {
-public:
-
-  /**
-   * Create an uninitialized SpotEffect; this can be initialized with SpotEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  SpotEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~SpotEffect();
-
-  /**
-   * Create an initialized SpotEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static SpotEffect New();
-
-  /**
-   * Set the center of the spot.
-   * @param[in] center The center in Vector2.
-   */
-  void SetCenter(const Vector2& center);
-
-  /**
-   * Set the radius of the spot.
-   * @param[in] radius The radius in float.
-   */
-  void SetRadius(float radius);
-
-  /**
-   * Get the name for the center property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCenterPropertyName() const;
-
-  /**
-   * Get the name for the radius property
-   * @return A std::string containing the property name
-   */
-  const std::string& GetRadiusPropertyName() const;
-
-private:
-  DALI_INTERNAL SpotEffect(ShaderEffect handle);
-};
+  // append the default version
+  std::string vertexShader(
+      "uniform mediump   vec2  uCenter;\n"
+      "uniform mediump   float  uRadius;\n"
+      "varying mediump   float  vRange;\n"
+      "\n"
+      "void main()\n"
+      "{\n"
+      "  mediump vec4 world = vec4(aPosition, 1.0);\n"
+      "  \n"
+      "  mediump vec2 d = vec2(world.xy - uCenter);\n"
+      "  mediump float dist = length(d);\n"
+      "  \n"
+      "  mediump float range = (uRadius - dist) / (uRadius);\n"
+      "  vRange = max(0.1, range);\n"
+      "  \n"
+      "  gl_Position = uMvpMatrix * world;\n"
+      "  vTexCoord = aTexCoord;\n"
+      "}");
+
+  std::string fragmentShader(
+      "varying mediump   float  vRange;\n"
+      "\n"
+      "void main()\n"
+      "{\n"
+      "  gl_FragColor = texture2D(sTexture, vTexCoord) * vec4(vRange, vRange, vRange, 1.0) * uColor;\n"
+      "}" );
+
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      vertexShader, fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID ));
+
+  shaderEffect.SetUniform( "uCenter", Vector2(0.0f, 0.0f) );
+  shaderEffect.SetUniform( "uRadius", 0.0f );
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/square-dissolve-effect.cpp b/dali-toolkit/devel-api/shader-effects/square-dissolve-effect.cpp
deleted file mode 100644 (file)
index b60b337..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/square-dissolve-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string STEP_PROPERTY_NAME( "uStep" );
-const std::string ROWS_PROPERTY_NAME( "uRows" );
-const std::string COLUMNS_PROPERTY_NAME( "uColumns" );
-const std::string TEXSIZE_PROPERTY_NAME( "texSize" );
-
-} // namespace
-
-SquareDissolveEffect::SquareDissolveEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-SquareDissolveEffect::SquareDissolveEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-SquareDissolveEffect::~SquareDissolveEffect()
-{
-}
-
-SquareDissolveEffect SquareDissolveEffect::New()
-{
-  // variable "uStep" range scope : [0.0, 1.0]
-  std::string fragmentShader(
-      "uniform  mediump vec2   texSize;\n"
-      "uniform  mediump float  uStep;\n"
-      "uniform  mediump float  uRows;\n"
-      "uniform  mediump float  uColumns;\n"
-      "void main()\n"
-      "{\n"
-      "  mediump vec2 mosaicSize = vec2(1.0 / uRows, 1.0 / uColumns);                               \n"
-      "  mediump vec2 intXY = vec2(vTexCoord.x * texSize.x, vTexCoord.y * texSize.y);               \n"
-      "  mediump vec2 XYMosaic = vec2(floor(intXY.x / mosaicSize.x) * mosaicSize.x, floor(intXY.y / mosaicSize.y) * mosaicSize.y); \n"
-      "  mediump vec2 UVMosaic = vec2(XYMosaic.x /texSize.x, XYMosaic.y / texSize.y);               \n"
-      "  mediump vec4 noiseVec = texture2D(sEffect, UVMosaic);                                      \n"
-      "  mediump float intensity = (noiseVec[0] + noiseVec[1] + noiseVec[2] + noiseVec[3]) / 4.0;   \n"
-      "  if(intensity < uStep)                                                              \n"
-      "    gl_FragColor = vec4(0.1, 0.1, 0.1, 1.0);                                         \n"
-      "  else                                                                               \n"
-      "    gl_FragColor = texture2D(sTexture, vTexCoord);                                   \n"
-      "  gl_FragColor *= uColor;                                                            \n"
-      "}                                                                                    \n" );
-
-  // Create the implementation, temporarily owned on stack
-  Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      "",
-      fragmentShader,
-      GeometryType( GEOMETRY_TYPE_IMAGE ),
-      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
-
-  /* Pass ownership to SquareDissolveEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::SquareDissolveEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( TEXSIZE_PROPERTY_NAME, Vector2(1.0f, 1.0f) );//COORDINATE_TYPE_DEFAULT
-  handle.SetUniform( STEP_PROPERTY_NAME, 0.1f);
-  handle.SetUniform( ROWS_PROPERTY_NAME, 25.0f);
-  handle.SetUniform( COLUMNS_PROPERTY_NAME, 25.0f);
-  return handle;
-}
-
-void SquareDissolveEffect::SetStep( float step )
-{
-  SetUniform( STEP_PROPERTY_NAME, step );
-}
-
-void SquareDissolveEffect::SetRows(float rows)
-{
-  SetUniform(ROWS_PROPERTY_NAME, rows);
-}
-
-void SquareDissolveEffect::SetColumns(float columns)
-{
-  SetUniform(COLUMNS_PROPERTY_NAME, columns);
-}
-
-void SquareDissolveEffect::SetTextureSize(const Vector2& textureSize)
-{
-  SetUniform(TEXSIZE_PROPERTY_NAME, textureSize);
-}
-
-const std::string& SquareDissolveEffect::GetStepPropertyName() const
-{
-  return STEP_PROPERTY_NAME;
-}
-
-const std::string& SquareDissolveEffect::GetRowsPropertyName() const
-{
-  return ROWS_PROPERTY_NAME;
-}
-
-const std::string& SquareDissolveEffect::GetColumnsPropertyName() const
-{
-  return COLUMNS_PROPERTY_NAME;
-}
-
-const std::string& SquareDissolveEffect::GetTexSizePropertyName() const
-{
-  return TEXSIZE_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 31ee848..6d93f86 100644 (file)
@@ -28,86 +28,53 @@ namespace Toolkit
 {
 
 /**
+ * @brief Creates a new SquareDissolveEffect
+ *
  * SquareDissolveEffect is a custom shader effect to achieve square effects in Image actors
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uStep"       - The step of the square effect
+ *  "uRows"       - The rows of the square dissolve effect
+ *  "uColumns"    - The columns of the square dissolve effect
+ *  "uTextureSize"- The texture size of the square dissolve
+ *
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API SquareDissolveEffect : public ShaderEffect
+inline ShaderEffect CreateSquareDissolveEffect()
 {
-public:
-
-  /**
-   * Create an uninitialized SquareDissolveEffect; this can be initialized with BendyEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  SquareDissolveEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~SquareDissolveEffect();
-
-  /**
-   * Create an initialized SquareDissolveEffect.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static SquareDissolveEffect New();
-
-  /**
-   * Set the step of the square effect.
-   * @param [in] step the new step.
-   */
-  void SetStep(float step);
-
-  /**
-   * Set the rows of the square dissolve effect.
-   * @param [in] rows the new rows value.
-   */
-  void SetRows(float rows);
-
-  /**
-   * Set the columns of the square dissolve effect.
-   * @param [in] columns the new columns value.
-   */
-  void SetColumns(float columns);
-
-  /**
-   * Set the texture size of the square dissolve.
-   * @param[in] textureSize The texture size in Vector2.
-   */
-  void SetTextureSize(const Vector2& textureSize);
-
-  /**
-   * Get the name for the step property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetStepPropertyName() const;
-
-  /**
-   * Get the name for the rows property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetRowsPropertyName() const;
-
-  /**
-   * Get the name for the columns property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetColumnsPropertyName() const;
-
-  /**
-   * Get the name for the texSize property
-   * which can be used in Animation API's
-   * @return A std::string containing the property name
-   */
-  const std::string& GetTexSizePropertyName() const;
-
-private: // Not intended for application developers
-  DALI_INTERNAL SquareDissolveEffect(ShaderEffect handle);
-};
+  // variable "uStep" range scope : [0.0, 1.0]
+  std::string fragmentShader(
+      "uniform  mediump vec2   uTextureSize;\n"
+      "uniform  mediump float  uStep;\n"
+      "uniform  mediump float  uRows;\n"
+      "uniform  mediump float  uColumns;\n"
+      "void main()\n"
+      "{\n"
+      "  mediump vec2 mosaicSize = vec2(1.0 / uRows, 1.0 / uColumns);                               \n"
+      "  mediump vec2 intXY = vec2(vTexCoord.x * uTextureSize.x, vTexCoord.y * uTextureSize.y);               \n"
+      "  mediump vec2 XYMosaic = vec2(floor(intXY.x / mosaicSize.x) * mosaicSize.x, floor(intXY.y / mosaicSize.y) * mosaicSize.y); \n"
+      "  mediump vec2 UVMosaic = vec2(XYMosaic.x /uTextureSize.x, XYMosaic.y / uTextureSize.y);               \n"
+      "  mediump vec4 noiseVec = texture2D(sEffect, UVMosaic);                                      \n"
+      "  mediump float intensity = (noiseVec[0] + noiseVec[1] + noiseVec[2] + noiseVec[3]) / 4.0;   \n"
+      "  if(intensity < uStep)                                                              \n"
+      "    gl_FragColor = vec4(0.1, 0.1, 0.1, 1.0);                                         \n"
+      "  else                                                                               \n"
+      "    gl_FragColor = texture2D(sTexture, vTexCoord);                                   \n"
+      "  gl_FragColor *= uColor;                                                            \n"
+      "}                                                                                    \n" );
+
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      "",
+      fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
+
+  shaderEffect.SetUniform( "uTextureSize", Vector2(1.0f, 1.0f) );//COORDINATE_TYPE_DEFAULT
+  shaderEffect.SetUniform( "uStep", 0.1f);
+  shaderEffect.SetUniform( "uRows", 25.0f);
+  shaderEffect.SetUniform( "uColumns", 25.0f);
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/swirl-effect.cpp b/dali-toolkit/devel-api/shader-effects/swirl-effect.cpp
deleted file mode 100644 (file)
index cafeec5..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2015 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-toolkit/devel-api/shader-effects/swirl-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-
-const std::string ANGLE_PROPERTY_NAME( "uAngle" );
-const std::string CENTER_PROPERTY_NAME( "uCenter" );
-const std::string RADIUS_PROPERTY_NAME( "uRadius" );
-
-} // namespace
-
-SwirlEffect::SwirlEffect()
-{
-}
-
-//Call the Parent copy constructor to add reference to the implementation for this object
-SwirlEffect::SwirlEffect(ShaderEffect handle)
-:ShaderEffect(handle)
-{
-}
-
-SwirlEffect::~SwirlEffect()
-{
-}
-
-
-SwirlEffect SwirlEffect::New(bool warp)
-{
-  // append the default version
-  std::string fragmentShader(
-      "uniform mediump vec2  uTextureSize;\n"
-      "uniform highp float uRadius;\n"
-      "uniform highp float uAngle;\n"
-      "uniform mediump vec2  uCenter;\n"
-      "void main()\n"
-      "{\n"
-      "  highp vec2 textureCenter = (sTextureRect.xy + sTextureRect.zw) * 0.5;\n"
-      "  textureCenter = vTexCoord.st - textureCenter;\n"
-      "  highp float distance = length(textureCenter);\n"
-      "  if (distance >= uRadius)\n"
-      "     discard;\n"
-      "  highp float percent = (uRadius - distance) / uRadius;\n"
-      "  highp float theta = percent * percent * uAngle * 4.0;\n"
-      "  highp float sinTheta = sin(theta);\n"
-      "  highp float cosTheta = cos(theta);\n" );
-      // if warp, loose the sign from sin
-  if( warp )
-  {
-    fragmentShader.append(
-      "  textureCenter = vec2( dot( textureCenter, vec2(cosTheta, sinTheta) ), "
-      "                        dot( textureCenter, vec2(sinTheta, cosTheta) ) );\n" );
-  }
-  else
-  {
-    fragmentShader.append(
-      "  textureCenter = vec2( dot( textureCenter, vec2(cosTheta, -sinTheta) ), "
-      "                        dot( textureCenter, vec2(sinTheta, cosTheta) ) );\n" );
-  }
-  fragmentShader.append(
-    "  textureCenter += uCenter;\n"
-    "  gl_FragColor = texture2D( sTexture, textureCenter ) * uColor;\n"
-    "}" );
-
-  // Create the implementation, temporarily owned on stack,
-  Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      "",
-      fragmentShader,
-      Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
-      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
-
-  /* Pass ownership to SwirlEffect through overloaded constructor, So that it now has access to the
-     Dali::ShaderEffect implementation */
-  Dali::Toolkit::SwirlEffect handle( shaderEffectCustom );
-
-  handle.SetUniform( ANGLE_PROPERTY_NAME, 0.0f );
-  handle.SetUniform( CENTER_PROPERTY_NAME, Vector2(0.5f, 0.5f) );
-  handle.SetUniform( RADIUS_PROPERTY_NAME, 1.0f );
-
-  return handle;
-}
-
-void SwirlEffect::SetAngle(float angle)
-{
-  SetUniform( ANGLE_PROPERTY_NAME, angle );
-}
-
-void SwirlEffect::SetCenter(const Vector2& center)
-{
-  SetUniform( CENTER_PROPERTY_NAME, center );
-}
-
-void SwirlEffect::SetRadius(float radius)
-{
-  SetUniform( RADIUS_PROPERTY_NAME, radius );
-}
-
-const std::string& SwirlEffect::GetAnglePropertyName() const
-{
-  return ANGLE_PROPERTY_NAME;
-}
-
-const std::string& SwirlEffect::GetCenterPropertyName() const
-{
-  return CENTER_PROPERTY_NAME;
-}
-
-const std::string& SwirlEffect::GetRadiusPropertyName() const
-{
-  return RADIUS_PROPERTY_NAME;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
index 6327fdc..020b320 100644 (file)
@@ -28,79 +28,66 @@ namespace Toolkit
 {
 
 /**
- * @brief SwirlEffect is a custom shader effect to achieve swirl effects in Image actors.
+ * @brief Creates a new SwirlEffect
+ *
+ * SwirlEffect is a custom shader effect to achieve swirl effects in Image actors.
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uAngle"  - The angle of the swirl
+ *  "uCenter" - The center of the swirl
+ *  "uRadius" - The radius of the swirl
+ *
+ * @param[in] warp True if the effect should warp
+ * @return A handle to a newly allocated ShaderEffect
  */
-class DALI_IMPORT_API SwirlEffect : public ShaderEffect
+inline ShaderEffect CreateSwirlEffect( bool warp )
 {
-public:
-
-  /**
-   * @brief Create an uninitialized SwirlEffect; this can be initialized with SwirlEffect::New().
-   *
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  SwirlEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~SwirlEffect();
-
-  /**
-   * @brief Create an initialized SwirlEffect.
-   *
-   * @param[in] warp True if the effect should warp.
-   * @return A handle to a newly allocated Dali resource.
-   */
-  static SwirlEffect New(bool warp);
-
-  /**
-   * @brief Set the angle of the swirl.
-   *
-   * @param[in] angle The angle in float.
-   */
-  void SetAngle(float angle);
-
-  /**
-   * @brief Set the center of the swirl.
-   *
-   * @param[in] center The center in Vector2.
-   */
-  void SetCenter(const Vector2& center);
-
-  /**
-   * @brief Set the radius of the swirl.
-   *
-   * @param[in] radius The radius in float.
-   */
-  void SetRadius(float radius);
-
-  /**
-   * @brief Get the name for the angle property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetAnglePropertyName() const;
-
-  /**
-   * @brief Get the name for the center property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetCenterPropertyName() const;
-
-  /**
-   * @brief Get the name for the radius property.
-   *
-   * @return A std::string containing the property name
-   */
-  const std::string& GetRadiusPropertyName() const;
-
-private: // Not intended for application developers
-  DALI_INTERNAL SwirlEffect(ShaderEffect handle);
-};
+  // append the default version
+  std::string fragmentShader(
+      "uniform mediump vec2  uTextureSize;\n"
+      "uniform highp float uRadius;\n"
+      "uniform highp float uAngle;\n"
+      "uniform mediump vec2  uCenter;\n"
+      "void main()\n"
+      "{\n"
+      "  highp vec2 textureCenter = (sTextureRect.xy + sTextureRect.zw) * 0.5;\n"
+      "  textureCenter = vTexCoord.st - textureCenter;\n"
+      "  highp float distance = length(textureCenter);\n"
+      "  if (distance >= uRadius)\n"
+      "     discard;\n"
+      "  highp float percent = (uRadius - distance) / uRadius;\n"
+      "  highp float theta = percent * percent * uAngle * 4.0;\n"
+      "  highp float sinTheta = sin(theta);\n"
+      "  highp float cosTheta = cos(theta);\n" );
+  // if warp, loose the sign from sin
+  if( warp )
+  {
+    fragmentShader.append(
+        "  textureCenter = vec2( dot( textureCenter, vec2(cosTheta, sinTheta) ), "
+        "                        dot( textureCenter, vec2(sinTheta, cosTheta) ) );\n" );
+  }
+  else
+  {
+    fragmentShader.append(
+        "  textureCenter = vec2( dot( textureCenter, vec2(cosTheta, -sinTheta) ), "
+        "                        dot( textureCenter, vec2(sinTheta, cosTheta) ) );\n" );
+  }
+  fragmentShader.append(
+      "  textureCenter += uCenter;\n"
+      "  gl_FragColor = texture2D( sTexture, textureCenter ) * uColor;\n"
+      "}" );
+
+  Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
+      "",
+      fragmentShader,
+      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
+
+  shaderEffect.SetUniform( "uAngle", 0.0f );
+  shaderEffect.SetUniform( "uCenter", Vector2(0.5f, 0.5f) );
+  shaderEffect.SetUniform( "uRadius", 1.0f );
+
+  return shaderEffect;
+}
 
 } // namespace Toolkit
 
diff --git a/dali-toolkit/devel-api/shader-effects/water-effect.cpp b/dali-toolkit/devel-api/shader-effects/water-effect.cpp
deleted file mode 100644 (file)
index 386c4d1..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/devel-api/shader-effects/water-effect.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/shader-effects/water-effect-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-WaterEffect::WaterEffect()
-{
-}
-
-// Call the Parent copy constructor to add reference to the implementation for this object
-WaterEffect::WaterEffect( ShaderEffect handle, Internal::WaterEffect* shaderExtension )
-: ShaderEffect( handle )
-{
-  AttachExtension( shaderExtension );
-}
-
-WaterEffect::~WaterEffect()
-{
-}
-
-WaterEffect WaterEffect::New( unsigned int numberOfWaves )
-{
-  return Internal::WaterEffect::CreateShaderEffect( numberOfWaves );
-}
-
-unsigned int WaterEffect::GetNumberOfWaves() const
-{
-  return GetImpl(*this).GetNumberOfWaves();
-}
-
-void WaterEffect::SetAmplitude( unsigned int index, float amplitude )
-{
-  GetImpl(*this).SetAmplitude( index, amplitude );
-}
-
-void WaterEffect::SetCenter( unsigned int index, const Vector2& center )
-{
-  GetImpl(*this).SetCenter( index, center );
-}
-
-void WaterEffect::SetPropagation( unsigned int index, float radius )
-{
-  GetImpl(*this).SetPropagation( index, radius );
-}
-
-float WaterEffect::GetAmplitude( unsigned int index ) const
-{
-  return GetImpl(*this).GetAmplitude( index );
-}
-
-Vector2 WaterEffect::GetCenter( unsigned int index ) const
-{
-  return GetImpl(*this).GetCenter( index );
-}
-
-float WaterEffect::GetPropagation( unsigned int index ) const
-{
-  return GetImpl(*this).GetPropagation( index );
-}
-
-std::string WaterEffect::GetAmplitudePropertyName( unsigned int index ) const
-{
-  return GetImpl(*this).GetAmplitudePropertyName( index );
-}
-
-std::string WaterEffect::GetCenterPropertyName( unsigned int index ) const
-{
-  return GetImpl(*this).GetCenterPropertyName( index );
-}
-
-std::string WaterEffect::GetPropagationPropertyName( unsigned int index ) const
-{
-  return GetImpl(*this).GetPropagationPropertyName( index );
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/devel-api/shader-effects/water-effect.h b/dali-toolkit/devel-api/shader-effects/water-effect.h
deleted file mode 100644 (file)
index a6be02c..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-#ifndef __DALI_TOOLKIT_WATER_EFFECT_H__
-#define __DALI_TOOLKIT_WATER_EFFECT_H__
-
-/*
- * Copyright (c) 2015 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 <dali/public-api/shader-effects/shader-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal DALI_INTERNAL
-{
-
-/**
- * WaterEffect implementation class
- */
-class WaterEffect;
-
-} // namespace Internal
-
-/**
- * WaterEffect is a custom shader effect to achieve water like effects on Image actors
- *
- * Usage example:
- *
- *   WaterEffect waterEffect = WaterEffect::New( numberOfDrops );
- *
- *   actor.SetShaderEffect( waterEffect );
- *
- *   // Set initial values
- *   waterEffect.SetCenter( 1, centerPosition );
- *   waterEffect.SetPropagation( 1, INITIAL_RADIUS );
- *
- *   // Animate the wave propagation
- *   std::string propertyName = waterEffect.GetPropagationPropertyName( 1 );
- *   animation.AnimateTo( Property(waterEffect, propertyName), FINAL_RADIUS );
- */
-class DALI_IMPORT_API WaterEffect : public ShaderEffect
-{
-public:
-
-  /**
-   * Create an uninitialized WaterEffect; this can be initialized with WaterEffect::New()
-   * Calling member functions with an uninitialized Dali::Object is not allowed.
-   */
-  WaterEffect();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~WaterEffect();
-
-  /**
-   * Create an initialized WaterEffect.
-   * @param [in] numberOfWaves The number of waves.
-   * @return A handle to a newly allocated Dali resource
-   */
-  static WaterEffect New( unsigned int numberOfWaves );
-
-  /**
-   * Get the number of waves the shader supports.
-   * @return The number of waves in the shader.
-   */
-  unsigned int GetNumberOfWaves() const;
-
-  /**
-   * Set the amplitude of a wave.
-   * @param [in] index The index of the wave to change
-   * @param [in] amplitude The new amplitude of the wave
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  void SetAmplitude( unsigned int index, float amplitude );
-
-  /**
-   * Set the center point of a wave in texture coordinates.
-   * @param [in] index The index of the wave to change
-   * @param [in] center The center point of the wave
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  void SetCenter( unsigned int index, const Vector2& center );
-
-  /**
-   * Set the propagation radius of a wave.
-   * @param [in] index The index of the wave to change
-   * @param [in] radius The propagation radius
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  void SetPropagation( unsigned int index, float radius );
-
-  /**
-   * Get the amplitude of a wave.
-   * @param [in] index The index of the wave
-   * @return The new amplitude of the wave
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  float GetAmplitude( unsigned int index ) const;
-
-  /**
-   * Get the center point of a wave in texture coordinates.
-   * @param [in] index The index of the wave
-   * @return The center point of the wave
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  Vector2 GetCenter( unsigned int index ) const;
-
-  /**
-   * Get the propagation radius of a wave.
-   * @param [in] index The index of the wave
-   * @return The propagation radius
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  float GetPropagation( unsigned int index ) const;
-
-  /**
-   * Get the name for the amplitude property of a wave.
-   * @param [in] index The index of the wave
-   * @return A std::string containing the property name
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  std::string GetAmplitudePropertyName( unsigned int index ) const;
-
-  /**
-   * Get the name for the center property of a wave.
-   * @param [in] index The index of the wave
-   * @return A std::string containing the property name
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  std::string GetCenterPropertyName( unsigned int index ) const;
-
-  /**
-   * Get the name for the propagation property.
-   * @param [in] index The index of the wave
-   * @return A std::string containing the property name
-   * @pre index has to be between 0 and GetNumberOfWaves() - 1
-   */
-  std::string GetPropagationPropertyName( unsigned int index ) const;
-
-public: // Not intended for developer use
-
-  DALI_INTERNAL WaterEffect( ShaderEffect handle, Internal::WaterEffect* shaderExtension );
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_WATER_EFFECT_H__
  */
 
 // CLASS HEADER
-#include "accessibility-focus-manager-impl.h"
+#include "accessibility-manager-impl.h"
 
 // EXTERNAL INCLUDES
 #include <cstring> // for strcmp
 #include <dali/public-api/actors/layer.h>
-#include <dali/devel-api/adaptor-framework/accessibility-manager.h>
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
 #include <dali/devel-api/adaptor-framework/sound-player.h>
-#include <dali/public-api/adaptor-framework/tts-player.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/devel-api/events/hit-test-algorithm.h>
 #include <dali/public-api/images/resource-image.h>
@@ -107,31 +106,37 @@ bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType
 
 }
 
-AccessibilityFocusManager::AccessibilityFocusManager()
-: mIsWrapped(false),
+AccessibilityManager::AccessibilityManager()
+: mCurrentFocusActor(FocusIDPair(0, 0)),
+  mFocusIndicatorActor(Actor()),
+  mRecursiveFocusMoveCounter(0),
+  mIsWrapped(false),
   mIsFocusWithinGroup(false),
   mIsEndcapFeedbackEnabled(false),
   mIsEndcapFeedbackPlayed(false),
-  mCurrentFocusActor(FocusIDPair(0, 0)),
-  mFocusIndicatorActor(Actor()),
-  mRecursiveFocusMoveCounter(0),
   mIsAccessibilityTtsEnabled(false),
-  mIsFocusIndicatorEnabled(false)
+  mTtsCreated(false),
+  mIsFocusIndicatorEnabled(false),
+  mContinuousPlayMode(false)
 {
-  CreateDefaultFocusIndicatorActor();
-
-  AccessibilityManager manager = AccessibilityManager::Get();
-  manager.SetActionHandler(*this);
-  manager.SetGestureHandler(*this);
+}
 
-  ChangeAccessibilityStatus();
+AccessibilityManager::~AccessibilityManager()
+{
 }
 
-AccessibilityFocusManager::~AccessibilityFocusManager()
+void AccessibilityManager::Initialise()
 {
+  CreateDefaultFocusIndicatorActor();
+
+  AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
+  adaptor.SetActionHandler(*this);
+  adaptor.SetGestureHandler(*this);
+
+  ChangeAccessibilityStatus();
 }
 
-AccessibilityFocusManager::ActorAdditionalInfo AccessibilityFocusManager::GetActorAdditionalInfo(const unsigned int actorID) const
+AccessibilityManager::ActorAdditionalInfo AccessibilityManager::GetActorAdditionalInfo(const unsigned int actorID) const
 {
   ActorAdditionalInfo data;
   IDAdditionalInfoConstIter iter = mIDAdditionalInfoContainer.find(actorID);
@@ -143,7 +148,7 @@ AccessibilityFocusManager::ActorAdditionalInfo AccessibilityFocusManager::GetAct
   return data;
 }
 
-void AccessibilityFocusManager::SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order)
+void AccessibilityManager::SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order)
 {
   ActorAdditionalInfo actorInfo = GetActorAdditionalInfo(actorID);
   actorInfo.mFocusOrder = order;
@@ -151,7 +156,7 @@ void AccessibilityFocusManager::SynchronizeActorAdditionalInfo(const unsigned in
   mIDAdditionalInfoContainer.insert(IDAdditionalInfoPair(actorID, actorInfo));
 }
 
-void AccessibilityFocusManager::SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type, const std::string& text)
+void AccessibilityManager::SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type, const std::string& text)
 {
   if(actor)
   {
@@ -165,7 +170,7 @@ void AccessibilityFocusManager::SetAccessibilityAttribute(Actor actor, Toolkit::
   }
 }
 
-std::string AccessibilityFocusManager::GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type) const
+std::string AccessibilityManager::GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type) const
 {
   std::string text;
 
@@ -178,7 +183,7 @@ std::string AccessibilityFocusManager::GetAccessibilityAttribute(Actor actor, To
   return text;
 }
 
-void AccessibilityFocusManager::SetFocusOrder(Actor actor, const unsigned int order)
+void AccessibilityManager::SetFocusOrder(Actor actor, const unsigned int order)
 {
   // Do nothing if the focus order of the actor is not changed.
   if(actor && GetFocusOrder(actor) != order)
@@ -245,7 +250,7 @@ void AccessibilityFocusManager::SetFocusOrder(Actor actor, const unsigned int or
   }
 }
 
-unsigned int AccessibilityFocusManager::GetFocusOrder(Actor actor) const
+unsigned int AccessibilityManager::GetFocusOrder(Actor actor) const
 {
   unsigned int focusOrder = 0;
 
@@ -258,7 +263,7 @@ unsigned int AccessibilityFocusManager::GetFocusOrder(Actor actor) const
   return focusOrder;
 }
 
-unsigned int AccessibilityFocusManager::GenerateNewFocusOrder() const
+unsigned int AccessibilityManager::GenerateNewFocusOrder() const
 {
   unsigned int order = 1;
   FocusIDContainer::const_reverse_iterator iter = mFocusIDContainer.rbegin();
@@ -271,7 +276,7 @@ unsigned int AccessibilityFocusManager::GenerateNewFocusOrder() const
   return order;
 }
 
-Actor AccessibilityFocusManager::GetActorByFocusOrder(const unsigned int order)
+Actor AccessibilityManager::GetActorByFocusOrder(const unsigned int order)
 {
   Actor actor = Actor();
 
@@ -285,7 +290,7 @@ Actor AccessibilityFocusManager::GetActorByFocusOrder(const unsigned int order)
   return actor;
 }
 
-bool AccessibilityFocusManager::SetCurrentFocusActor(Actor actor)
+bool AccessibilityManager::SetCurrentFocusActor(Actor actor)
 {
   if(actor)
   {
@@ -295,7 +300,7 @@ bool AccessibilityFocusManager::SetCurrentFocusActor(Actor actor)
   return false;
 }
 
-bool AccessibilityFocusManager::DoSetCurrentFocusActor(const unsigned int actorID)
+bool AccessibilityManager::DoSetCurrentFocusActor(const unsigned int actorID)
 {
   Actor rootActor = Stage::GetCurrent().GetRootLayer();
 
@@ -364,7 +369,7 @@ bool AccessibilityFocusManager::DoSetCurrentFocusActor(const unsigned int actorI
 
         // Combine attribute texts to one text
         std::string informationText;
-        for(int i = 0; i < Toolkit::AccessibilityFocusManager::ACCESSIBILITY_ATTRIBUTE_NUM; i++)
+        for(int i = 0; i < Toolkit::AccessibilityManager::ACCESSIBILITY_ATTRIBUTE_NUM; i++)
         {
           if(!GetActorAdditionalInfo(actorID).mAccessibilityAttributes[i].empty())
           {
@@ -386,23 +391,23 @@ bool AccessibilityFocusManager::DoSetCurrentFocusActor(const unsigned int actorI
   return false;
 }
 
-Actor AccessibilityFocusManager::GetCurrentFocusActor()
+Actor AccessibilityManager::GetCurrentFocusActor()
 {
   Actor rootActor = Stage::GetCurrent().GetRootLayer();
   return rootActor.FindChildById(mCurrentFocusActor.second);
 }
 
-Actor AccessibilityFocusManager::GetCurrentFocusGroup()
+Actor AccessibilityManager::GetCurrentFocusGroup()
 {
   return GetFocusGroup(GetCurrentFocusActor());
 }
 
-unsigned int AccessibilityFocusManager::GetCurrentFocusOrder()
+unsigned int AccessibilityManager::GetCurrentFocusOrder()
 {
   return mCurrentFocusActor.first;
 }
 
-bool AccessibilityFocusManager::MoveFocusForward()
+bool AccessibilityManager::MoveFocusForward()
 {
   bool ret = false;
   mRecursiveFocusMoveCounter = 0;
@@ -430,7 +435,7 @@ bool AccessibilityFocusManager::MoveFocusForward()
   return ret;
 }
 
-bool AccessibilityFocusManager::MoveFocusBackward()
+bool AccessibilityManager::MoveFocusBackward()
 {
   bool ret = false;
   mRecursiveFocusMoveCounter = 0;
@@ -459,7 +464,7 @@ bool AccessibilityFocusManager::MoveFocusBackward()
   return ret;
 }
 
-void AccessibilityFocusManager::DoActivate(Actor actor)
+void AccessibilityManager::DoActivate(Actor actor)
 {
   if(actor)
   {
@@ -475,7 +480,7 @@ void AccessibilityFocusManager::DoActivate(Actor actor)
   }
 }
 
-void AccessibilityFocusManager::ClearFocus()
+void AccessibilityManager::ClearFocus()
 {
   Actor actor = GetCurrentFocusActor();
   if(actor)
@@ -496,14 +501,14 @@ void AccessibilityFocusManager::ClearFocus()
   }
 }
 
-void AccessibilityFocusManager::Reset()
+void AccessibilityManager::Reset()
 {
   ClearFocus();
   mFocusIDContainer.clear();
   mIDAdditionalInfoContainer.clear();
 }
 
-void AccessibilityFocusManager::SetFocusGroup(Actor actor, bool isFocusGroup)
+void AccessibilityManager::SetFocusGroup(Actor actor, bool isFocusGroup)
 {
   if(actor)
   {
@@ -520,7 +525,7 @@ void AccessibilityFocusManager::SetFocusGroup(Actor actor, bool isFocusGroup)
   }
 }
 
-bool AccessibilityFocusManager::IsFocusGroup(Actor actor) const
+bool AccessibilityManager::IsFocusGroup(Actor actor) const
 {
   // Check whether the actor is a focus group
   bool isFocusGroup = false;
@@ -537,7 +542,7 @@ bool AccessibilityFocusManager::IsFocusGroup(Actor actor) const
   return isFocusGroup;
 }
 
-Actor AccessibilityFocusManager::GetFocusGroup(Actor actor)
+Actor AccessibilityManager::GetFocusGroup(Actor actor)
 {
   // Go through the actor's hierarchy to check which focus group the actor belongs to
   while (actor && !IsFocusGroup(actor))
@@ -548,37 +553,37 @@ Actor AccessibilityFocusManager::GetFocusGroup(Actor actor)
   return actor;
 }
 
-void AccessibilityFocusManager::SetGroupMode(bool enabled)
+void AccessibilityManager::SetGroupMode(bool enabled)
 {
   mIsFocusWithinGroup = enabled;
 }
 
-bool AccessibilityFocusManager::GetGroupMode() const
+bool AccessibilityManager::GetGroupMode() const
 {
   return mIsFocusWithinGroup;
 }
 
-void AccessibilityFocusManager::SetWrapMode(bool wrapped)
+void AccessibilityManager::SetWrapMode(bool wrapped)
 {
   mIsWrapped = wrapped;
 }
 
-bool AccessibilityFocusManager::GetWrapMode() const
+bool AccessibilityManager::GetWrapMode() const
 {
   return mIsWrapped;
 }
 
-void AccessibilityFocusManager::SetFocusIndicatorActor(Actor indicator)
+void AccessibilityManager::SetFocusIndicatorActor(Actor indicator)
 {
   mFocusIndicatorActor = indicator;
 }
 
-Actor AccessibilityFocusManager::GetFocusIndicatorActor()
+Actor AccessibilityManager::GetFocusIndicatorActor()
 {
   return mFocusIndicatorActor;
 }
 
-bool AccessibilityFocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped)
+bool AccessibilityManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped)
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] %d focusable actors\n", __FUNCTION__, __LINE__, mFocusIDContainer.size());
   DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
@@ -619,20 +624,26 @@ bool AccessibilityFocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forwar
     {
       DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Overshot\n", __FUNCTION__, __LINE__);
       // Send notification for handling overshooted situation
-      mFocusOvershotSignal.Emit(GetCurrentFocusActor(), forward ? Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT : Toolkit::AccessibilityFocusManager::OVERSHOT_PREVIOUS);
+      mFocusOvershotSignal.Emit(GetCurrentFocusActor(), forward ? Toolkit::AccessibilityManager::OVERSHOT_NEXT : Toolkit::AccessibilityManager::OVERSHOT_PREVIOUS);
 
       return false; // Try to move the focus out of the scope
     }
   }
 
-  if((focusIDIter != mFocusIDContainer.end()) && !DoSetCurrentFocusActor((*focusIDIter).second))
+  // Invalid focus.
+  if( focusIDIter == mFocusIDContainer.end() )
+  {
+    return false;
+  }
+
+  // Note: This function performs the focus change.
+  if( !DoSetCurrentFocusActor( (*focusIDIter).second ) )
   {
     mRecursiveFocusMoveCounter++;
     if(mRecursiveFocusMoveCounter > mFocusIDContainer.size())
     {
       // We've attempted to focus all the actors in the whole focus chain and no actor
       // can be focused successfully.
-
       DALI_LOG_WARNING("[%s] There is no more focusable actor in %d focus chains\n", __FUNCTION__, mRecursiveFocusMoveCounter);
 
       return false;
@@ -646,7 +657,7 @@ bool AccessibilityFocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forwar
   return true;
 }
 
-void AccessibilityFocusManager::SetFocusable(Actor actor, bool focusable)
+void AccessibilityManager::SetFocusable(Actor actor, bool focusable)
 {
   if(actor)
   {
@@ -663,7 +674,7 @@ void AccessibilityFocusManager::SetFocusable(Actor actor, bool focusable)
   }
 }
 
-void AccessibilityFocusManager::CreateDefaultFocusIndicatorActor()
+void AccessibilityManager::CreateDefaultFocusIndicatorActor()
 {
   // Create a focus indicator actor shared by all the focusable actors
   Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH);
@@ -680,10 +691,11 @@ void AccessibilityFocusManager::CreateDefaultFocusIndicatorActor()
   SetFocusIndicatorActor(focusIndicator);
 }
 
-bool AccessibilityFocusManager::ChangeAccessibilityStatus()
+bool AccessibilityManager::ChangeAccessibilityStatus()
 {
-  AccessibilityManager manager = AccessibilityManager::Get();
-  mIsAccessibilityTtsEnabled = manager.IsEnabled();
+  AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
+  mIsAccessibilityTtsEnabled = adaptor.IsEnabled();
+  Dali::Toolkit::AccessibilityManager handle( this );
 
   if(mIsAccessibilityTtsEnabled)
   {
@@ -697,6 +709,11 @@ bool AccessibilityFocusManager::ChangeAccessibilityStatus()
       }
     }
     mIsFocusIndicatorEnabled = true;
+
+    // Connect a signal to the TTS player to implement continuous reading mode.
+    Dali::TtsPlayer player = Dali::TtsPlayer::Get( Dali::TtsPlayer::SCREEN_READER );
+    player.StateChangedSignal().Connect( this, &AccessibilityManager::TtsStateChanged );
+    mTtsCreated = true;
   }
   else
   {
@@ -707,13 +724,29 @@ bool AccessibilityFocusManager::ChangeAccessibilityStatus()
       actor.Remove(mFocusIndicatorActor);
     }
     mIsFocusIndicatorEnabled = false;
+
+    if( mTtsCreated )
+    {
+      // Disconnect the TTS state change signal.
+      Dali::TtsPlayer player = Dali::TtsPlayer::Get( Dali::TtsPlayer::SCREEN_READER );
+      player.StateChangedSignal().Disconnect( this, &AccessibilityManager::TtsStateChanged );
+      mTtsCreated = true;
+    }
   }
 
+  mStatusChangedSignal.Emit( handle );
+
   return true;
 }
 
-bool AccessibilityFocusManager::AccessibilityActionNext(bool allowEndFeedback)
+bool AccessibilityManager::AccessibilityActionNext(bool allowEndFeedback)
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionNextSignal.Empty() )
+  {
+    mActionNextSignal.Emit( handle );
+  }
+
   if(mIsAccessibilityTtsEnabled)
   {
     mIsEndcapFeedbackEnabled = allowEndFeedback;
@@ -725,8 +758,14 @@ bool AccessibilityFocusManager::AccessibilityActionNext(bool allowEndFeedback)
   }
 }
 
-bool AccessibilityFocusManager::AccessibilityActionPrevious(bool allowEndFeedback)
+bool AccessibilityManager::AccessibilityActionPrevious(bool allowEndFeedback)
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionPreviousSignal.Empty() )
+  {
+    mActionPreviousSignal.Emit( handle );
+  }
+
   if(mIsAccessibilityTtsEnabled)
   {
     mIsEndcapFeedbackEnabled = allowEndFeedback;
@@ -738,8 +777,14 @@ bool AccessibilityFocusManager::AccessibilityActionPrevious(bool allowEndFeedbac
   }
 }
 
-bool AccessibilityFocusManager::AccessibilityActionActivate()
+bool AccessibilityManager::AccessibilityActionActivate()
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionActivateSignal.Empty() )
+  {
+    mActionActivateSignal.Emit( handle );
+  }
+
   bool ret = false;
 
   Actor actor = GetCurrentFocusActor();
@@ -752,16 +797,33 @@ bool AccessibilityFocusManager::AccessibilityActionActivate()
   return ret;
 }
 
-bool AccessibilityFocusManager::AccessibilityActionRead(bool allowReadAgain)
+bool AccessibilityManager::AccessibilityActionRead(bool allowReadAgain)
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+
+  if( allowReadAgain )
+  {
+    if ( !mActionReadSignal.Empty() )
+    {
+      mActionReadSignal.Emit( handle );
+    }
+  }
+  else
+  {
+    if ( !mActionOverSignal.Empty() )
+    {
+      mActionOverSignal.Emit( handle );
+    }
+  }
+
   bool ret = false;
 
   if(mIsAccessibilityTtsEnabled)
   {
     // Find the focusable actor at the read position
-    AccessibilityManager manager = AccessibilityManager::Get();
+    AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
     Dali::HitTestAlgorithm::Results results;
-    Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), manager.GetReadPosition(), results, IsActorFocusableFunction );
+    Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), adaptor.GetReadPosition(), results, IsActorFocusableFunction );
 
     FocusIDIter focusIDIter = mFocusIDContainer.find(GetFocusOrder(results.actor));
     if(focusIDIter != mFocusIDContainer.end())
@@ -778,8 +840,14 @@ bool AccessibilityFocusManager::AccessibilityActionRead(bool allowReadAgain)
   return ret;
 }
 
-bool AccessibilityFocusManager::AccessibilityActionReadNext(bool allowEndFeedback)
+bool AccessibilityManager::AccessibilityActionReadNext(bool allowEndFeedback)
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionReadNextSignal.Empty() )
+  {
+    mActionReadNextSignal.Emit( handle );
+  }
+
   if(mIsAccessibilityTtsEnabled)
   {
     return MoveFocusForward();
@@ -790,8 +858,14 @@ bool AccessibilityFocusManager::AccessibilityActionReadNext(bool allowEndFeedbac
   }
 }
 
-bool AccessibilityFocusManager::AccessibilityActionReadPrevious(bool allowEndFeedback)
+bool AccessibilityManager::AccessibilityActionReadPrevious(bool allowEndFeedback)
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionReadPreviousSignal.Empty() )
+  {
+    mActionReadPreviousSignal.Emit( handle );
+  }
+
   if(mIsAccessibilityTtsEnabled)
   {
     return MoveFocusBackward();
@@ -802,8 +876,14 @@ bool AccessibilityFocusManager::AccessibilityActionReadPrevious(bool allowEndFee
   }
 }
 
-bool AccessibilityFocusManager::AccessibilityActionUp()
+bool AccessibilityManager::AccessibilityActionUp()
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionUpSignal.Empty() )
+  {
+    mActionUpSignal.Emit( handle );
+  }
+
   bool ret = false;
 
   if(mIsAccessibilityTtsEnabled)
@@ -823,8 +903,14 @@ bool AccessibilityFocusManager::AccessibilityActionUp()
   return ret;
 }
 
-bool AccessibilityFocusManager::AccessibilityActionDown()
+bool AccessibilityManager::AccessibilityActionDown()
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionDownSignal.Empty() )
+  {
+    mActionDownSignal.Emit( handle );
+  }
+
   bool ret = false;
 
   if(mIsAccessibilityTtsEnabled)
@@ -844,8 +930,14 @@ bool AccessibilityFocusManager::AccessibilityActionDown()
   return ret;
 }
 
-bool AccessibilityFocusManager::ClearAccessibilityFocus()
+bool AccessibilityManager::ClearAccessibilityFocus()
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionClearFocusSignal.Empty() )
+  {
+    mActionClearFocusSignal.Emit( handle );
+  }
+
   if(mIsAccessibilityTtsEnabled)
   {
     ClearFocus();
@@ -857,14 +949,359 @@ bool AccessibilityFocusManager::ClearAccessibilityFocus()
   }
 }
 
-bool AccessibilityFocusManager::AccessibilityActionBack()
+bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchEvent& touchEvent )
 {
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionScrollSignal.Empty() )
+  {
+    mActionScrollSignal.Emit( handle, touchEvent );
+  }
+
+  return true;
+}
+
+bool AccessibilityManager::AccessibilityActionBack()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionBackSignal.Empty() )
+  {
+    mActionBackSignal.Emit( handle );
+  }
+
   // TODO: Back to previous view
 
   return mIsAccessibilityTtsEnabled;
 }
 
-bool AccessibilityFocusManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
+bool AccessibilityManager::AccessibilityActionScrollUp()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionScrollUpSignal.Empty() )
+  {
+    mActionScrollUpSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    Actor actor = GetCurrentFocusActor();
+    if(actor)
+    {
+      Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+      if(control)
+      {
+        // TODO: Notify the control to scroll up. Should control handle this?
+//        ret = GetImplementation( control ).OnAccessibilityScroll(Direction::UP);
+      }
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionScrollDown()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionScrollDownSignal.Empty() )
+  {
+    mActionScrollDownSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    Actor actor = GetCurrentFocusActor();
+    if(actor)
+    {
+      Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+      if(control)
+      {
+        // TODO: Notify the control to scroll down. Should control handle this?
+//        ret = GetImplementation( control ).OnAccessibilityScrollDown(Direction::DOWN);
+      }
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionPageLeft()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionPageLeftSignal.Empty() )
+  {
+    mActionPageLeftSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    Actor actor = GetCurrentFocusActor();
+    if(actor)
+    {
+      Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+      if(control)
+      {
+        // TODO: Notify the control to scroll left to the previous page. Should control handle this?
+//        ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::LEFT);
+      }
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionPageRight()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionPageRightSignal.Empty() )
+  {
+    mActionPageRightSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    Actor actor = GetCurrentFocusActor();
+    if(actor)
+    {
+      Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+      if(control)
+      {
+        // TODO: Notify the control to scroll right to the next page. Should control handle this?
+//        ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::RIGHT);
+      }
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionPageUp()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionPageUpSignal.Empty() )
+  {
+    mActionPageUpSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    Actor actor = GetCurrentFocusActor();
+    if(actor)
+    {
+      Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+      if(control)
+      {
+        // TODO: Notify the control to scroll up to the previous page. Should control handle this?
+//        ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::UP);
+      }
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionPageDown()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionPageDownSignal.Empty() )
+  {
+    mActionPageDownSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    Actor actor = GetCurrentFocusActor();
+    if(actor)
+    {
+      Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+      if(control)
+      {
+        // TODO: Notify the control to scroll down to the next page. Should control handle this?
+//        ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::DOWN);
+      }
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionMoveToFirst()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionMoveToFirstSignal.Empty() )
+  {
+    mActionMoveToFirstSignal.Emit( handle );
+  }
+
+  // TODO: Move to the first item on screen
+
+  return mIsAccessibilityTtsEnabled;
+}
+
+bool AccessibilityManager::AccessibilityActionMoveToLast()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionMoveToLastSignal.Empty() )
+  {
+    mActionMoveToLastSignal.Emit( handle );
+  }
+
+  // TODO: Move to the last item on screen
+
+  return mIsAccessibilityTtsEnabled;
+}
+
+bool AccessibilityManager::AccessibilityActionReadFromTop()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionReadFromTopSignal.Empty() )
+  {
+    mActionReadFromTopSignal.Emit( handle );
+  }
+
+  // TODO: Move to the top item on screen and read from the item continuously
+
+  return mIsAccessibilityTtsEnabled;
+}
+
+bool AccessibilityManager::AccessibilityActionReadFromNext()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+
+  if( !mActionReadFromNextSignal.Empty() )
+  {
+    mActionReadFromNextSignal.Emit( handle );
+  }
+
+  if( mIsAccessibilityTtsEnabled )
+  {
+    // Mark that we are in continuous play mode, so TTS signals can move focus.
+    mContinuousPlayMode = true;
+
+    // Attempt to move to the next item and read from the item continuously.
+    MoveFocusForward();
+  }
+
+  return mIsAccessibilityTtsEnabled;
+}
+
+void AccessibilityManager::TtsStateChanged( const Dali::TtsPlayer::State previousState, const Dali::TtsPlayer::State currentState )
+{
+  if( mContinuousPlayMode )
+  {
+    // If we were playing and now we have stopped, attempt to play the next item.
+    if( ( previousState == Dali::TtsPlayer::PLAYING ) && ( currentState == Dali::TtsPlayer::READY ) )
+    {
+      // Attempt to move the focus forward and play.
+      // If we can't cancel continuous play mode.
+      if( !MoveFocusForward() )
+      {
+        // We are done, exit continuous play mode.
+        mContinuousPlayMode = false;
+      }
+    }
+    else
+    {
+      // Unexpected play state change, exit continuous play mode.
+      mContinuousPlayMode = false;
+    }
+  }
+}
+
+bool AccessibilityManager::AccessibilityActionZoom()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionZoomSignal.Empty() )
+  {
+    mActionZoomSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    Actor actor = GetCurrentFocusActor();
+    if(actor)
+    {
+      Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+      if(control)
+      {
+        // Notify the control to zoom
+        ret = GetImplementation( control ).OnAccessibilityZoom();
+      }
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionReadIndicatorInformation()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionReadIndicatorInformationSignal.Empty() )
+  {
+    mActionReadIndicatorInformationSignal.Emit( handle );
+  }
+
+  // TODO: Read the information in the indicator
+
+  return mIsAccessibilityTtsEnabled;
+}
+
+bool AccessibilityManager::AccessibilityActionReadPauseResume()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionReadPauseResumeSignal.Empty() )
+  {
+    mActionReadPauseResumeSignal.Emit( handle );
+  }
+
+  bool ret = false;
+
+  if(mIsAccessibilityTtsEnabled)
+  {
+    // Pause or resume the TTS player
+    Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER);
+    Dali::TtsPlayer::State state = player.GetState();
+    if(state == Dali::TtsPlayer::PLAYING)
+    {
+      player.Pause();
+      ret = true;
+    }
+    else if(state == Dali::TtsPlayer::PAUSED)
+    {
+      player.Resume();
+      ret = true;
+    }
+  }
+
+  return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionStartStop()
+{
+  Dali::Toolkit::AccessibilityManager handle( this );
+  if( !mActionStartStopSignal.Empty() )
+  {
+    mActionStartStopSignal.Emit( handle );
+  }
+
+  // TODO: Start/stop the current action
+
+  return mIsAccessibilityTtsEnabled;
+}
+
+bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
 {
   bool handled = false;
 
@@ -879,7 +1316,7 @@ bool AccessibilityFocusManager::AccessibilityActionTouch(const TouchEvent& touch
   return handled;
 }
 
-bool AccessibilityFocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent)
+bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent)
 {
   bool handled = false;
 
@@ -887,7 +1324,7 @@ bool AccessibilityFocusManager::HandlePanGesture(const Integration::PanGestureEv
   {
     // Find the focusable actor at the event position
     Dali::HitTestAlgorithm::Results results;
-    AccessibilityManager manager = AccessibilityManager::Get();
+    AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
 
     Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), panEvent.currentPosition, results, IsActorFocusableFunction );
     mCurrentGesturedActor = results.actor;
@@ -956,27 +1393,27 @@ bool AccessibilityFocusManager::HandlePanGesture(const Integration::PanGestureEv
   return handled;
 }
 
-Toolkit::AccessibilityFocusManager::FocusChangedSignalType& AccessibilityFocusManager::FocusChangedSignal()
+Toolkit::AccessibilityManager::FocusChangedSignalType& AccessibilityManager::FocusChangedSignal()
 {
   return mFocusChangedSignal;
 }
 
-Toolkit::AccessibilityFocusManager::FocusOvershotSignalType& AccessibilityFocusManager::FocusOvershotSignal()
+Toolkit::AccessibilityManager::FocusOvershotSignalType& AccessibilityManager::FocusOvershotSignal()
 {
   return mFocusOvershotSignal;
 }
 
-Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignalType& AccessibilityFocusManager::FocusedActorActivatedSignal()
+Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& AccessibilityManager::FocusedActorActivatedSignal()
 {
   return mFocusedActorActivatedSignal;
 }
 
-bool AccessibilityFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+bool AccessibilityManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   Dali::BaseHandle handle( object );
 
   bool connected( true );
-  AccessibilityFocusManager* manager = dynamic_cast<AccessibilityFocusManager*>( object );
+  AccessibilityManager* manager = dynamic_cast<AccessibilityManager*>( object );
 
   if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
   {
diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h
new file mode 100644 (file)
index 0000000..e37e319
--- /dev/null
@@ -0,0 +1,785 @@
+#ifndef __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__
+#define __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__
+
+/*
+ * Copyright (c) 2015 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/devel-api/common/map-wrapper.h>
+#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+#include <dali/public-api/adaptor-framework/tts-player.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+class AccessibilityManager;
+
+/**
+ * @copydoc Toolkit::AccessibilityManager
+ */
+class AccessibilityManager : public Dali::BaseObject, Dali::AccessibilityActionHandler, Dali::AccessibilityGestureHandler, public Dali::ConnectionTracker
+{
+public:
+
+  typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionSignalType       AccessibilityActionSignalType;
+  typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType;
+
+  struct ActorAdditionalInfo
+  {
+    ActorAdditionalInfo()
+    : mFocusOrder(0)
+    {
+    }
+
+    unsigned int mFocusOrder; ///< The focus order of the actor. It is undefined by default.
+
+    std::string mAccessibilityAttributes[Toolkit::AccessibilityManager::ACCESSIBILITY_ATTRIBUTE_NUM]; ///< The array of attribute texts
+  };
+
+  typedef std::pair<unsigned int, unsigned int>        FocusIDPair;
+  typedef std::map<unsigned int, unsigned int>         FocusIDContainer;
+  typedef FocusIDContainer::iterator                   FocusIDIter;
+  typedef FocusIDContainer::const_iterator             FocusIDConstIter;
+
+  typedef std::pair<unsigned int, ActorAdditionalInfo> IDAdditionalInfoPair;
+  typedef std::map<unsigned int, ActorAdditionalInfo>  IDAdditionalInfoContainer;
+  typedef IDAdditionalInfoContainer::iterator          IDAdditionalInfoIter;
+  typedef IDAdditionalInfoContainer::const_iterator    IDAdditionalInfoConstIter;
+
+  /**
+   * Construct a new AccessibilityManager.
+   */
+  AccessibilityManager();
+
+  /**
+   * Initialise the AccessibilityManager
+   */
+  void Initialise();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::SetAccessibilityAttribute
+   */
+  void SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type, const std::string& text);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetAccessibilityAttribute
+   */
+  std::string GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type) const;
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::SetFocusOrder
+   */
+  void SetFocusOrder(Actor actor, const unsigned int order);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetFocusOrder
+   */
+  unsigned int GetFocusOrder(Actor actor) const;
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GenerateNewFocusOrder
+   */
+  unsigned int GenerateNewFocusOrder() const;
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetActorByFocusOrder
+   */
+  Actor GetActorByFocusOrder(const unsigned int order);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::SetCurrentFocusActor
+   */
+  bool SetCurrentFocusActor(Actor actor);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusActor
+   */
+  Actor GetCurrentFocusActor();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusGroup
+   */
+  Actor GetCurrentFocusGroup();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusOrder
+   */
+  unsigned int GetCurrentFocusOrder();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::MoveFocusForward
+   */
+  bool MoveFocusForward();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::MoveFocusBackward
+   */
+  bool MoveFocusBackward();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::ClearFocus
+   */
+  void ClearFocus();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::Reset
+   */
+  void Reset();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::SetFocusGroup
+   */
+  void SetFocusGroup(Actor actor, bool isFocusGroup);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::IsFocusGroup
+   */
+  bool IsFocusGroup(Actor actor) const;
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::SetGroupMode
+   */
+  void SetGroupMode(bool enabled);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetGroupMode
+   */
+  bool GetGroupMode() const;
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::SetWrapMode
+   */
+  void SetWrapMode(bool wrapped);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetWrapMode
+   */
+  bool GetWrapMode() const;
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::SetFocusIndicatorActor
+   */
+  void SetFocusIndicatorActor(Actor indicator);
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetFocusIndicatorActor
+   */
+  Actor GetFocusIndicatorActor();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::GetFocusGroup
+   */
+  Actor GetFocusGroup(Actor actor);
+
+public:
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::FocusChangedSignal()
+   */
+  Toolkit::AccessibilityManager::FocusChangedSignalType& FocusChangedSignal();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::FocusOvershotSignal()
+   */
+  Toolkit::AccessibilityManager::FocusOvershotSignalType& FocusOvershotSignal();
+
+  /**
+   * @copydoc Toolkit::AccessibilityManager::FocusedActorActivatedSignal()
+   */
+  Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+
+  /**
+   * Connects a callback function with the object's signals.
+   * @param[in] object The object providing the signal.
+   * @param[in] tracker Used to disconnect the signal.
+   * @param[in] signalName The signal to connect to.
+   * @param[in] functor A newly allocated FunctorDelegate.
+   * @return True if the signal was connected.
+   * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+   */
+  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+public:  // Signals
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::StatusChangedSignal
+   */
+  AccessibilityActionSignalType& StatusChangedSignal()
+  {
+    return mStatusChangedSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::AccessibilityAdaptor::ActionNextSignal
+   */
+  AccessibilityActionSignalType& ActionNextSignal()
+  {
+    return mActionNextSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionPreviousSignal
+   */
+  AccessibilityActionSignalType& ActionPreviousSignal()
+  {
+    return mActionPreviousSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionActivateSignal
+   */
+  AccessibilityActionSignalType& ActionActivateSignal()
+  {
+    return mActionActivateSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionOverSignal
+   */
+  AccessibilityActionSignalType& ActionOverSignal()
+  {
+    return mActionOverSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadSignal
+   */
+  AccessibilityActionSignalType& ActionReadSignal()
+  {
+    return mActionReadSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadNextSignal
+   */
+  AccessibilityActionSignalType& ActionReadNextSignal()
+  {
+    return mActionReadNextSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadPreviousSignal
+   */
+  AccessibilityActionSignalType& ActionReadPreviousSignal()
+  {
+    return mActionReadPreviousSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionUpSignal
+   */
+  AccessibilityActionSignalType& ActionUpSignal()
+  {
+    return mActionUpSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionDownSignal
+   */
+  AccessibilityActionSignalType& ActionDownSignal()
+  {
+    return mActionDownSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionClearFocusSignal
+   */
+  AccessibilityActionSignalType& ActionClearFocusSignal()
+  {
+    return mActionClearFocusSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionBackSignal
+   */
+  AccessibilityActionSignalType& ActionBackSignal()
+  {
+    return mActionBackSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollUpSignal
+   */
+  AccessibilityActionSignalType& ActionScrollUpSignal()
+  {
+    return mActionScrollUpSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollDownSignal
+   */
+  AccessibilityActionSignalType& ActionScrollDownSignal()
+  {
+    return mActionScrollDownSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageLeftSignal
+   */
+  AccessibilityActionSignalType& ActionPageLeftSignal()
+  {
+    return mActionPageLeftSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageRightSignal
+   */
+  AccessibilityActionSignalType& ActionPageRightSignal()
+  {
+    return mActionPageRightSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageUpSignal
+   */
+  AccessibilityActionSignalType& ActionPageUpSignal()
+  {
+    return mActionPageUpSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageDownSignal
+   */
+  AccessibilityActionSignalType& ActionPageDownSignal()
+  {
+    return mActionPageDownSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionMoveToFirstSignal
+   */
+  AccessibilityActionSignalType& ActionMoveToFirstSignal()
+  {
+    return mActionMoveToFirstSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionMoveToLastSignal
+   */
+  AccessibilityActionSignalType& ActionMoveToLastSignal()
+  {
+    return mActionMoveToLastSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadFromTopSignal
+   */
+  AccessibilityActionSignalType& ActionReadFromTopSignal()
+  {
+    return mActionReadFromTopSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadFromNextSignal
+   */
+  AccessibilityActionSignalType& ActionReadFromNextSignal()
+  {
+    return mActionReadFromNextSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionZoomSignal
+   */
+  AccessibilityActionSignalType& ActionZoomSignal()
+  {
+    return mActionZoomSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadIndicatorInformationSignal
+   */
+  AccessibilityActionSignalType& ActionReadIndicatorInformationSignal()
+  {
+    return mActionReadIndicatorInformationSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadPauseResumeSignal
+   */
+  AccessibilityActionSignalType& ActionReadPauseResumeSignal()
+  {
+    return mActionReadPauseResumeSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionStartStopSignal
+   */
+  AccessibilityActionSignalType& ActionStartStopSignal()
+  {
+    return mActionStartStopSignal;
+  }
+
+  /**
+   * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollSignal
+   */
+  AccessibilityActionScrollSignalType& ActionScrollSignal()
+  {
+    return mActionScrollSignal;
+  }
+
+protected:
+
+  /**
+   * Destructor
+   */
+  virtual ~AccessibilityManager();
+
+private:
+
+  /**
+   * Get the additional information (e.g. focus order and description) of the given actor.
+   * @param actorID The ID of the actor to be queried
+   * @return The additional information of the actor
+   */
+  ActorAdditionalInfo GetActorAdditionalInfo(const unsigned int actorID) const;
+
+  /**
+   * Synchronize the actor's additional information to reflect its latest focus order
+   * @param actorID The ID of the actor
+   * @param order The focus order of the actor
+   * @return The additional information of the actor
+   */
+  void SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order);
+
+  /**
+   * Move the focus to the specified actor and send notification for the focus change.
+   * @param actorID The ID of the actor to be queried
+   * @return Whether the focus is successful or not
+   */
+  bool DoSetCurrentFocusActor(const unsigned int actorID);
+
+  /**
+   * Move the focus to the next actor in the focus chain towards the specified direction.
+   * @param focusIDIter The iterator pointing to the current focused actor
+   * @param forward Whether the focus movement is forward or not. The focus movement will be backward if this is false.
+   * @param wrapped Whether the focus shoule be moved wrapped around or not
+   * @return Whether the focus is successful or not
+   */
+  bool DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped);
+
+  /**
+   * Activate the actor. If the actor is control, call OnAccessibilityActivated virtual function.
+   * This function will emit FocusedActorActivatedSignal.
+   * @param actor The actor to activate
+   */
+  void DoActivate(Actor actor);
+
+  /**
+   * Create the default indicator actor to highlight the focused actor.
+   */
+  void CreateDefaultFocusIndicatorActor();
+
+  /**
+   * Set whether the actor is focusable or not. A focusable property will be registered for
+   * the actor if not yet.
+   * @param actor The actor to be focused
+   * @param focusable Whether the actor is focusable or not
+   */
+  void SetFocusable(Actor actor, bool focusable);
+
+  /**
+   * Handle the accessibility pan gesture.
+   * @param[in]  panEvent  The pan event to be handled.
+   * @return whether the gesture is handled successfully or not.
+   */
+  virtual bool HandlePanGesture(const Integration::PanGestureEvent& panEvent);
+
+  /**
+   * Change the accessibility status when Accessibility feature(screen-reader) turned on or off.
+   * @return whether the status is changed or not.
+   */
+  virtual bool ChangeAccessibilityStatus();
+
+  /**
+   * Clear the accessibility focus from the current focused actor.
+   * @return whether the focus is cleared or not.
+   */
+  virtual bool ClearAccessibilityFocus();
+
+  /**
+   * Perform the accessibility action associated with a scroll event.
+   * @param touchEvent The touch point (and time) of the event.
+   * @return whether the focus is cleared or not.
+   */
+  virtual bool AccessibilityActionScroll( Dali::TouchEvent& touchEvent );
+
+  /**
+   * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionPrevious(bool allowEndFeedback);
+
+  /**
+   * Perform the accessibility action to move focus to the next focusable actor (by one finger flick down).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionNext(bool allowEndFeedback);
+
+  /**
+   * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick left).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionReadPrevious(bool allowEndFeedback);
+
+  /**
+   * Perform the accessibility action to move focus to the next focusable actor (by one finger flick right).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionReadNext(bool allowEndFeedback);
+
+  /**
+   * Perform the accessibility action to focus and read the actor (by one finger tap or move).
+   * @param allowReadAgain true if the action read again the same object (i.e. read action)
+   *                       false if the action just read when the focus object is changed (i.e. over action)
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionRead(bool allowReadAgain);
+
+  /**
+   * Perform the accessibility action to activate the current focused actor (by one finger double tap).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionActivate();
+
+  /**
+   * Perform the accessibility action to change the value when the current focused actor is a slider
+   * (by double finger down and move up and right).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionUp();
+
+  /**
+   * Perform the accessibility action to change the value when the current focused actor is a slider
+   * (by double finger down and move down and left).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionDown();
+
+  /**
+   * Perform the accessibility action to navigate back (by two fingers circle draw).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionBack();
+
+  /**
+   * Perform the accessibility action to scroll up the list and focus on the first item on the list
+   * after the scrolling and read the item (by two finger swipe up).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionScrollUp();
+
+  /**
+   * Perform the accessibility action to scroll down the list and focus on the first item on the list
+   * after the scrolling and read the item (by two finger swipe down).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionScrollDown();
+
+  /**
+   * Perform the accessibility action to scroll left to the previous page (by two finger swipe left).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionPageLeft();
+
+  /**
+   * Perform the accessibility action to scroll right to the next page (by two finger swipe right).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionPageRight();
+
+  /**
+   * Perform the accessibility action to scroll up to the previous page (by one finger swipe left and right).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionPageUp();
+
+  /**
+   * Perform the accessibility action to scroll down to the next page (by one finger swipe right and left).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionPageDown();
+
+  /**
+   * Perform the accessibility action to move the focus to the first item on the screen
+   * (by one finger swipe up and down).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionMoveToFirst();
+
+  /**
+   * Perform the accessibility action to move the focus to the last item on the screen
+   * (by one finger swipe down and up).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionMoveToLast();
+
+  /**
+   * Perform the accessibility action to move the focus to the first item on the top
+   * and read from the top item continously (by three fingers single tap).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionReadFromTop();
+
+  /**
+   * Perform the accessibility action to move the focus to and read from the next item
+   * continously (by three fingers double tap).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionReadFromNext();
+
+  /**
+   * Perform the accessibility action to move the focus to do the zooming (by one finger triple tap).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionZoom();
+
+  /**
+   * Perform the accessibility action to read the information in the indicator (by two fingers triple tap).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionReadIndicatorInformation();
+
+  /**
+   * Perform the accessibility action to pause/resume the current read out (by two fingers single tap).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionReadPauseResume();
+
+  /**
+   * Perform the accessibility action to start/stop the current action (by two fingers double tap).
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionStartStop();
+
+  /**
+   * Perform the accessibility action to mouse move (by one finger tap & hold and move).
+   * @param touchEvent touch event structure
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionTouch(const TouchEvent& touchEvent);
+
+  /**
+   * This function is connected to the TtsPlayer StateChangeSignal.
+   * It is called when the TTS players state changes.
+   * @param previousState The previous state of the TTS player (for comparison)
+   * @param currentState  The current state of the TTS player
+   */
+  void TtsStateChanged( const Dali::TtsPlayer::State previousState, const Dali::TtsPlayer::State currentState );
+
+private:
+
+  // Undefined
+  AccessibilityManager(const AccessibilityManager&);
+
+  AccessibilityManager& operator=(const AccessibilityManager& rhs);
+
+private:
+
+  Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
+  Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted
+  Toolkit::AccessibilityManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
+
+  // Action signals.
+  AccessibilityActionSignalType       mStatusChangedSignal;
+  AccessibilityActionSignalType       mActionNextSignal;
+  AccessibilityActionSignalType       mActionPreviousSignal;
+  AccessibilityActionSignalType       mActionActivateSignal;
+  AccessibilityActionSignalType       mActionOverSignal;
+  AccessibilityActionSignalType       mActionReadSignal;
+  AccessibilityActionSignalType       mActionReadNextSignal;
+  AccessibilityActionSignalType       mActionReadPreviousSignal;
+  AccessibilityActionSignalType       mActionUpSignal;
+  AccessibilityActionSignalType       mActionDownSignal;
+  AccessibilityActionSignalType       mActionClearFocusSignal;
+  AccessibilityActionSignalType       mActionBackSignal;
+  AccessibilityActionSignalType       mActionScrollUpSignal;
+  AccessibilityActionSignalType       mActionScrollDownSignal;
+  AccessibilityActionSignalType       mActionPageLeftSignal;
+  AccessibilityActionSignalType       mActionPageRightSignal;
+  AccessibilityActionSignalType       mActionPageUpSignal;
+  AccessibilityActionSignalType       mActionPageDownSignal;
+  AccessibilityActionSignalType       mActionMoveToFirstSignal;
+  AccessibilityActionSignalType       mActionMoveToLastSignal;
+  AccessibilityActionSignalType       mActionReadFromTopSignal;
+  AccessibilityActionSignalType       mActionReadFromNextSignal;
+  AccessibilityActionSignalType       mActionZoomSignal;
+  AccessibilityActionSignalType       mActionReadIndicatorInformationSignal;
+  AccessibilityActionSignalType       mActionReadPauseResumeSignal;
+  AccessibilityActionSignalType       mActionStartStopSignal;
+  AccessibilityActionScrollSignalType mActionScrollSignal;
+
+  FocusIDContainer mFocusIDContainer;       ///< The container to look up actor ID by focus order
+  IDAdditionalInfoContainer mIDAdditionalInfoContainer; ///< The container to look up additional information by actor ID
+  FocusIDPair mCurrentFocusActor;           ///< The focus order and actor ID of current focused actor
+  Actor mCurrentGesturedActor;              ///< The actor that will handle the gesture
+  Actor mFocusIndicatorActor;               ///< The focus indicator actor shared by all the focusable actors for highlight
+  Vector2 mPreviousPosition;                ///< The previous pan position; useful for calculating velocity for Gesture::Finished events
+  unsigned int mRecursiveFocusMoveCounter;  ///< The counter to count the number of recursive focus movement attempted before the focus movement is successful.
+
+  bool mIsWrapped:1;                        ///< Whether the focus movement is wrapped around or not
+  bool mIsFocusWithinGroup:1;               ///< Whether the focus movement is limited to the current focus group or not
+  bool mIsEndcapFeedbackEnabled:1;          ///< Whether the endcap feedback need to be played when the focus leaves the end or vice versa
+  bool mIsEndcapFeedbackPlayed:1;           ///< Whether the endcap feedback was played or not
+  bool mIsAccessibilityTtsEnabled:1;        ///< Whether accessibility feature(screen-reader) turned on/off
+  bool mTtsCreated:1;                       ///< Whether the TTS Player has been accessed
+  bool mIsFocusIndicatorEnabled:1;          ///< Whether indicator should be shown / hidden. It could be enabled when TTS enabled or 'Tab' key operated.
+  bool mContinuousPlayMode:1;               ///< Keeps track of whether or not we are in continuous play mode
+
+};
+
+} // namespace Internal
+
+inline Internal::AccessibilityManager& GetImpl(Dali::Toolkit::AccessibilityManager& obj)
+{
+  DALI_ASSERT_ALWAYS(obj);
+
+  Dali::BaseObject& handle = obj.GetBaseObject();
+
+  return static_cast<Internal::AccessibilityManager&>(handle);
+}
+
+inline const Internal::AccessibilityManager& GetImpl(const Dali::Toolkit::AccessibilityManager& obj)
+{
+  DALI_ASSERT_ALWAYS(obj);
+
+  const Dali::BaseObject& handle = obj.GetBaseObject();
+
+  return static_cast<const Internal::AccessibilityManager&>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__
index 266e8b9..a5f0462 100644 (file)
@@ -20,6 +20,8 @@
 // EXTERNAL INCLUDE
 #include <iostream>
 #include <string.h>
+#include <dali/devel-api/rendering/sampler.h>
+#include <dali/devel-api/rendering/shader.h>
 #include <dali/integration-api/debug.h>
 
 namespace Dali
@@ -41,6 +43,47 @@ namespace
   const uint32_t DOUBLE_PIXEL_PADDING( SINGLE_PIXEL_PADDING << 1 );
   const uint32_t FILLED_PIXEL( -1 );
   Toolkit::AtlasManager::AtlasSize EMPTY_SIZE;
+
+  #define MAKE_SHADER(A)#A
+
+  const char* VERTEX_SHADER = MAKE_SHADER(
+  attribute mediump vec2    aPosition;
+  attribute mediump vec2    aTexCoord;
+  uniform   mediump mat4    uMvpMatrix;
+  uniform   mediump vec3    uSize;
+  varying   mediump vec2    vTexCoord;
+
+  void main()
+  {
+    mediump vec4 position = vec4( aPosition, 0.0, 1.0 );
+    position.xyz *= uSize;
+    gl_Position = uMvpMatrix * position;
+    vTexCoord = aTexCoord;
+  }
+  );
+
+  const char* FRAGMENT_SHADER_L8 = MAKE_SHADER(
+  uniform lowp    vec4      uColor;
+  uniform         sampler2D sTexture;
+  varying mediump vec2      vTexCoord;
+
+  void main()
+  {
+    mediump vec4 color = texture2D( sTexture, vTexCoord );
+    gl_FragColor = vec4( uColor.rgb, uColor.a * color.r );
+  }
+  );
+
+  const char* FRAGMENT_SHADER_RGBA = MAKE_SHADER(
+  uniform         sampler2D sTexture;
+  varying mediump vec2      vTexCoord;
+
+  void main()
+  {
+    gl_FragColor = texture2D( sTexture, vTexCoord );
+  }
+  );
+
 }
 
 AtlasManager::AtlasManager()
@@ -51,6 +94,8 @@ AtlasManager::AtlasManager()
   mNewAtlasSize.mHeight = DEFAULT_ATLAS_HEIGHT;
   mNewAtlasSize.mBlockWidth = DEFAULT_BLOCK_WIDTH;
   mNewAtlasSize.mBlockHeight = DEFAULT_BLOCK_HEIGHT;
+  mShaderL8 = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_L8 );
+  mShaderRgba = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_RGBA );
 }
 
 AtlasManagerPtr AtlasManager::New()
@@ -61,10 +106,30 @@ AtlasManagerPtr AtlasManager::New()
 
 AtlasManager::~AtlasManager()
 {
-  for ( uint32_t i = 0; i < mAtlasList.size(); ++i )
+  for ( SizeType i = 0; i < mAtlasList.size(); ++i )
   {
+    mAtlasList[ i ].mAtlas.UploadedSignal().Disconnect( this, &AtlasManager::OnUpload );
     delete[] mAtlasList[ i ].mStripBuffer;
   }
+
+  // Are there any upload signals pending? Free up those buffer images now.
+  for ( SizeType i = 0; i < mUploadedImages.Size(); ++i )
+  {
+    delete[] mUploadedImages[ i ];
+  }
+}
+
+void AtlasManager::OnUpload( Image image )
+{
+  if ( mUploadedImages.Size() )
+  {
+    delete[] mUploadedImages[ 0 ];
+    mUploadedImages.Erase( mUploadedImages.Begin() );
+  }
+  else
+  {
+    DALI_LOG_ERROR("Atlas Image Upload List should not be empty\n");
+  }
 }
 
 Toolkit::AtlasManager::AtlasId AtlasManager::CreateAtlas( const Toolkit::AtlasManager::AtlasSize& size, Pixel::Format pixelformat )
@@ -87,15 +152,11 @@ Toolkit::AtlasManager::AtlasId AtlasManager::CreateAtlas( const Toolkit::AtlasMa
   atlasDescriptor.mAtlas = atlas;
   atlasDescriptor.mSize = size;
   atlasDescriptor.mPixelFormat = pixelformat;
-  std::stringstream materialLabel;
-  materialLabel << "Atlas Material - ";
-  materialLabel << mAtlasList.size();
-  atlasDescriptor.mMaterial = Material::New( materialLabel.str() );
-  atlasDescriptor.mMaterial.SetDiffuseTexture( atlas );
   atlasDescriptor.mNextFreeBlock = 1u; // indicate next free block will be the first ( +1 )
+  atlas.UploadedSignal().Connect( this, &AtlasManager::OnUpload );
 
   // What size do we need for this atlas' strip buffer ( assume 32bit pixel format )?
-  uint32_t neededStripSize =( blockWidth > blockHeight - DOUBLE_PIXEL_PADDING ? blockWidth : blockHeight - DOUBLE_PIXEL_PADDING ) << 2;
+  SizeType neededStripSize =( blockWidth > blockHeight - DOUBLE_PIXEL_PADDING ? blockWidth : blockHeight - DOUBLE_PIXEL_PADDING ) << 2;
   atlasDescriptor.mStripBuffer = new PixelBuffer[ neededStripSize ];
   memset( atlasDescriptor.mStripBuffer, 0, neededStripSize );
 
@@ -108,8 +169,16 @@ Toolkit::AtlasManager::AtlasId AtlasManager::CreateAtlas( const Toolkit::AtlasMa
                                                      SINGLE_PIXEL_PADDING,
                                                      blockHeight - DOUBLE_PIXEL_PADDING,
                                                      pixelformat );
+  mUploadedImages.PushBack( NULL );
   atlasDescriptor.mFilledPixelImage = BufferImage::New( reinterpret_cast< PixelBuffer* >( &mFilledPixel ), 1, 1, pixelformat );
   atlas.Upload( atlasDescriptor.mFilledPixelImage, 0, 0 );
+
+  Sampler sampler = Sampler::New( atlas, "sTexture" );
+  sampler.SetProperty( Sampler::Property::AFFECTS_TRANSPARENCY, true );
+  atlasDescriptor.mMaterial = Material::New( pixelformat == Pixel::L8 ? mShaderL8 : mShaderRgba );
+  atlasDescriptor.mMaterial.AddSampler( sampler );
+  atlasDescriptor.mSampler = sampler;
+  atlasDescriptor.mMaterial.SetBlendMode( BlendingMode::ON );
   mAtlasList.push_back( atlasDescriptor );
   return mAtlasList.size();
 }
@@ -169,7 +238,7 @@ void AtlasManager::Add( const BufferImage& image,
     if ( Toolkit::AtlasManager::FAIL_ON_ADD_FAILS == mAddFailPolicy || !foundAtlas-- )
     {
       // Haven't found an atlas for this image!!!!!!
-          return;
+      return;
     }
   }
 
@@ -265,16 +334,12 @@ void AtlasManager::CreateMesh( SizeType atlas,
                                const Vector2& position,
                                SizeType widthInBlocks,
                                SizeType heightInBlocks,
-                               Dali::MeshData& meshData,
+                               Toolkit::AtlasManager::Mesh2D& mesh,
                                AtlasSlotDescriptor& desc )
 {
-  Dali::MeshData::Vertex vertex;
-  Dali::MeshData::VertexContainer vertices;
-  Dali::MeshData::FaceIndices faces;
-  Dali::MeshData::FaceIndex faceIndex = 0;
-  meshData.SetHasNormals( false );
-  meshData.SetHasColor( true );
-  meshData.SetHasTextureCoords( true );
+
+  Toolkit::AtlasManager::Vertex2D vertex;
+  uint32_t faceIndex = 0;       // TODO change to unsigned short when property type is available
 
   SizeType blockWidth = mAtlasList[ atlas ].mSize.mBlockWidth;
   SizeType blockHeight = mAtlasList[ atlas ].mSize.mBlockHeight;
@@ -354,49 +419,45 @@ void AtlasManager::CreateMesh( SizeType atlas,
       }
 
       // Top left
-      vertex.x = topLeft.x;
-      vertex.y = topLeft.y;
-      vertex.z = 0.0f;
-      vertex.u = fBlockX;
-      vertex.v = fBlockY;
+      vertex.mPosition.x = topLeft.x;
+      vertex.mPosition.y = topLeft.y;
+      vertex.mTexCoords.x = fBlockX;
+      vertex.mTexCoords.y = fBlockY;
 
-      vertices.push_back( vertex );
+      mesh.mVertices.PushBack( vertex );
 
       // Top Right
-      vertex.x = topLeft.x + ndcVWidth;
-      vertex.y = topLeft.y;
-      vertex.z = 0.0f;
-      vertex.u = fBlockX + ndcWidth;
-      vertex.v = fBlockY;
+      vertex.mPosition.x = topLeft.x + ndcVWidth;
+      vertex.mPosition.y = topLeft.y;
+      vertex.mTexCoords.x = fBlockX + ndcWidth;
+      vertex.mTexCoords.y = fBlockY;
 
-      vertices.push_back( vertex );
+      mesh.mVertices.PushBack( vertex );
 
       // Bottom Left
-      vertex.x = topLeft.x;
-      vertex.y = topLeft.y + ndcVHeight;
-      vertex.z = 0.0f;
-      vertex.u = fBlockX;
-      vertex.v = fBlockY + ndcHeight;
+      vertex.mPosition.x = topLeft.x;
+      vertex.mPosition.y = topLeft.y + ndcVHeight;
+      vertex.mTexCoords.x = fBlockX;
+      vertex.mTexCoords.y = fBlockY + ndcHeight;
 
-      vertices.push_back( vertex );
+      mesh.mVertices.PushBack( vertex );
 
       // Bottom Right
       topLeft.x += ndcVWidth;
-      vertex.x = topLeft.x;
-      vertex.y = topLeft.y + ndcVHeight;
-      vertex.z = 0.0f;
-      vertex.u = fBlockX + ndcWidth;
-      vertex.v = fBlockY + ndcHeight;
+      vertex.mPosition.x = topLeft.x;
+      vertex.mPosition.y = topLeft.y + ndcVHeight;
+      vertex.mTexCoords.x = fBlockX + ndcWidth;
+      vertex.mTexCoords.y = fBlockY + ndcHeight;
 
-      vertices.push_back( vertex );
+      mesh.mVertices.PushBack( vertex );
 
       // Six indices in counter clockwise winding
-      faces.push_back( faceIndex + 1u );
-      faces.push_back( faceIndex );
-      faces.push_back( faceIndex + 2u );
-      faces.push_back( faceIndex + 2u );
-      faces.push_back( faceIndex + 3u );
-      faces.push_back( faceIndex + 1u );
+      mesh.mIndices.PushBack( faceIndex + 1u );
+      mesh.mIndices.PushBack( faceIndex );
+      mesh.mIndices.PushBack( faceIndex + 2u );
+      mesh.mIndices.PushBack( faceIndex + 2u );
+      mesh.mIndices.PushBack( faceIndex + 3u );
+      mesh.mIndices.PushBack( faceIndex + 1u );
       faceIndex += 4;
     }
 
@@ -408,62 +469,53 @@ void AtlasManager::CreateMesh( SizeType atlas,
   // If there's only one block then skip this next vertex optimisation
   if ( widthInBlocks * heightInBlocks > 1 )
   {
-    Dali::MeshData::VertexContainer optimizedVertices;
-    OptimizeVertices( vertices, faces, optimizedVertices );
-    meshData.SetVertices( optimizedVertices );
-  }
-  else
-  {
-    meshData.SetVertices( vertices );
+    Toolkit::AtlasManager::Mesh2D optimizedMesh;
+    OptimizeMesh( mesh, optimizedMesh );
   }
-
-  meshData.SetFaceIndices( faces );
-  meshData.SetMaterial( mAtlasList[ atlas ].mMaterial );
+  //PrintMeshData( mesh );
 }
 
-void AtlasManager::PrintMeshData( const MeshData& meshData )
+void AtlasManager::PrintMeshData( const Toolkit::AtlasManager::Mesh2D& mesh )
 {
-  std::cout << "\nMesh Data for Image: VertexCount = " << meshData.GetVertexCount();
-  std::cout << ", Triangles = " << meshData.GetFaceCount() << std::endl;
+  uint32_t vertexCount = mesh.mVertices.Size();
+  uint32_t indexCount = mesh.mIndices.Size();
+  std::cout << "\nMesh Data for Image: VertexCount = " << vertexCount;
+  std::cout << ", Triangles = " << indexCount / 3 << std::endl;
 
-  Dali::MeshData::VertexContainer vertices = meshData.GetVertices();
-  Dali::MeshData::FaceIndices faces = meshData.GetFaces();
-
-  for ( SizeType v = 0; v < vertices.size(); ++v )
+  for ( SizeType v = 0; v < vertexCount; ++v )
   {
-    std::cout << " Vertex(" << v << ") x = " << vertices[v].x << ", ";
-    std::cout << "y = " << vertices[v].y << ", " << "z = " << vertices[v].z << ", ";
-    std::cout << "u = " << vertices[v].u << ", " << "v = " << vertices[v].v << std::endl;
+    std::cout << " Vertex(" << v << ") x = " << mesh.mVertices[v].mPosition.x << ", ";
+    std::cout << "y = " << mesh.mVertices[v].mPosition.y << ", ";
+    std::cout << "u = " << mesh.mVertices[v].mTexCoords.x << ", ";
+    std::cout << "v = " << mesh.mVertices[v].mTexCoords.y << std::endl;
   }
 
   std::cout << "\n Indices: ";
-  for ( SizeType i = 0; i < faces.size(); ++i )
+  for ( SizeType i = 0; i < indexCount; ++i )
   {
-    std::cout << " " << faces[ i ];
+    std::cout << " " << mesh.mIndices[ i ];
   }
   std::cout << std::endl;
 }
 
-void AtlasManager::OptimizeVertices( const MeshData::VertexContainer& in,
-                                     MeshData::FaceIndices& faces,
-                                     MeshData::VertexContainer& out )
+void AtlasManager::OptimizeMesh( const Toolkit::AtlasManager::Mesh2D& in,
+                                 Toolkit::AtlasManager::Mesh2D& out )
 {
   unsigned short vertexIndex = 0;
 
   // We could check to see if blocks are next to each other, but it's probably just as quick to compare verts
-  for ( SizeType i = 0; i < faces.size(); ++i )
+  for ( SizeType i = 0; i < in.mIndices.Size(); ++i )
   {
     // Fetch a vertex, has it already been assigned?
     bool foundVertex = false;
-    Dali::MeshData::Vertex v = in[ faces [ i ] ];
-    for ( SizeType j = 0; j < vertexIndex; ++j )
+    Toolkit::AtlasManager::Vertex2D v = in.mVertices[ in.mIndices[ i ] ];
+    for ( SizeType j = 0; j < out.mVertices.Size(); ++j )
     {
-      if ( v.x == out[ j ].x && v.y == out[ j ].y && v.z == out[ j ].z &&
-           v.u == out[ j ].u && v.v == out[ j ].v && v.nX == out[ j ].nX &&
-           v.nY == out[ j ].nY && v.nZ == out[ j ].nZ )
+      if ( v.mPosition.x == out.mVertices[ j ].mPosition.x && v.mPosition.y == out.mVertices[ j ].mPosition.y &&
+           v.mTexCoords.x == out.mVertices[ j ].mTexCoords.x && v.mTexCoords.y == out.mVertices[ j ].mTexCoords.y )
       {
         // Yes, so store this down as the vertex to use
-        faces[ i ] = j;
+        out.mIndices.PushBack( j );
         foundVertex = true;
         break;
       }
@@ -472,103 +524,70 @@ void AtlasManager::OptimizeVertices( const MeshData::VertexContainer& in,
     // Did we find a vertex ?
     if ( !foundVertex )
     {
-      // Add a new vertex
-      faces[ i ] = vertexIndex++;
-      out.push_back( v );
+      // No so add a new one
+      out.mVertices.PushBack( v );
+      vertexIndex++;
     }
   }
 }
 
-void AtlasManager::StitchMesh( MeshData& first,
-                               const MeshData& second,
+void AtlasManager::StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
+                               const Toolkit::AtlasManager::Mesh2D& second,
                                bool optimize )
 {
+  uint32_t vc = first.mVertices.Size();
 
-  // Would be much quicker to be able to get a non-const reference to these containers and update in situ
-  MeshData::VertexContainer v1 = first.GetVertices();
-  MeshData::VertexContainer v2 = second.GetVertices();
-  MeshData::FaceIndices f1 = first.GetFaces();
-  MeshData::FaceIndices f2 = second.GetFaces();
-
-  uint32_t vc1 = first.GetVertexCount();
-  uint32_t vc2 = second.GetVertexCount();
-
-  for ( uint32_t v = 0; v < vc2; ++v )
+  for ( uint32_t v = 0; v < second.mVertices.Size(); ++v )
   {
-    v1.push_back( v2[ v ] );
+    first.mVertices.PushBack( second.mVertices[ v ] );
   }
 
-  for ( uint32_t f = 0; f < f2.size(); ++f )
+  for ( uint32_t i = 0; i < second.mIndices.Size(); ++i )
   {
-    f1.push_back( f2[ f ] + vc1 );
+    first.mIndices.PushBack( second.mIndices[ i ] + vc );
   }
 
   if ( optimize )
   {
-    MeshData::VertexContainer optimizedVertices;
-    OptimizeVertices( v1, f1, optimizedVertices );
-    first.SetVertices( optimizedVertices );
-  }
-  else
-  {
-    first.SetVertices( v1 );
+    Toolkit::AtlasManager::Mesh2D optimizedMesh;
+    OptimizeMesh( first, optimizedMesh );
+    first = optimizedMesh;
   }
-
-  first.SetFaceIndices( f1 );
 }
 
-void AtlasManager::StitchMesh( const MeshData& first,
-                               const MeshData& second,
-                               MeshData& out,
+void AtlasManager::StitchMesh( const Toolkit::AtlasManager::Mesh2D& first,
+                               const Toolkit::AtlasManager::Mesh2D& second,
+                               Toolkit::AtlasManager::Mesh2D& out,
                                bool optimize )
 {
-  MeshData::VertexContainer v1 = first.GetVertices();
-  MeshData::VertexContainer v2 = second.GetVertices();
-  MeshData::FaceIndices f1 = first.GetFaces();
-  MeshData::FaceIndices f2 = second.GetFaces();
-
-  uint32_t vc1 = first.GetVertexCount();
-  uint32_t vc2 = second.GetVertexCount();
-
-  MeshData::VertexContainer vertices;
-
-  MeshData::FaceIndices faces;
-
-  MeshData::Vertex vertex;
+  uint32_t vc = first.mVertices.Size();
 
-  for ( uint32_t v = 0; v < vc1; ++v )
+  for ( uint32_t v = 0; v < vc; ++v )
   {
-    vertices.push_back( v1[ v ] );
+    out.mVertices.PushBack( first.mVertices[ v ] );
   }
 
-  for ( uint32_t v = 0; v < vc2; ++v )
+  for ( uint32_t v = 0; v < second.mVertices.Size(); ++v )
   {
-    vertices.push_back( v2[ v  ] );
+    out.mVertices.PushBack( second.mVertices[ v ] );
   }
 
-  for ( uint32_t f = 0; f < f1.size(); ++f )
+  for ( uint32_t i = 0; i < first.mIndices.Size(); ++i )
   {
-    faces.push_back( f1[ f ] );
+    out.mIndices.PushBack( first.mIndices[ i ] );
   }
 
-  for ( uint32_t f = 0; f < f2.size(); ++f )
+  for ( uint32_t i = 0; i < second.mIndices.Size(); ++i )
   {
-    faces.push_back( f2[ f ] + vc1 );
+    out.mIndices.PushBack( second.mIndices[ i ] + vc );
   }
 
   if ( optimize )
   {
-    MeshData::VertexContainer optimizedVertices;
-    OptimizeVertices( vertices, faces, optimizedVertices );
-    out.SetVertices( optimizedVertices );
+    Toolkit::AtlasManager::Mesh2D optimizedMesh;
+    OptimizeMesh( out, optimizedMesh );
+    out = optimizedMesh;
   }
-  else
-  {
-    out.SetVertices( vertices );
-  }
-
-  out.SetMaterial( first.GetMaterial() );
-  out.SetFaceIndices( faces );
 }
 
 void AtlasManager::UploadImage( const BufferImage& image,
@@ -604,6 +623,10 @@ void AtlasManager::UploadImage( const BufferImage& image,
   {
     DALI_LOG_ERROR("Uploading image to Atlas Failed!.\n");
   }
+  else
+  {
+     mUploadedImages.PushBack( const_cast< BufferImage& >( image ).GetBuffer() );
+  }
 
   // If this is the first block then we need to keep the first pixel free for underline texture
   if ( block )
@@ -616,6 +639,10 @@ void AtlasManager::UploadImage( const BufferImage& image,
     {
       DALI_LOG_ERROR("Uploading top strip to Atlas Failed!\n");
     }
+    else
+    {
+      mUploadedImages.PushBack( NULL );
+    }
 
     // Blit left strip
     if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mVerticalStrip,
@@ -624,6 +651,10 @@ void AtlasManager::UploadImage( const BufferImage& image,
     {
       DALI_LOG_ERROR("Uploading left strip to Atlas Failed!\n");
     }
+    else
+    {
+      mUploadedImages.PushBack( NULL );
+    }
   }
 
   // Blit bottom strip
@@ -635,6 +666,10 @@ void AtlasManager::UploadImage( const BufferImage& image,
     {
       DALI_LOG_ERROR("Uploading bottom strip to Atlas Failed!.\n");
     }
+    else
+    {
+     mUploadedImages.PushBack( NULL );
+    }
   }
 
   // Blit right strip
@@ -646,12 +681,16 @@ void AtlasManager::UploadImage( const BufferImage& image,
     {
       DALI_LOG_ERROR("Uploading right strip to Atlas Failed!.\n");
     }
+    else
+    {
+      mUploadedImages.PushBack( NULL );
+    }
   }
 }
 
 void AtlasManager::GenerateMeshData( ImageId id,
                                      const Vector2& position,
-                                     MeshData& meshData,
+                                     Toolkit::AtlasManager::Mesh2D& meshData,
                                      bool addReference )
 {
   // Read the atlas Id to use for this image
@@ -830,6 +869,26 @@ void AtlasManager::GetMetrics( Toolkit::AtlasManager::Metrics& metrics )
   metrics.mTextureMemoryUsed = textureMemoryUsed;
 }
 
+Material AtlasManager::GetMaterial( AtlasId atlas ) const
+{
+  if ( atlas && atlas <= mAtlasList.size() )
+  {
+    return mAtlasList[ atlas -1u ].mMaterial;
+  }
+  Material null;
+  return null;
+}
+
+Sampler AtlasManager::GetSampler( AtlasId atlas ) const
+{
+  if ( atlas && atlas <= mAtlasList.size() )
+  {
+    return mAtlasList[ atlas -1u ].mSampler;
+  }
+  Sampler null;
+  return null;
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index 7c8470d..88f3302 100644 (file)
@@ -46,7 +46,7 @@ typedef Dali::Vector< Toolkit::AtlasManager::AtlasSlot > slotContainer;
 class AtlasManager;
 typedef IntrusivePtr<AtlasManager> AtlasManagerPtr;
 
-class AtlasManager : public Dali::BaseObject
+class AtlasManager : public Dali::BaseObject, public ConnectionTracker
 {
 public:
 
@@ -67,6 +67,7 @@ public:
     BufferImage mFilledPixelImage;                                      // Image used by atlas for operations such as underline
     PixelBuffer* mStripBuffer;                                          // Blank image buffer used to pad upload
     Material mMaterial;                                                 // material used for atlas texture
+    Sampler mSampler;                                                   // sampler used for atlas texture
     SizeType mNextFreeBlock;                                            // next free block will be placed here ( actually +1 )
     Dali::Vector< SizeType > mFreeBlocksList;                           // unless there are any previously freed blocks
   };
@@ -111,22 +112,23 @@ public:
    */
   void GenerateMeshData( ImageId id,
                          const Vector2& position,
-                         MeshData& mesh,
+                         Toolkit::AtlasManager::Mesh2D& mesh,
                          bool addReference );
 
   /**
    * @copydoc Toolkit::AtlasManager::StitchMesh
    */
-  void StitchMesh( MeshData& first,
-                   const MeshData& second,
+  void StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
+                   const Toolkit::AtlasManager::Mesh2D& second,
                    bool optimize );
 
   /**
    * @copydoc Toolkit::AtlasManager::StitchMesh
    */
-  void StitchMesh( const MeshData& first,
-                   const MeshData& second,
-                   MeshData& out, bool optimize );
+  void StitchMesh(  const Toolkit::AtlasManager::Mesh2D& first,
+                    const Toolkit::AtlasManager::Mesh2D& second,
+                    Toolkit::AtlasManager::Mesh2D& out,
+                    bool optimize );
 
   /**
    * @copydoc Toolkit::AtlasManager::Remove
@@ -178,10 +180,24 @@ public:
    */
   void GetMetrics( Toolkit::AtlasManager::Metrics& metrics );
 
+  /**
+   * @copydoc Toolkit::AtlasManager::GetMaterial
+   */
+  Material GetMaterial( AtlasId atlas ) const;
+
+/**
+   * @copydoc Toolkit::AtlasManager::GetSampler
+   */
+  Sampler GetSampler( AtlasId atlas ) const;
+
 private:
 
-  std::vector< AtlasDescriptor > mAtlasList;        // List of atlases created
-  std::vector< AtlasSlotDescriptor > mImageList;  // List of bitmaps store in atlases
+  std::vector< AtlasDescriptor > mAtlasList;            // List of atlases created
+  std::vector< AtlasSlotDescriptor > mImageList;        // List of bitmaps store in atlases
+  Vector< PixelBuffer* > mUploadedImages;               // List of PixelBuffers passed to UploadedSignal
+  Toolkit::AtlasManager::AtlasSize mNewAtlasSize;       // Atlas size to use in next creation
+  Toolkit::AtlasManager::AddFailPolicy mAddFailPolicy;  // Policy for faling to add an Image
+  SizeType mFilledPixel;                                // 32Bit pixel image for underlining
 
   SizeType CheckAtlas( SizeType atlas,
                        SizeType width,
@@ -196,21 +212,22 @@ private:
                    const Vector2& position,
                    SizeType widthInBlocks,
                    SizeType heightInBlocks,
-                   Dali::MeshData& meshData,
+                   Toolkit::AtlasManager::Mesh2D& mesh,
                    AtlasSlotDescriptor& desc );
 
-  void OptimizeVertices( const MeshData::VertexContainer& in,
-                         MeshData::FaceIndices& faces,
-                         MeshData::VertexContainer& out );
+  void OptimizeMesh( const Toolkit::AtlasManager::Mesh2D& in,
+                     Toolkit::AtlasManager::Mesh2D& out );
 
   void UploadImage( const BufferImage& image,
                     const AtlasSlotDescriptor& desc );
 
-  void PrintMeshData( const MeshData& meshData );
+  void PrintMeshData( const Toolkit::AtlasManager::Mesh2D& mesh );
+
+  void OnUpload( Image image );
+
+  Shader mShaderL8;
+  Shader mShaderRgba;
 
-  Toolkit::AtlasManager::AtlasSize mNewAtlasSize;
-  Toolkit::AtlasManager::AddFailPolicy mAddFailPolicy;
-  uint32_t mFilledPixel;
 };
 
 } // namespace Internal
index 6773416..e6b041c 100644 (file)
@@ -69,25 +69,25 @@ bool AtlasManager::Remove( ImageId id )
 
 void AtlasManager::GenerateMeshData( ImageId id,
                                      const Vector2& position,
-                                     MeshData& meshData,
+                                     Mesh2D& mesh,
                                      bool addReference )
 {
   GetImplementation(*this).GenerateMeshData( id,
                                              position,
-                                             meshData,
+                                             mesh,
                                              addReference );
 }
 
-void AtlasManager::StitchMesh( MeshData& first,
-                               const MeshData& second,
+void AtlasManager::StitchMesh( Mesh2D& first,
+                               const Mesh2D& second,
                                bool optimize )
 {
   GetImplementation(*this).StitchMesh( first, second, optimize );
 }
 
-void AtlasManager::StitchMesh( const MeshData& first,
-                               const MeshData& second,
-                               MeshData& out,
+void AtlasManager::StitchMesh( const Mesh2D& first,
+                               const Mesh2D& second,
+                               Mesh2D& out,
                                bool optimize )
 {
   GetImplementation(*this).StitchMesh( first, second, out, optimize );
@@ -130,7 +130,17 @@ Pixel::Format AtlasManager::GetPixelFormat( AtlasId atlas )
 
 void AtlasManager::GetMetrics( Metrics& metrics )
 {
-  return GetImplementation(*this).GetMetrics( metrics );
+  GetImplementation(*this).GetMetrics( metrics );
+}
+
+Material AtlasManager::GetMaterial( AtlasId atlas ) const
+{
+  return GetImplementation(*this).GetMaterial( atlas );
+}
+
+Sampler AtlasManager::GetSampler( AtlasId atlas ) const
+{
+  return GetImplementation(*this).GetSampler( atlas );
 }
 
 } // namespace Toolkit
index 2330647..79eb9b7 100644 (file)
@@ -20,9 +20,9 @@
 // EXTERNAL INCLUDES
 #include <stdint.h>
 #include <dali/public-api/common/dali-vector.h>
-#include <dali/devel-api/geometry/mesh-data.h>
-#include <dali/devel-api/images/atlas.h>
 #include <dali/public-api/images/buffer-image.h>
+#include <dali/devel-api/images/atlas.h>
+#include <dali/devel-api/rendering/material.h>
 
 namespace Dali
 {
@@ -187,6 +187,18 @@ public:
     Dali::Vector< AtlasMetricsEntry > mAtlasMetrics;    // container of atlas information
   };
 
+  struct Vertex2D
+  {
+    Vector2 mPosition;
+    Vector2 mTexCoords;
+  };
+
+  struct Mesh2D
+  {
+    Vector< Vertex2D > mVertices;
+    Vector< unsigned int> mIndices;
+  };
+
   /**
    * Create an AtlasManager handle; this can be initialised with AtlasManager::New()
    * Calling member functions with an uninitialised handle is not allowed.
@@ -278,7 +290,7 @@ public:
    */
   void GenerateMeshData( ImageId id,
                          const Vector2& position,
-                         MeshData& mesh,
+                         Mesh2D& mesh,
                          bool addReference = true );
 
   /**
@@ -288,8 +300,8 @@ public:
    * @param[in] second Second mesh
    * @param[in] optimize should we optimize vertex data
    */
-  void StitchMesh( MeshData& first,
-                   const MeshData& second,
+  void StitchMesh( Mesh2D& first,
+                   const Mesh2D& second,
                    bool optimize = false );
 
   /**
@@ -300,9 +312,9 @@ public:
    * @param[in] optimize should we optimize vertex data
    * @param[out] out resulting mesh
    */
-  void StitchMesh( const MeshData& first,
-                   const MeshData& second,
-                   MeshData& out,
+  void StitchMesh( const Mesh2D& first,
+                   const Mesh2D& second,
+                   Mesh2D& out,
                    bool optimize = false );
 
   /**
@@ -372,6 +384,23 @@ public:
    */
   void GetMetrics( Metrics& metrics );
 
+  /**
+   * @brief Get Material used by atlas
+   *
+   * @param atlas[in] atlas AtlasId
+   *
+   * @return Material used by atlas
+   */
+  Material GetMaterial( AtlasId atlas ) const;
+
+ /**
+   * @brief Get Sampler used by atlas
+   *
+   * @param atlas[in] atlas AtlasId
+   *
+   * @return Sampler used by atlas
+   */
+  Sampler GetSampler( AtlasId atlas ) const;
 private:
 
   explicit DALI_INTERNAL AtlasManager(Internal::AtlasManager *impl);
@@ -382,4 +411,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_ATLAS_MANAGER_H__
\ No newline at end of file
+#endif // __DALI_TOOLKIT_ATLAS_MANAGER_H__
index 6ef44c0..fbe8c33 100644 (file)
@@ -87,7 +87,7 @@ Actor SetupActor( const TreeNode& child, Actor& actor, const Replacement& consta
       {
         if( Property::INVALID_INDEX == index )
         {
-          actor.RegisterProperty( key, value );
+          actor.RegisterProperty( key, value, Property::READ_WRITE );
         }
         else
         {
index 93f3623..ddf2cda 100644 (file)
@@ -17,7 +17,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/layer.h>
-#include <dali/public-api/actors/renderable-actor.h>
+#include <dali/public-api/actors/image-actor.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -229,13 +229,13 @@ Animation CreateAnimation( const TreeNode& child, const Replacement& constant, D
         // to allow animating shader uniforms
         if( propIndex == Property::INVALID_INDEX )
         {
-          RenderableActor renderable = RenderableActor::DownCast( targetHandle );
-          if( renderable )
+          ImageActor imageActor = ImageActor::DownCast( targetHandle );
+          if( imageActor )
           {
             // A limitation here is that its possible that between creation of animation
             // and running it the ShaderEffect of the actor has been changed.
             // However this is a unlikely use case especially when using scripts.
-            if( ShaderEffect effect = renderable.GetShaderEffect() )
+            if( ShaderEffect effect = imageActor.GetShaderEffect() )
             {
               propIndex = effect.GetPropertyIndex( *property );
               if(propIndex != Property::INVALID_INDEX)
index ea0b15a..d4a2a3e 100644 (file)
@@ -258,7 +258,7 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
       // special field 'effect' references the shader effect instances
       if(key == "effect")
       {
-        RenderableActor actor = RenderableActor::DownCast(handle);
+        ImageActor actor = ImageActor::DownCast(handle);
         if( actor )
         {
           OptionalString str = constant.IsString( keyChild.second );
@@ -282,7 +282,7 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
 
       if( Property::INVALID_INDEX == index )
       {
-        RenderableActor actor = RenderableActor::DownCast(handle);
+        ImageActor actor = ImageActor::DownCast(handle);
         if( actor )
         {
           if( ShaderEffect effect = actor.GetShaderEffect() )
diff --git a/dali-toolkit/internal/controls/bubble-effect/bubble-actor.cpp b/dali-toolkit/internal/controls/bubble-effect/bubble-actor.cpp
new file mode 100644 (file)
index 0000000..50df6af
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2015 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 "bubble-actor.h"
+
+// EXTERNAL INCLUDES
+#include <cmath>
+#include <sstream>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+BubbleActor::BubbleActor( unsigned int numberOfBubble,
+                          const Vector2& movementArea)
+: mMovementArea( movementArea ),
+  mNumBubble( numberOfBubble )
+{
+  mActor = Actor::New();
+}
+
+void BubbleActor::MakeRenderable( Geometry geometry, Material material  )
+{
+  if( mRenderer )
+  {
+    // This function is supposed to be called once
+    return;
+  }
+
+  mRenderer = Renderer::New( geometry, material );
+
+  mActor.AddRenderer( mRenderer );
+  mActor.SetSize( mMovementArea );
+  mActor.SetParentOrigin(ParentOrigin::TOP_LEFT);
+
+  // register uniforms
+  mIndexGravity = mActor.RegisterProperty( "uGravity", 50.f );
+  mIndexDynamicScale = mActor.RegisterProperty( "uDynamicScale", 1.f );
+
+  mIndexInvertedMovementArea = mActor.RegisterProperty( "uInvertedMovementArea", Vector2(1.f,1.f) / mMovementArea );
+
+  srand(time(NULL));
+  mIndicesOffset.resize(9);
+  int offset = mMovementArea.Length() / 10.f;
+  mIndicesOffset[0] = mActor.RegisterProperty( "uOffset[0]", Vector2(0.f,0.f));
+  mIndicesOffset[1] = mActor.RegisterProperty( "uOffset[1]", Vector2(rand()%offset,rand()%offset) );
+  mIndicesOffset[2] = mActor.RegisterProperty( "uOffset[2]", Vector2(rand()%offset,-rand()%offset) );
+  mIndicesOffset[3] = mActor.RegisterProperty( "uOffset[3]", Vector2(-rand()%offset,rand()%offset) );
+  mIndicesOffset[4] = mActor.RegisterProperty( "uOffset[4]", Vector2(-rand()%offset,-rand()%offset) );
+  mIndicesOffset[5] = mActor.RegisterProperty( "uOffset[5]", Vector2(rand()%offset,0.f));
+  mIndicesOffset[6] = mActor.RegisterProperty( "uOffset[6]", Vector2(-rand()%offset,0.f));
+  mIndicesOffset[7] = mActor.RegisterProperty( "uOffset[7]", Vector2(0.f,rand()%offset));
+  mIndicesOffset[8] = mActor.RegisterProperty( "uOffset[8]", Vector2(0.f,-rand()%offset));
+
+  Vector4 zeroVector;
+  mIndiceStartEndPos.resize( mNumBubble );
+  mIndicesPercentage.resize( mNumBubble );
+  for( unsigned int i=0; i<mNumBubble; i++ )
+  {
+    std::ostringstream ossProperty;
+    ossProperty<< "uStartEndPosition["<< i << "]";
+    mIndiceStartEndPos[i] = mActor.RegisterProperty( ossProperty.str(), zeroVector );
+
+    ossProperty.str("");
+    ossProperty<< "uPercentage["<< i << "]";
+    mIndicesPercentage[i] = mActor.RegisterProperty( ossProperty.str(), 0.f );
+  }
+}
+
+Actor BubbleActor::GetMeshActor()
+{
+  return mActor;
+}
+
+void BubbleActor::SetGeometry( Geometry geometry )
+{
+  mRenderer.SetGeometry( geometry );
+}
+
+void BubbleActor::SetMovementArea( const Vector2& movementArea )
+{
+  if( movementArea == mMovementArea)
+  {
+    return;
+  }
+
+  mMovementArea = movementArea;
+  mActor.SetSize( mMovementArea );
+  mActor.SetProperty( mIndexInvertedMovementArea, Vector2(1.f,1.f) / mMovementArea );
+
+  int offset = mMovementArea.Length() / 10.f;
+  mActor.SetProperty( mIndicesOffset[1], Vector2(rand()%offset,rand()%offset) );
+  mActor.SetProperty( mIndicesOffset[2], Vector2(rand()%offset,-rand()%offset) );
+  mActor.SetProperty( mIndicesOffset[3], Vector2(-rand()%offset,rand()%offset) );
+  mActor.SetProperty( mIndicesOffset[4], Vector2(-rand()%offset,-rand()%offset) );
+  mActor.SetProperty( mIndicesOffset[5], Vector2(rand()%offset,0.f));
+  mActor.SetProperty( mIndicesOffset[6], Vector2(-rand()%offset,0.f));
+  mActor.SetProperty( mIndicesOffset[7], Vector2(0.f,rand()%offset));
+  mActor.SetProperty( mIndicesOffset[8], Vector2(0.f,-rand()%offset));
+}
+
+void BubbleActor::SetStartAndEndPosition( unsigned int index, const Vector4& startAndEndPosition )
+{
+  mActor.SetProperty( mIndiceStartEndPos[index], startAndEndPosition );
+}
+
+void BubbleActor::SetPercentage( unsigned int index, float percentage )
+{
+  mActor.SetProperty( mIndicesPercentage[index], percentage );
+}
+
+void BubbleActor::SetGravity( float gravity )
+{
+  mActor.SetProperty( mIndexGravity, gravity );
+}
+
+void BubbleActor::SetDynamicScale( float scale )
+{
+  mActor.SetProperty( mIndexDynamicScale, scale );
+}
+
+Property BubbleActor::GetPercentageProperty( unsigned int index )
+{
+  return Property( mActor, mIndicesPercentage[index] );
+}
+
+void BubbleActor::ResetProperties()
+{
+  Vector4 zeroVector;
+  for( unsigned int i=0; i<mNumBubble; i++ )
+  {
+    SetPercentage( i, 0.f);
+    SetStartAndEndPosition( i, zeroVector );
+  }
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
@@ -1,5 +1,5 @@
-#ifndef __DALI_TOOLKIT_SHADER_BUBBLE_EFFECT_H__
-#define __DALI_TOOLKIT_SHADER_BUBBLE_EFFECT_H__
+#ifndef __DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H_
+#define __DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H_
 
 /*
  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
@@ -18,8 +18,9 @@
  *
  */
 
-// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/devel-api/rendering/renderer.h>
 
 namespace Dali
 {
@@ -27,36 +28,53 @@ namespace Dali
 namespace Toolkit
 {
 
+namespace Internal
+{
+
 /**
- * BubbleEffect is a custom shader to achieve similar effect of particle system by applying on a specially created MeshActor
- * Each bubble is rendered on a patch with two triangles; and each mesh can contain multiple such patches.
+ * BubbleActor is a group of bubbles.Each bubble can be moved separately.
+ * Its custom shader achieves similar effect of particle system by applying on a specially created mesh
+ * Each bubble is rendered on a patch with two triangles; and each mesh can contain multiple such patches, thus a group.
  */
-class DALI_IMPORT_API BubbleEffect : public ShaderEffect
+class BubbleActor : public RefObject
 {
 public:
 
   /**
-   * Create an empty BubbleEffect handle
+   * Constructor
+   * @param[in] numberOfBubble How many groups of uniforms are used to control the bubble movement.
+   * Note: Limited by the maximum available uniforms, this parameter cannot be bigger than 100.
+   * Ideally use one group of uniform to control one bubble.
+   * If the num of patches in the MeshActor is more than groups of uniforms,
+   * the uniform values will be shared by multiple bubbles. Allow up to 9 times.
+   * @param[in] movementArea The size of the bubble moving area, usually the same size as the background image actor.
+   * @return A newly allocated object.
    */
-  BubbleEffect();
+  BubbleActor( unsigned int numberOfBubble,
+               const Vector2& movementArea);
 
   /**
    * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
    */
-  ~BubbleEffect();
+  ~BubbleActor(){}
 
   /**
-   * Create an initialized BubbleEffect
-   * @param[in] numberOfBubble How many groups of uniforms are used to control the bubble movement.
-   * Note: Limited by the maximum available uniforms, this parameter cannot be bigger than 100.
-   * Ideally use one group of uniform to control one bubble.
-   * If the num of patches in the MeshActor is more than groups of uniforms,
-   * the uniform values will be shared by multiple bubbles. Allow up to 9 times.
-   * @return A handle to a newly allocated Dali resource.
+   * Prepare for the rendering: create and add renderer, and register properties
+   * @param[in] geometry The geometry to be used by the renderer
+   * @param[in] material The material to be used by the renderer
+   */
+  void MakeRenderable( Geometry geometry, Material material  );
+
+  /**
+   * Return the mesh actor which is used to display the bubbles
    */
-  static BubbleEffect New( unsigned int numberOfBubble);
+  Actor GetMeshActor();
+
+  /**
+   * Sets the geometry to be used by the renderer
+   * @param[in] geometry The geometry to be used by the renderer
+   */
+  void SetGeometry( Geometry geometry );
 
   /**
    * Set the bubble movement area for the BubbleEffect
@@ -94,41 +112,39 @@ public:
   void SetDynamicScale( float scale );
 
   /**
-   * Increase both the bubble size and moving speed.
-   * Animate this peoperty to create special effect such as all the bubbles blow up on the screen.
-   * @param[in] magnification The manified factor applied on the bubble size and moving speed.
-   */
-  void SetMagnification( float magnification );
-
-  /**
-   * Get the name for the idx-th percentage property.
-   * @param[in] index The percentage property index.
-   * @return std::string containing the property name.
-   */
-  std::string GetPercentagePropertyName( unsigned int index ) const;
-
-  /**
-   * Get the name for the magnification property.
-   * @return std::string containinf the property name.
+   * Get the idx-th percentage property.
+   * @param[in] idx The percentage property index.
+   * @return the idx-th percentage property.
    */
-  std::string GetMagnificationPropertyName() const;
+  Property GetPercentageProperty( unsigned int idx );
 
   /**
    * Reset the uniform values to default.
    */
-  void ResetParameters();
+  void ResetProperties();
 
-private:// Not intended for application developers
+private:
 
-  DALI_INTERNAL BubbleEffect( ShaderEffect handle );
+  Actor        mActor;
+  Renderer     mRenderer;
 
-private:
+  Vector2      mMovementArea;      ///< The size of the bubble moving area, usually the same size as the background image actor.
 
-  unsigned int mNumberOfBubbles;
-  Vector2      mMovementArea;
+  //properties mapped as uniforms
+  std::vector<Property::Index> mIndicesOffset;             ///< Indices of the properties mapping to uniform array 'uOffset'
+  std::vector<Property::Index> mIndiceStartEndPos;         ///< Indices of the properties mapping to uniform array 'uStartAndEndPos'
+  std::vector<Property::Index> mIndicesPercentage;         ///< Indices of the properties mapping to uniform array 'uPercentage'
+  Property::Index              mIndexGravity;              ///< Index of the property mapping to uniform 'uGravity'
+  Property::Index              mIndexDynamicScale;         ///< Index of the property mapping to uniform 'uDynamicScale'
+  Property::Index              mIndexInvertedMovementArea; ///< Index of the property mapping to uniform 'uInvertedMovementArea'
+
+  unsigned int mNumBubble;  ///< How many groups of uniforms are used to control the bubble movement.
 };
 
+} // namespace Internal
+
 } // namespace Toolkit
 
 } // namespace Dali
-#endif /* __DALI_TOOLKIT_SHADER_BUBBLE_EFFECT_H__ */
+
+#endif /* __DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H_ */
diff --git a/dali-toolkit/internal/controls/bubble-effect/bubble-effect.h b/dali-toolkit/internal/controls/bubble-effect/bubble-effect.h
new file mode 100644 (file)
index 0000000..9d0e24f
--- /dev/null
@@ -0,0 +1,131 @@
+#ifndef __DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H_
+#define __DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H_
+
+/*
+ * Copyright (c) 2015 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 <sstream>
+#include <dali/devel-api/rendering/shader.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+ * Create the shader to be used by the material
+ * @param[in] numberOfBubble How many groups of uniforms are used to control the bubble movement.
+ * @return A handle to the newly created shader.
+ */
+inline Shader CreateBubbleShader( unsigned int numBubble )
+{
+  const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
+  attribute mediump float   aIndex;\n
+  attribute mediump vec2    aPosition;\n
+  attribute highp   vec2    aTexCoord;\n
+  varying   mediump vec2    vTexCoord;\n
+  uniform   mediump mat4    uMvpMatrix;\n
+  // the gravity applied to the y direction
+  uniform mediump float uGravity;\n
+  // xy: the emit position of the bubble; zw: the destination of the bubble.
+  // The bubble is moving from (xy) to (zw plus the y drop influenced by gravity).
+  uniform vec4 uStartEndPosition[NUMBER_OF_BUBBLE];\n
+  // The undergoing percentage of the bubble movement. 0.0: start from emit position, 1.0: reach the destination
+  uniform float uPercentage[NUMBER_OF_BUBBLE];\n
+  uniform vec2 uInvertedMovementArea;\n
+  // The bubble number is restricted by the available uniform num.
+  // To increase the displayed bubble, every uStartEndPosition and uPercentage uniform is applied to a small bunch of bubbles (9 here)
+  // The offset defines the random offset between bubbles within the bunch.
+  uniform vec2 uOffset[9];\n
+  // This uniform is used to change the bubble size during running time
+  uniform float uDynamicScale;\n
+  varying float vPercentage;\n
+  varying vec2  vEffectTexCoord;\n
+  void main()\n
+  {\n
+    vec4 position = vec4( aPosition, 0.0, 1.0 );\n
+    // The Z coordinate is used to record the bubble index within current mesh actor
+    int index = int(aIndex); \n
+    //for some i between 0 ~ NUMBER_OF_BUBBLE-1: i,i+NUMBER_OF_BUBBLE, i+NUMBER_OF_BUBBLE*2, ... (up to i+NUMBER_OF_BUBBLE*8) belongs to the same bunch.
+    int groupIdx = index / NUMBER_OF_BUBBLE;\n
+    // The bubbles within the same bunch applies the same uniforms uStartEndPosition[idx] & uPercentage[idx]
+    int idx = index - groupIdx*NUMBER_OF_BUBBLE;\n
+    float percentage = uPercentage[idx];
+    // early out if uPercentage is (zero || one) setting position to zero (zero sized triangles)
+    if( percentage <= 0.0 || percentage >= 1.0 )\n
+    {\n
+      gl_Position = vec4(0.0);\n
+      return;\n
+    }\n
+    vec4 startAndEnd = uStartEndPosition[idx];\n
+    // The final position is added up different offset for bubbles
+    startAndEnd.zw += uOffset[groupIdx];\n
+    \n
+    // increase the bubble size from 0% to 100% during the first 1/5 of movement & apply the dynamic scale
+    // the new xy value containes both the new scale and new bubble position
+    position.xy *= uDynamicScale*min(percentage*5.0, 1.0);\n
+    position.xy += mix(startAndEnd.xy, startAndEnd.zw, percentage);\n
+    // The gravity is g*t*t on the y direction
+    position.y += uGravity * pow(percentage, 2.0);\n
+    gl_Position = uMvpMatrix * position;\n
+    \n
+    // Add multiple bubble shapes in the effect
+    vTexCoord = aTexCoord;\n
+    vPercentage = percentage;\n
+    // Use the emit position color for the bubble
+    vEffectTexCoord = startAndEnd.xy * uInvertedMovementArea;\n
+  }\n
+  );
+
+  const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+  varying mediump vec2  vTexCoord;\n
+  uniform lowp    vec4  uColor;\n
+  uniform sampler2D     sBackground;\n
+  uniform sampler2D     sBubbleShape;\n
+  varying mediump float vPercentage;\n
+  varying mediump vec2  vEffectTexCoord;\n
+  \n
+  void main()\n
+  {\n
+    // Get the emit pisition color, and Mix with the actor color
+    mediump vec4 fragColor = texture2D(sBackground, vEffectTexCoord)*uColor;\n
+    // Apply the shape defined by the texture contained in the material
+    // And make the opacity being 0.7, and animate from 0.7 to 0 during the last 1/3 of movement
+    fragColor.a  *= texture2D(sBubbleShape, vTexCoord).a * ( 2.1 - max( vPercentage*2.1, 1.4 ) );\n
+    gl_FragColor = fragColor;\n
+  }\n
+  );
+
+  std::ostringstream vertexShaderStringStream;
+  vertexShaderStringStream << "#define NUMBER_OF_BUBBLE "<< numBubble << "\n"
+                           << VERTEX_SHADER;
+  Shader shader = Shader::New( vertexShaderStringStream.str(), FRAGMENT_SHADER );
+
+  return shader;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+#endif /* __DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H_ */
index d19daa4..af57a7f 100644 (file)
 #include "bubble-emitter-impl.h"
 
 // EXTERNAL INCLUDES
-#include <cmath>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
 #include <dali/public-api/images/resource-image.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/shader-effects/bubble-effect/color-adjuster.h>
+#include <dali-toolkit/internal/controls/bubble-effect/bubble-actor.h>
+#include <dali-toolkit/internal/controls/bubble-effect/color-adjuster.h>
+#include <dali-toolkit/internal/controls/bubble-effect/bubble-effect.h>
+
+namespace
+{
+struct Vertex
+{
+  float index;
+  Dali::Vector2 position;
+  Dali::Vector2 textureCoord;
+
+  Vertex()
+  {}
+
+  Vertex( float index, const Dali::Vector2& position, const Dali::Vector2& textureCoord )
+  : index( index ), position( position ), textureCoord( textureCoord )
+  {}
+};
+
+/**
+ * Return a random value between the given interval.
+ * @param[in] f0 The low bound
+ * @param[in] f1 The up bound
+ * @return A random value between the given interval
+ */
+float RandomRange(float f0, float f1)
+{
+  return f0 + (rand() & 0xfff) * (f1-f0) * (1.0f/4095.0f);
+}
+
+}
 
 namespace Dali
 {
@@ -40,24 +70,30 @@ BubbleEmitter::BubbleEmitter( const Vector2& movementArea,
                               unsigned int maximumNumberOfBubble,
                               const Vector2& bubbleSizeRange )
 : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
-  mMovementArea( movementArea ),
   mShapeImage( shapeImage ),
-  mTotalNumOfBubble( maximumNumberOfBubble ),
-  mRenderTaskRunning(false),
+  mMovementArea( movementArea ),
   mBubbleSizeRange( bubbleSizeRange ),
-  mCurrentUniform( 0 ),
-  mDensity( 5 )
+  mDensity( 5 ),
+  mTotalNumOfBubble( maximumNumberOfBubble ),
+  mCurrentBubble( 0 ),
+  mRenderTaskRunning(false)
 {
-  // Calculate how many BubbleEffect shaders are required
+  // Calculate how many shaders are required
   if( mTotalNumOfBubble>100 )
   {
-    mNumBubblePerShader = 100;
-    mNumShader = mTotalNumOfBubble / 100;
+    mNumBubblePerActor = 100;
+    mNumActor = mTotalNumOfBubble / 100;
+    if( mNumActor*mNumBubblePerActor < mTotalNumOfBubble )
+    {
+      mNumActor++;
+      mNumBubblePerActor =  mTotalNumOfBubble / mNumActor+1;
+      mTotalNumOfBubble = mNumActor * mNumBubblePerActor;
+    }
   }
   else
   {
-    mNumBubblePerShader = mTotalNumOfBubble;
-    mNumShader = 1;
+    mNumBubblePerActor = mTotalNumOfBubble;
+    mNumActor = 1;
   }
 }
 
@@ -92,39 +128,27 @@ void BubbleEmitter::OnInitialize()
   // Prepare the frame buffer to store the color adjusted background image
   mEffectImage = FrameBufferImage::New( mMovementArea.width/4.f, mMovementArea.height/4.f, Pixel::RGBA8888, Dali::Image::UNUSED );
 
-  // Generate the material object, which is used by all meshActors
-  GenMaterial();
+  // Generate the samplers and geometry, which is used by all bubbleActors
+  mSamplerBackground = Sampler::New( mEffectImage, "sBackground" );
+  mSamplerBubbleShape = Sampler::New( mShapeImage, "sBubbleShape" );
+  mMeshGeometry =  CreateGeometry( mNumBubblePerActor*mDensity );
 
-  mMesh.resize( mNumShader );
-  mMeshActor.resize( mNumShader );
-  mEffect.resize( mNumShader );
+  Shader bubbleShader = CreateBubbleShader (mNumBubblePerActor );
+
+  mMaterial = Material::New( bubbleShader );
+  mMaterial.AddSampler( mSamplerBackground );
+  mMaterial.AddSampler( mSamplerBubbleShape );
+
+  mBubbleActors.resize( mNumActor );
 
   // Create the meshActor group and bubbleEffect group to emit bubbles following the given track, such as finger touch track.
-  MeshData meshData;
-  ConstructBubbleMesh( meshData, mNumBubblePerShader*mDensity);
-  for(unsigned int i=0; i < mNumShader; i++ )
+  for(unsigned int i=0; i < mNumActor; i++ )
   {
-    mMesh[i] = Mesh::New( meshData );
-    mMeshActor[i] = MeshActor::New( mMesh[i] );
-    mMeshActor[i].SetParentOrigin(ParentOrigin::TOP_LEFT);
-    mEffect[i] = BubbleEffect::New( mNumBubblePerShader );
-    mEffect[i].SetEffectImage( mEffectImage );
-    mEffect[i].SetMovementArea( mMovementArea );
-    mMeshActor[i].SetShaderEffect( mEffect[i] );
-    mBubbleRoot.Add( mMeshActor[i] );
+    mBubbleActors[i] = new BubbleActor( mNumBubblePerActor, mMovementArea );
+    (mBubbleActors[i])->MakeRenderable( mMeshGeometry, mMaterial );
+    mBubbleRoot.Add( (mBubbleActors[i])->GetMeshActor() );
   }
 
-  // Create the extra meshActor and bubbleEffect to emit bubbles in totally random angle.
-  MeshData meshDataForNoise;
-  ConstructBubbleMesh( meshDataForNoise, mNumBubblePerShader);
-  mMeshActorForNoise = MeshActor::New( Mesh::New(meshDataForNoise) );
-  mMeshActorForNoise.SetParentOrigin(ParentOrigin::TOP_LEFT);
-  mEffectForNoise = BubbleEffect::New( mNumBubblePerShader );
-  mEffectForNoise.SetMovementArea( mMovementArea );
-  mEffectForNoise.SetEffectImage( mEffectImage );
-  mMeshActorForNoise.SetShaderEffect( mEffectForNoise );
-  mBubbleRoot.Add( mMeshActorForNoise );
-
   // Create a cameraActor for the off screen render task.
   mCameraActor = CameraActor::New(mMovementArea);
   mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
@@ -150,7 +174,7 @@ void BubbleEmitter::SetBackground( Image bgImage, const Vector3& hsvDelta )
   sourceActor.SetParentOrigin(ParentOrigin::CENTER);
   Stage::GetCurrent().Add( sourceActor );
 
-  ColorAdjuster colorAdjuster = ColorAdjuster::New( hsvDelta, true /*ignore alpha to make bubble color always*/ );
+  ShaderEffect colorAdjuster = CreateColorAdjuster( hsvDelta, true /*ignore alpha to make bubble color always*/ );
   sourceActor.SetShaderEffect( colorAdjuster );
 
   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
@@ -167,16 +191,15 @@ void BubbleEmitter::SetBackground( Image bgImage, const Vector3& hsvDelta )
 
 void BubbleEmitter::SetShapeImage( Image shapeImage )
 {
-  mCustomMaterial.SetDiffuseTexture( shapeImage );
+  mSamplerBubbleShape.SetImage( shapeImage );
 }
 
 void BubbleEmitter::SetBubbleScale( float scale )
 {
-  for(unsigned int i=0; i < mNumShader; i++ )
+  for(unsigned int i=0; i < mNumActor; i++ )
   {
-    mEffect[i].SetDynamicScale( scale );
+    (mBubbleActors[i])->SetDynamicScale( scale );
   }
-  mEffectForNoise.SetDynamicScale( scale );
 }
 
 void BubbleEmitter::SetBubbleDensity( unsigned int density )
@@ -190,15 +213,30 @@ void BubbleEmitter::SetBubbleDensity( unsigned int density )
   else
   {
     mDensity = density;
-    MeshData meshData;
-    ConstructBubbleMesh( meshData, mNumBubblePerShader*mDensity);
-    for(unsigned int i=0; i < mNumShader; i++ )
+    mMeshGeometry =  CreateGeometry( mNumBubblePerActor*mDensity );
+    for(unsigned int i=0; i < mNumActor; i++ )
     {
-      mMesh[i].UpdateMeshData(meshData);
+      (mBubbleActors[i])->SetGeometry( mMeshGeometry );
     }
   }
 }
 
+void BubbleEmitter::SetBlendMode( bool enable )
+{
+  if(enable)
+  {
+    // linear overlay
+    mMaterial.SetBlendFunc(BlendingFactor::SRC_ALPHA, BlendingFactor::ONE,
+                           BlendingFactor::ZERO, BlendingFactor::ONE);
+  }
+  else
+  {
+    // using default blend func
+    mMaterial.SetBlendFunc( BlendingFactor::SRC_ALPHA,   BlendingFactor::ONE_MINUS_SRC_ALPHA,
+                            BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA );
+  }
+}
+
 // clear the resources created for the off screen rendering
 void BubbleEmitter::OnRenderFinished(RenderTask& source)
 {
@@ -206,7 +244,7 @@ void BubbleEmitter::OnRenderFinished(RenderTask& source)
   Actor sourceActor = source.GetSourceActor();
   if( sourceActor )
   {
-    RenderableActor renderable = RenderableActor::DownCast( sourceActor );
+    ImageActor renderable = ImageActor::DownCast( sourceActor );
     if( renderable )
     {
       renderable.RemoveShaderEffect();
@@ -228,152 +266,74 @@ void BubbleEmitter::OnContextRegained()
   }
 }
 
-void BubbleEmitter::SetBlendMode( bool enable )
-{
-  if(enable)
-  {
-    for(unsigned int i=0; i < mNumShader; i++ )
-    {
-      // linear overlay
-      // TODO: if BlendColor would be public api from renderable actor, then can optimize the constant color
-      mMeshActor[i].SetBlendFunc(BlendingFactor::SRC_ALPHA, BlendingFactor::ONE,
-                                 BlendingFactor::ZERO, BlendingFactor::ONE);
-    }
-    mMeshActorForNoise.SetBlendFunc(BlendingFactor::SRC_ALPHA, BlendingFactor::ONE,
-                                    BlendingFactor::ZERO, BlendingFactor::ONE);
-  }
-  else
-  {
-    for(unsigned int i=0; i < mNumShader; i++ )
-    {
-      // using default blend func
-      mMeshActor[i].SetBlendFunc( BlendingFactor::SRC_ALPHA,   BlendingFactor::ONE_MINUS_SRC_ALPHA,
-                                  BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA );
-    }
-    mMeshActorForNoise.SetBlendFunc( BlendingFactor::SRC_ALPHA,   BlendingFactor::ONE_MINUS_SRC_ALPHA,
-                                     BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA );
-  }
-}
-
 void BubbleEmitter::EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement )
 {
-  unsigned int curUniform = mCurrentUniform  % mNumBubblePerShader;
-  unsigned int groupIdx = mCurrentUniform / mNumBubblePerShader;
-  SetBubbleParameter( mEffect[groupIdx], curUniform, emitPosition, direction, displacement);
-  animation.AnimateTo( Property( mEffect[groupIdx], mEffect[groupIdx].GetPercentagePropertyName(curUniform) ),
+  unsigned int curUniform = mCurrentBubble  % mNumBubblePerActor;
+  unsigned int groupIdx = mCurrentBubble / mNumBubblePerActor;
+  SetBubbleParameter( mBubbleActors[groupIdx], curUniform, emitPosition, direction, displacement);
+  animation.AnimateTo( (mBubbleActors[groupIdx])->GetPercentageProperty(curUniform),
                        1.f, AlphaFunction::LINEAR );
 
-  if( mCurrentUniform % mNumShader == 0 )
-  {
-    unsigned int uniform = mCurrentUniform / mNumShader;
-    SetBubbleParameter(mEffectForNoise, uniform, emitPosition, displacement);
-    animation.AnimateTo( Property( mEffectForNoise, mEffectForNoise.GetPercentagePropertyName(uniform) ),
-                         1.f, AlphaFunction::LINEAR );
-  }
-
-  mCurrentUniform = (mCurrentUniform + 1) % mTotalNumOfBubble;
-}
-
-void BubbleEmitter::StartExplosion( float duration, float multiple )
-{
-  Animation animation = Animation::New( duration );
-  for(unsigned int i=0; i < mNumShader; i++ )
-  {
-    animation.AnimateTo( Property( mEffect[i], mEffect[i].GetMagnificationPropertyName() ),
-                         multiple, AlphaFunction::EASE_OUT);
-  }
-  animation.AnimateTo( Property( mEffectForNoise, mEffectForNoise.GetMagnificationPropertyName() ),
-                       multiple, AlphaFunction::EASE_OUT);
-  animation.Play();
-
-  animation.FinishedSignal().Connect(this, &BubbleEmitter::OnExplosionFinished);
+  mCurrentBubble = (mCurrentBubble + 1) % mTotalNumOfBubble;
 }
 
 void BubbleEmitter::Restore()
 {
-  for(unsigned int i=0; i < mNumShader; i++ )
+  for(unsigned int i=0; i < mNumActor; i++ )
   {
-    mEffect[i].ResetParameters();
+    (mBubbleActors[i])->ResetProperties();
   }
-  mEffectForNoise.ResetParameters();
-}
-
-void BubbleEmitter::GenMaterial()
-{
-  mCustomMaterial = Material::New("CustomMaterial");
-  mCustomMaterial.SetOpacity(1.0f);
-  mCustomMaterial.SetDiffuseColor(Color::WHITE);
-  mCustomMaterial.SetAmbientColor(Vector4(0.0, 0.1, 0.1, 1.0));
-  mCustomMaterial.SetMapU( Material::MAPPING_MODE_WRAP );
-  mCustomMaterial.SetMapV( Material::MAPPING_MODE_WRAP );
-  mCustomMaterial.SetDiffuseTexture( mShapeImage );
 }
 
-void BubbleEmitter::AddVertex(MeshData::VertexContainer& vertices, Vector3 XYZ, Vector2 UV)
+Geometry BubbleEmitter::CreateGeometry( unsigned int numOfPatch )
 {
-  MeshData::Vertex meshVertex;
-  meshVertex.x = XYZ.x;
-  meshVertex.y = XYZ.y;
-  meshVertex.z = XYZ.z;
-  meshVertex.u = UV.x;
-  meshVertex.v = UV.y;
-  vertices.push_back(meshVertex);
-}
-
-void BubbleEmitter::AddTriangle(MeshData::FaceIndices& faces,
-size_t v0, size_t v1, size_t v2)
-{
-  faces.push_back(v0);
-  faces.push_back(v1);
-  faces.push_back(v2);
-}
+  unsigned int numVertex = numOfPatch*4u;
+  std::vector<Vertex> vertexData;
+  vertexData.reserve( numVertex );
 
-void BubbleEmitter::ConstructBubbleMesh( MeshData& meshData, unsigned int numOfBubble)
-{
-  MeshData::VertexContainer    vertices;
-  MeshData::FaceIndices        faces;
-  BoneContainer                bones(0);
+  unsigned int numIndex = numOfPatch*6u;
+  Vector<unsigned int> indexData;
+  indexData.Reserve( numIndex );
 
-  for(unsigned int index = 0; index < numOfBubble; index ++)
+  for(unsigned int i = 0; i < numOfPatch; i++)
   {
     float curSize = RandomRange(mBubbleSizeRange.x, mBubbleSizeRange.y);
-    if(rand()%100 < 1)
-    {
-      curSize *= 2.f;
-    }
-    float depth = static_cast<float>( index );
-    AddVertex( vertices, Vector3(0.f,0.f,depth), Vector2(0.f,0.f) );
-    AddVertex( vertices, Vector3(0.f,curSize,depth), Vector2( 0.f,1.f ));
-    AddVertex( vertices, Vector3(curSize,curSize,depth), Vector2(1.f,1.f) );
-    AddVertex( vertices, Vector3(curSize,0.f,depth), Vector2(1.f,0.f) );
+
+    float index = static_cast<float>( i );
+    vertexData.push_back( Vertex( index, Vector2(0.f,0.f),         Vector2(0.f,0.f) ) );
+    vertexData.push_back( Vertex( index, Vector2(0.f,curSize),     Vector2(0.f,1.f)  ) );
+    vertexData.push_back( Vertex( index, Vector2(curSize,curSize), Vector2(1.f,1.f)  ) );
+    vertexData.push_back( Vertex( index, Vector2(curSize,0.f),     Vector2(1.f,0.f)  ) );
 
     unsigned int idx = index * 4;
-    AddTriangle( faces, idx, idx+1, idx+2);
-    AddTriangle( faces, idx, idx+2, idx+3);
+    indexData.PushBack( idx );
+    indexData.PushBack( idx+1 );
+    indexData.PushBack( idx+2 );
+    indexData.PushBack( idx );
+    indexData.PushBack( idx+2 );
+    indexData.PushBack( idx+3 );
   }
 
-  meshData.SetData(vertices, faces, bones, mCustomMaterial);
-  meshData.SetHasColor(false);
-  meshData.SetHasTextureCoords(true);
-}
+  Property::Map vertexFormat;
+  vertexFormat["aIndex"] = Property::FLOAT;
+  vertexFormat["aPosition"] = Property::VECTOR2;
+  vertexFormat["aTexCoord"] = Property::VECTOR2;
+  PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, numVertex  );
+  vertices.SetData( &vertexData[0] );
 
-void BubbleEmitter::SetBubbleParameter( BubbleEffect& effect, unsigned int curUniform,
-                                        const Vector2& emitPosition, const Vector2& displacement )
-{
-  int halfRange = displacement.x / 2;
-  Vector2 randomVec(rand()%static_cast<int>(displacement.x) - halfRange, rand()%static_cast<int>(displacement.y) - halfRange);
-  if(randomVec.y > 0.0f)
-  {
-    randomVec.y *= 0.33f;
-  }
+  Property::Map indexFormat;
+  indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat, numIndex  );
+  indices.SetData( &indexData[0] );
 
-  Vector4 startAndEndPos( emitPosition.x, emitPosition.y, emitPosition.x+randomVec.x, emitPosition.y+randomVec.y );
-  effect.SetStartAndEndPosition( curUniform, startAndEndPos );
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer( vertices );
+  geometry.SetIndexBuffer( indices );
 
-  effect.SetPercentage( curUniform, 0.f);
+  return geometry;
 }
 
-void BubbleEmitter::SetBubbleParameter( BubbleEffect& effect, unsigned int curUniform,
+void BubbleEmitter::SetBubbleParameter( BubbleActorPtr bubbleActor, unsigned int curUniform,
                                         const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement )
 {
   Vector2 dir(direction);
@@ -390,19 +350,9 @@ void BubbleEmitter::SetBubbleParameter( BubbleEffect& effect, unsigned int curUn
     randomVec.y *= 0.33f;
   }
   Vector4 startAndEndPos( emitPosition.x, emitPosition.y, emitPosition.x+randomVec.x, emitPosition.y+randomVec.y );
-  effect.SetStartAndEndPosition( curUniform, startAndEndPos );
+  bubbleActor->SetStartAndEndPosition( curUniform, startAndEndPos );
 
-  effect.SetPercentage( curUniform, 0.f);
-}
-
-void BubbleEmitter::OnExplosionFinished( Animation& source )
-{
-  Restore();
-}
-
-float BubbleEmitter::RandomRange(float f0, float f1)
-{
-  return f0 + (rand() & 0xfff) * (f1-f0) * (1.0f/4095.0f);
+  bubbleActor->SetPercentage( curUniform, 0.f);
 }
 
 } // namespace Internal
index 8623880..91158b2 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/camera-actor.h>
 #include <dali/public-api/actors/image-actor.h>
-#include <dali/devel-api/actors/mesh-actor.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/devel-api/geometry/mesh.h>
 #include <dali/public-api/render-tasks/render-task.h>
+#include <dali/devel-api/object/property-buffer.h>
+#include <dali/devel-api/rendering/geometry.h>
+#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/rendering/sampler.h>
+#include <dali/devel-api/rendering/shader.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
-#include <dali-toolkit/devel-api/shader-effects/bubble-effect/bubble-effect.h>
 
 namespace Dali
 {
@@ -41,6 +43,9 @@ namespace Toolkit
 namespace Internal
 {
 
+class BubbleActor;
+typedef IntrusivePtr<BubbleActor> BubbleActorPtr;
+
 /**
  * BubbleEmitter implementation class.
  */
@@ -97,11 +102,6 @@ public:
   void EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
 
   /**
-   * @copydoc Toolkit::BubbleEmitter::StartExplosion
-   */
-  void StartExplosion( float duration, float multiple );
-
-  /**
    * @copydoc Toolkit::BubbleEmitter::Restore
    */
   void Restore();
@@ -127,6 +127,13 @@ private:
   void OnInitialize();
 
   /**
+   * Create the geometry of a mesh.
+   * @param[in] numOfPatch The triangle number in the mesh is 2*numOfPatch; two triangles for each bubble.
+   * @return The mesh geometry.
+   */
+  Geometry CreateGeometry( unsigned int numOfPatch );
+
+  /**
    * Callback function of the finished signal of off-screen render task.
    * @param[in] source The render task used to create the color adjusted background image.
    */
@@ -138,98 +145,41 @@ private:
   void OnContextRegained();
 
   /**
-   * Generate the material object which is attached to the meshActor to describe its color, texture, texture mapping mode etc.
-   */
-  void GenMaterial();
-
-  /**
-   * Add a vertex to the mesh data.
-   * @param[in] vertices The collection of vertices.
-   * @param[in] XYZ The vertex position coordinates.
-   * @param[in] UV The vertex texture coordinate.
-   */
-  void AddVertex(MeshData::VertexContainer& vertices, Vector3 XYZ, Vector2 UV);
-
-  /**
-   * Add a triangle to the mesh data.
-   * @param[in] faces The collection od FaceIndex items.
-   * @param[in] v0 The index of the first point of the triangle.
-   * @param[in] v1 The index of the second point of the triangle.
-   * @param[in] v3 The index of the first point of the triangle.
-   */
-  void AddTriangle(MeshData::FaceIndices& faces,size_t v0, size_t v1, size_t v2);
-
-  /**
-   * Create a new mesh.
-   * @param[in] meshData The MeshData object which encompasses all the data required to describe and render the 3D mesh.
-   * @param[in] numberOfBubble The triangle number in the meshData is 2*numOfBubble; two triangles for each bubble
-   */
-  void ConstructBubbleMesh( MeshData& meshData, unsigned int numOfBubble);
-
-  /**
-   * Set the uniform values to the shader effect to emit a bubble
-   * @param[in] effect The BubbleEffect to render the current bubble
-   * @param[in] curUniform The index of the uniform array in the shader
-   * @param[in] emitPosition The start position of the bubble movement.
-   * @param[in] displacement The displacement used to bound the moving distance of the bubble.
-   */
-  void SetBubbleParameter( BubbleEffect& effect, unsigned int curUniform,
-                           const Vector2& emitPosition, const Vector2& displacement );
-
-  /**
    * Set the uniform values to the shader effect to emit a bubble
-   * @param[in] effect The BubbleEffect to render the current bubble
+   * @param[in] bubbleActor The BubbleActor to render the current bubble
    * @param[in] curUniform The index of the uniform array in the shader
    * @param[in] emitPosition The start position of the bubble movement.
    * @param[in] direction The direction used to constrain the bubble to move in an adjacent direction around it.
    * @param[in] displacement The displacement used to bound the moving distance of the bubble.
    */
-  void SetBubbleParameter( BubbleEffect& effect, unsigned int curUniform,
+  void SetBubbleParameter( BubbleActorPtr bubbleActor, unsigned int curUniform,
                            const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
 
-  /**
-   * Callback function of the explosion animation finished signal to reset the shader parameters
-   * @param[in] source The explosion animation.
-   */
-  void OnExplosionFinished( Animation& source );
-
-  /**
-   * Return a random value between the given interval.
-   * @param[in] f0 The low bound
-   * @param[in] f1 The up bound
-   * @return A random value between the given interval
-   */
-  float RandomRange(float f0, float f1);
-
 private:
 
-  Vector2                     mMovementArea;        ///< The size of the bubble moving area, usually the same size as the background image actor.
-  Image                       mShapeImage;          ///< The alpha channnel of this texture defines the bubble shape.
   Actor                       mBubbleRoot;          ///<The bubble root actor. Need to add it to stage to get the bubbles rendered.
-
-  unsigned int                mNumBubblePerShader;  ///< How many bubbles for each BubbleEffect shader.
-  unsigned int                mNumShader;           ///< How many BubbleEffect shaders are used.
-  unsigned int                mTotalNumOfBubble;    ///< mNumBubblePerShader*mNumShader.
-  bool                        mRenderTaskRunning;   ///< If the background render task is currently running
-
-  Vector2                     mBubbleSizeRange;     ///< The bubble size range.
-
-  std::vector<Mesh>           mMesh;                ///< The mesh vector, each mesh is used to create a meshActor which applies a BubbleEffect.
-  std::vector<MeshActor>      mMeshActor;           ///< The meshActor vector, its size is mNumShader.
-  MeshActor                   mMeshActorForNoise;   ///< An Extra mesh data to emit bubbles which emit bubble in totally random angle.
-  Material                    mCustomMaterial;      ///< The material object which is attached to the meshActor to describe its color, texture, texture mapping mode etc.
-
-  std::vector<BubbleEffect>   mEffect;              ///< The bubbleEffect vector, corresponding to the mMeshActoe vector.
-  BubbleEffect                mEffectForNoise;      ///< The extra bubbleEffect, corresponding to the mMeshActorForNoise.
-
-  unsigned int                mCurrentUniform;      ///< Keep track of the uniform index for the newly emitted bubble
-
-  Vector3                     mHSVDelta;            ///< The HSV difference used to adjust the background image color.
+  Image                       mShapeImage;          ///< The alpha channnel of this texture defines the bubble shape.
   Image                       mBackgroundImage;     ///< The original background image
   FrameBufferImage            mEffectImage;         ///< The image stores the adjusted color of the background image.The bubbles pick color from this image.
   CameraActor                 mCameraActor;         ///< The render task views the scene from the perspective of this actor.
 
+  Sampler                     mSamplerBackground;    ///< The sampler which provides the background image to material
+  Sampler                     mSamplerBubbleShape;   ///< The sampler which provides the bubble shape image to material
+  Geometry                    mMeshGeometry;         ///< The mesh geometry which contains the vertices and indices data
+  Material                    mMaterial;             ///< The material which controls the bubble display
+  std::vector<BubbleActorPtr> mBubbleActors;         ///< The meshActor vector, its size is mNumShader.
+
+  Vector2                     mMovementArea;        ///< The size of the bubble moving area, usually the same size as the background image actor.
+  Vector2                     mBubbleSizeRange;     ///< The size range of the bubbles; x component is the low bound, and y component is the up bound.
+  Vector3                     mHSVDelta;            ///< The HSV difference used to adjust the background image color.
+
+  unsigned int                mNumBubblePerActor;   ///< How many bubbles for each BubbleActor.
+  unsigned int                mNumActor;            ///< How many BubbleActors are used.
   unsigned int                mDensity;             ///< How many bubbles will emit at each time, they are controlled by same uniforms in the shader.
+  unsigned int                mTotalNumOfBubble;    ///< mNumBubblePerShader*mNumShader.
+  unsigned int                mCurrentBubble;       ///< Keep track of the index for the newly emitted bubble
+
+  bool                        mRenderTaskRunning;   ///< If the background render task is currently running
 
 };
 
diff --git a/dali-toolkit/internal/controls/bubble-effect/color-adjuster.h b/dali-toolkit/internal/controls/bubble-effect/color-adjuster.h
new file mode 100644 (file)
index 0000000..8e24326
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_
+#define __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_
+
+/*
+ * Copyright (c) 2015 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/math/vector3.h>
+#include <dali/public-api/shader-effects/shader-effect.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+* Creates a new ColorAdjuster effect.
+* ColorAdjuster is a custom shader effect to adjust the image color in HSV space.
+* @param[in] hsvDelta The color difference to apply to the HSV channel.
+* @param[in] ignoreAlpha If true, the result color will be opaque even though source has alpha value
+* @return A handle to a newly allocated Dali resource.
+*/
+inline ShaderEffect CreateColorAdjuster( const Vector3& hsvDelta, bool ignoreAlpha = false )
+{
+  std::string fragmentShader = DALI_COMPOSE_SHADER(
+    precision highp float;\n
+    uniform vec3 uHSVDelta;\n
+    uniform float uIgnoreAlpha;\n
+    float rand(vec2 co) \n
+    {\n
+      return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n}
+    \n
+    vec3 rgb2hsv(vec3 c)\n
+    {\n
+      vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n
+      vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n
+      vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n
+      \n
+      float d = q.x - min(q.w, q.y);\n
+      float e = 1.0e-10;\n
+      return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n
+    }\n
+    vec3 hsv2rgb(vec3 c)\n
+    {\n
+      vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n
+      vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n
+      return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n
+    }\n
+    void main() {\n
+      vec4 color = texture2D(sTexture, vTexCoord); \n
+      vec3 hsvColor = rgb2hsv( color.rgb );\n
+      // modify the hsv Value
+      hsvColor += uHSVDelta * rand(vTexCoord); \n
+      // if the new vale exceeds one, then decrease it
+      hsvColor -= max(hsvColor*2.0 - vec3(2.0), 0.0);\n
+      // if the new vale drops below zero, then increase it
+      hsvColor -= min(hsvColor*2.0, 0.0);\n
+      color.rgb = hsv2rgb( hsvColor ); \n
+      // uIgnoreAlpha decide the result alpha will be 1.0 or source's alpha
+      color.a += uIgnoreAlpha;\n
+      gl_FragColor = color; \n
+    }\n
+  );
+
+  ShaderEffect shaderEffect = ShaderEffect::New("", fragmentShader);
+  shaderEffect.SetUniform( "uHSVDelta", hsvDelta );
+  shaderEffect.SetUniform( "uIgnoreAlpha", ignoreAlpha?1.0f:0.0f );
+
+  return shaderEffect;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_ */
index c0d52ca..a1eb3cf 100644 (file)
@@ -905,7 +905,7 @@ Actor& Button::GetDisabledBackgroundImage()
   return mDisabledBackgroundContent;
 }
 
-  bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
 {
   bool ret = false;
 
@@ -917,14 +917,13 @@ Actor& Button::GetDisabledBackgroundImage()
 
   if( 0 == strcmp( actionName.c_str(), ACTION_BUTTON_CLICK ) )
   {
-    GetImplementation( button ).DoClickAction( attributes );
-    ret = true;
+    ret = GetImplementation( button ).DoClickAction( attributes );
   }
 
   return ret;
 }
 
-  void Button::DoClickAction( const Property::Map& attributes )
+bool Button::DoClickAction( const Property::Map& attributes )
 {
   // Prevents the button signals from doing a recursive loop by sending an action
   // and re-emitting the signals.
@@ -935,7 +934,11 @@ Actor& Button::GetDisabledBackgroundImage()
     mState = ButtonDown;
     OnButtonUp();
     mClickActionPerforming = false;
+
+    return true;
   }
+
+  return false;
 }
 
 void Button::UpdatePaintTransitionState()
@@ -1203,15 +1206,21 @@ void Button::OnInitialize()
 
   OnButtonInitialize();
 
-  self.SetDrawMode( DrawMode::OVERLAY );
   self.SetKeyboardFocusable( true );
 }
 
-void Button::OnActivated()
+bool Button::OnAccessibilityActivated()
+{
+  return OnKeyboardEnter();
+}
+
+bool Button::OnKeyboardEnter()
 {
-  // When the button is activated, it performs the click action
+  // When the enter key is pressed, or button is activated, the click action is performed.
   Property::Map attributes;
-  DoClickAction( attributes );
+  bool ret = DoClickAction( attributes );
+
+  return ret;
 }
 
 void Button::OnControlStageDisconnection()
index 02b1360..e4d49d7 100644 (file)
@@ -279,8 +279,9 @@ private:
   /**
    * Perform the click action to click the button.
    * @param[in] attributes The attributes to perfrom this action.
+   * @return true if this control can perform action.
    */
-  void DoClickAction( const Property::Map& attributes );
+  bool DoClickAction( const Property::Map& attributes );
 
   /**
    * This method is called after the button initialization.
@@ -454,9 +455,14 @@ private: // From Control
   virtual void OnInitialize();
 
   /**
-   * @copydoc Toolkit::Control::OnActivated()
+   * @copydoc Toolkit::Control::OnAccessibilityActivated()
    */
-  virtual void OnActivated();
+  virtual bool OnAccessibilityActivated();
+
+  /**
+   * @copydoc Toolkit::Control::OnKeyboardEnter()
+   */
+  virtual bool OnKeyboardEnter();
 
   /**
    * Callback received when the button is disconnected from the stage.
index 88e5364..f5c908d 100644 (file)
@@ -22,6 +22,9 @@
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/object/type-registry.h>
 
+//INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
+
 namespace Dali
 {
 
@@ -230,13 +233,13 @@ void CheckBoxButton::StartTransitionAnimation( Actor& actor )
     if( !mTickUVEffect )
     {
       ImageActor imageActor = ImageActor::DownCast( actor );
-      mTickUVEffect = ImageRegionEffect::New();
+      mTickUVEffect = CreateImageRegionEffect();
       imageActor.SetShaderEffect( mTickUVEffect );
     }
 
     actor.SetScale( Vector3( 0.0f, 1.0f, 1.0f ) );
 
-    mTickUVEffect.SetBottomRight( Vector2( 0.0f, 1.0f ) );
+    mTickUVEffect.SetUniform("uBottomRight", Vector2( 0.0f, 1.0f ) );
 
     if( !mTransitionAnimation )
     {
@@ -244,7 +247,7 @@ void CheckBoxButton::StartTransitionAnimation( Actor& actor )
     }
 
     // UV anim
-    mTransitionAnimation.AnimateTo( Property( mTickUVEffect, mTickUVEffect.GetBottomRightPropertyName() ), Vector2( 1.0f, 1.0f ) );
+    mTransitionAnimation.AnimateTo( Property( mTickUVEffect, "uBottomRight" ), Vector2( 1.0f, 1.0f ) );
 
     // Actor size anim
     mTransitionAnimation.AnimateTo( Property( actor, Actor::Property::SCALE_X ), 1.0f );
index 06bb1c6..0135e6b 100644 (file)
@@ -21,6 +21,8 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/animation/animation.h>
+#include <dali/public-api/shader-effects/shader-effect.h>
+
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
@@ -124,7 +126,7 @@ private:
 
 private:
   Animation                 mTransitionAnimation;  ///< Animation used in the state transitions.
-  ImageRegionEffect         mTickUVEffect;         ///< ImageRegionEffect to expand the tick across
+  ShaderEffect              mTickUVEffect;         ///< ImageRegionEffect to expand the tick across
 };
 
 } // namespace Internal
index bdc59ae..d956e36 100644 (file)
@@ -255,7 +255,6 @@ void Magnifier::SetFrameVisibility(bool visible)
 
     Image image = ResourceImage::New( DEFAULT_FRAME_IMAGE_PATH );
     mFrame = ImageActor::New( image );
-    mFrame.SetDrawMode(DrawMode::OVERLAY);
     mFrame.SetStyle( ImageActor::STYLE_NINE_PATCH );
     mFrame.SetPositionInheritanceMode(DONT_INHERIT_POSITION);
     mFrame.SetInheritScale(true);
diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h b/dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h
new file mode 100644 (file)
index 0000000..548f13c
--- /dev/null
@@ -0,0 +1,118 @@
+#ifndef __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__
+#define __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__
+
+/*
+ * Copyright (c) 2015 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 <dali/public-api/shader-effects/shader-effect.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+ * @brief Creates a new PageTurnBookSpineEffect
+ * This is an assisting effect of PageTurnEffect to display a book spine on _static_ pages, and also to flip the image horizontally when needed.
+ *
+ * When the page is turned over in landscape, call
+ * SetIsBackImageVisible(true), this effect can display the back image
+ * correctly after the imageActor been rotated 180 degrees.  To
+ * display the pages visually consistent with its turning state,
+ * please set the uniforms with the same values as the PageTurnEffect.
+ *
+ * Animatable/Constrainable uniforms:
+ *  "uShadowWidth"          - The width of shadow to be pageSize * shadowWidth. This shadow appears at the edges of the actor
+ *                            which is not visible on static pages
+ *  "uSpineShadowParameter" - The two parameters are the major&minor radius (in pixels) to form an ellipse shape. The top-left
+ *                            quarter of this ellipse is used to calculate spine normal for simulating shadow
+ *  "uIsBackImageVisible"   - Set whether the current page is with its backside visible. Need to pass the parameter as true for
+ *                            the page which is turned over but still visible in Landscape
+ *  "uPageWidth"            - The page width of the PageTurnBookSpineEffect
+ *
+ * @return A handle to a newly allocated ShaderEffect
+ **/
+inline ShaderEffect CreatePageTurnBookSpineEffect()
+{
+  std::string vertexSource(
+      "precision mediump float;\n"
+      "uniform float uShadowWidth;\n"
+      "  void main()\n"
+      "  {\n"
+      "    gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
+      "    vTexCoord.x = (aTexCoord.x-sTextureRect.s) /( 1.0 - uShadowWidth ) + sTextureRect.s;\n"
+      "    vTexCoord.y = ( aTexCoord.y-sTextureRect.t-0.5*uShadowWidth*(sTextureRect.q-sTextureRect.t) )/( 1.0 - uShadowWidth ) + sTextureRect.t;\n"
+      "  }");
+
+  // the simplified version of the fragment shader of page turn effect
+  std::string fragmentSource(
+      "precision mediump float;\n"
+      "uniform float uIsBackImageVisible;\n"
+      "uniform float uPageWidth;\n"
+      "uniform vec2 uSpineShadowParameter;\n"
+      "  void main()\n"
+      "  {\n"
+      // leave the border for display shadow, not visible( out of the screen ) when the page is static
+      "    if( vTexCoord.y > sTextureRect.q || vTexCoord.y < sTextureRect.t || vTexCoord.x > sTextureRect.p  )\n"
+      "    {\n"
+      "      gl_FragColor = vec4( 0.0 );\n"
+      "    }\n"
+      "    else \n"
+      "    { \n"
+      // flip the image horizontally by changing the x component of the texture coordinate
+      "      if( uIsBackImageVisible == 1.0 )  gl_FragColor = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) ) * uColor; \n"
+      "      else gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n"
+      "      \n"
+      // display book spine, a stripe of shadowed texture
+      "      float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageWidth; \n"
+      "      if(pixelPos < uSpineShadowParameter.x) \n"
+      "      {\n"
+      "        float x = pixelPos - uSpineShadowParameter.x;\n"
+      "        float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x );\n"
+      "        vec2 spineNormal = normalize(vec2(uSpineShadowParameter.y*x/uSpineShadowParameter.x, y));\n"
+      "        gl_FragColor.rgb *= spineNormal.y; \n"
+      "      }"
+      "    }\n"
+      "  }" );
+
+  const float DEFAULT_SHADOW_WIDTH(0.15f);
+  const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
+
+  ShaderEffect shaderEffect = ShaderEffect::New( vertexSource, fragmentSource );
+
+  shaderEffect.SetUniform( "uIsBackImageVisible", -1.f );
+  shaderEffect.SetUniform( "uShadowWidth", DEFAULT_SHADOW_WIDTH );
+  shaderEffect.SetUniform( "uSpineShadowParameter", DEFAULT_SPINE_SHADOW_PARAMETER );
+
+  float defaultPageWidth = Dali::Stage::GetCurrent().GetSize().x;
+  shaderEffect.SetUniform( "uPageWidth", defaultPageWidth/(1.f-DEFAULT_SHADOW_WIDTH) );
+
+  return shaderEffect;
+}
+
+} //namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__ */
diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-effect.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-effect.cpp
new file mode 100644 (file)
index 0000000..5266caa
--- /dev/null
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 2015 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-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
+#include <dali/public-api/math/matrix.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void CommonParametersConstraint( Dali::Matrix& current, const PropertyInputContainer& inputs )
+{
+  const Vector2& originalCenter = inputs[0]->GetVector2();
+  Vector2 currentCenter = inputs[1]->GetVector2();
+  const Vector2& pageSize = inputs[2]->GetVector2();
+
+  // calculate the curve direction and the vanishing point
+  // here, the vanishing point is the intersection of spine with the line passing through original center and vertical to curve direction
+  Vector2 curveDirection( currentCenter - originalCenter );
+  curveDirection.Normalize();
+  if( fabs(curveDirection.y) < 0.01f) // eliminate the possibility of division by zero in the next step
+  {
+    curveDirection.y = 0.01f;
+  }
+  float vanishingPointY = originalCenter.y + curveDirection.x * originalCenter.x / curveDirection.y;
+
+  float curveEndY, cosTheta ,sinTheta ,translateX, translateY;
+  // when the vanishing point is very far away, make it infinitely, in this case, the page bent horizontally
+  const float THRESHOLD(20.0);
+  if( fabs(vanishingPointY-pageSize.y*0.5f) >= pageSize.y*THRESHOLD )
+  {
+    curveDirection = Vector2(-1.f,0.f);
+    currentCenter.y = originalCenter.y;
+
+    curveEndY = originalCenter.y;
+    cosTheta = 1.f;
+    sinTheta = 0.f;
+    translateX = currentCenter.x - originalCenter.x;
+    translateY = vanishingPointY;
+  }
+  else
+  {
+    curveEndY = currentCenter.y - curveDirection.y * (currentCenter.x/curveDirection.x) ;
+    Vector2 v1( currentCenter.x, currentCenter.y - vanishingPointY );
+    v1.Normalize();
+    Vector2 v2( originalCenter.x, originalCenter.y - vanishingPointY );
+    v2.Normalize();
+    cosTheta = v1.x*v2.x + v1.y*v2.y;
+    sinTheta = ( vanishingPointY > pageSize.y*0.5f ) ? sqrt(1.0-cosTheta*cosTheta) : -sqrt(1.0-cosTheta*cosTheta);
+    translateX = currentCenter.x - cosTheta*originalCenter.x - sinTheta*( originalCenter.y-vanishingPointY );
+    translateY = currentCenter.y + sinTheta*originalCenter.x - cosTheta*( originalCenter.y-vanishingPointY );
+  }
+
+  float originalLength = fabs(originalCenter.x/curveDirection.x);
+  float currentLength = fabs(currentCenter.x/curveDirection.x);
+  float curveHeight = 0.45f*sqrt(originalLength*originalLength - currentLength*currentLength);
+
+  float* parameterArray = current.AsFloat();
+  parameterArray[0] = cosTheta;
+  parameterArray[1] = -sinTheta;
+  parameterArray[2] = originalCenter.x;
+  parameterArray[3] = originalCenter.y;
+  parameterArray[4] = sinTheta;
+  parameterArray[5] = cosTheta;
+  parameterArray[6] = currentCenter.x;
+  parameterArray[7] = currentCenter.y;
+  parameterArray[8] = translateX;
+  parameterArray[9] = translateY;
+  parameterArray[10] = vanishingPointY;
+  parameterArray[11] = curveEndY;
+  parameterArray[12] = curveDirection.x;
+  parameterArray[13] = curveDirection.y;
+  parameterArray[14] = curveHeight;
+  parameterArray[15] = currentLength;
+}
+
+void Dali::Toolkit::Internal::PageTurnApplyInternalConstraint( ShaderEffect& shaderEffect)
+{
+  Constraint constraint = Constraint::New<Dali::Matrix>( shaderEffect, shaderEffect.GetPropertyIndex( "uCommonParameters" ), CommonParametersConstraint );
+  constraint.AddSource( LocalSource( shaderEffect.GetPropertyIndex( "uOriginalCenter" ) ) );
+  constraint.AddSource( LocalSource( shaderEffect.GetPropertyIndex( "uCurrentCenter" ) ) );
+  constraint.AddSource( LocalSource( shaderEffect.GetPropertyIndex( "uPageSize" ) ) );
+  constraint.Apply();
+}
+
+ShaderEffect Dali::Toolkit::Internal::CreatePageTurnEffect(bool enableBlending)
+{
+  std::string vertexShader = DALI_COMPOSE_SHADER(
+      /*
+       * The common parameters for all the vertices, calculate in CPU then pass into the shader as uniforms
+       *
+       *  first part of the page, (outside the the line passing through original center and vertical to curve direction)
+       * no Z change, only 2D rotation and translation
+       * ([0][0],[0][1],[1][0],[1][1]) mat2 rotateMatrix
+       * ([2][0],[2][1]) vec2 translationVector
+       *
+       * ([0][2],[0][3]) vec2 originalCenter: Typically the press down position of the Pan Gesture
+       * ([1][2],[1][3]) vec2 currentCenter: Typically the current position of the Pan Gesture
+       * ([3][0],[3][1]) vec2 curveDirection: The normalized vector pointing from original center to current center
+       * ([2][2]) float vanishingPointY: The Y coordinate of the intersection of the spine
+       *                                 and the line which goes through the original center and is vertical to the curveDirection
+       * ([2][3]) float curveEndY: The Y coordinate of intersection of the spine and the line through both original and current center
+       * ([3][2]) float curveHeight: The height of the interpolated hermite curve.
+       * ([3][3]) float currentLength: The length from the current center to the curveEnd.
+       */
+      precision mediump float;\n
+      uniform mat4 uCommonParameters;\n
+      \n
+      uniform vec2 uPageSize;\n
+      uniform float uIsTurningBack;\n
+      uniform float uShadowWidth;\n
+      varying vec3 vNormal;\n
+      varying vec4 vPosition;\n
+      varying float vEdgeShadow;\n
+      \n
+      void main()\n
+      {\n
+        vec4 position = vec4( aPosition.xy, 0.0, 1.0);\n
+        vec2 currentCenter = vec2( uCommonParameters[1][2], uCommonParameters[1][3]);\n
+        vec2 originalCenter = vec2( uCommonParameters[0][2], uCommonParameters[0][3]);\n
+        vec3 normal = vec3(0.0,0.0,1.0);\n
+        \n
+        if(currentCenter.x < originalCenter.x)\n
+        {\n
+          // change the coordinate origin from the center of the page to its top-left
+          position.xy += uPageSize * 0.5;\n
+          vec2 curveDirection = vec2( uCommonParameters[3]);\n
+          vec3 vanishingPoint = vec3(0.0, uCommonParameters[2][2], 0.0);\n
+          // first part of the page, (outside the the line passing through original center and vertical to curve direction)
+          //no Z change, only 2D rotation and translation
+          if( dot(curveDirection, position.xy - originalCenter) < 0.0 )
+          {\n
+            position.y -= vanishingPoint.y;\n
+            position.xy = mat2(uCommonParameters)*position.xy + vec2( uCommonParameters[2]);\n
+          }\n
+          // second part of the page, bent as a ruled surface
+          else\n
+          {\n
+            // calculate on the flat plane, between
+            // the first line passing through current vertex and vanishing point
+            // the second line passing through original center and current center
+            vec2 curveEnd = vec2( 0.0, uCommonParameters[2][3] );\n
+            vec2 curFlatDirection = vec2(0.0,1.0);\n
+            float lengthFromCurve = position.y - originalCenter.y;\n
+            float lengthOnCurve = position.x;\n
+            if(currentCenter.y != originalCenter.y)\n
+            {\n
+              curFlatDirection = normalize(position.xy - vanishingPoint.xy);\n
+              lengthFromCurve = (curveEnd.x*curveDirection.y-curveEnd.y*curveDirection.x-position.x*curveDirection.y+position.y*curveDirection.x)
+              / (curFlatDirection.x*curveDirection.y-curFlatDirection.y*curveDirection.x);\n
+              lengthOnCurve = length(position.xy+lengthFromCurve*curFlatDirection-curveEnd);\n
+            }\n
+            \n
+            // define the control points of hermite curve, composed with two segments
+            // calulation is carried out on the 2D plane which is passing through both current and original center and vertical to the image plane
+            float currentLength = uCommonParameters[3][3];\n
+            float originalLength =  abs(originalCenter.x/curveDirection.x);\n
+            float height = uCommonParameters[3][2];\n
+            float percentage = currentLength/originalLength;\n
+            //vec2 SegmentOneControlPoint0 = vec2(0.0, 0.0);
+            vec2 SegmentOneControlPoint1 = vec2((0.65*percentage - 0.15)*originalLength, (0.8 + 0.2 * percentage)*height); \n
+            vec2 SegmentTwoControlPoint0 = SegmentOneControlPoint1;\n
+            vec2 SegmentTwoControlPoint1 = vec2(currentLength, 0.0); \n
+            vec2 SegmentOneTangentVector0 = SegmentOneControlPoint1;\n
+            vec2 SegmentOneTangentVector1 = vec2(0.5*originalLength,0.0);\n
+            vec2 SegmentTwoTangentVector0 = SegmentOneTangentVector1;\n
+            vec2 SegmentTwoTangentVector1 = SegmentOneTangentVector1;\n
+            \n
+            // calulate the corresponding curve point position and its tangent vector
+            // it is a linear mapping onto nonlinear curves, might cause some unwanted deformation
+            // but as there are no analytical method to calculate the curve length on arbitrary segment
+            // no efficient way to solve this nonlinear mapping, Numerical approximation would cost too much computation in shader
+            vec2 curvePoint2D;\n
+            vec2 tangent;\n
+            float t0 = lengthOnCurve / originalLength;\n
+            if(t0<=0.5)\n
+            {\n
+              float t = 2.0*t0;\n
+              float t_2 = t*t;\n
+              float t_3 = t*t_2;\n
+              curvePoint2D = (-2.0*t_3+3.0*t_2)*SegmentOneControlPoint1
+              + (t_3-2.0*t_2+t)*SegmentOneTangentVector0 + (t_3-t_2)*SegmentOneTangentVector1;\n
+              tangent = (-6.0*t_2+6.0*t)*SegmentOneControlPoint1
+              + (3.0*t_2-4.0*t+1.0)*SegmentOneTangentVector0 + (3.0*t_2-2.0*t)*SegmentOneTangentVector1;\n
+            }\n
+            else\n
+            {\n
+              float t = 2.0*t0-1.0;\n
+              float t_2 = t*t;\n
+              float t_3 = t*t_2;\n
+              curvePoint2D = (2.0*t_3-3.0*t_2+1.0)*SegmentTwoControlPoint0 + (-2.0*t_3+3.0*t_2)*SegmentTwoControlPoint1
+              + (t_3-2.0*t_2+t)*SegmentTwoTangentVector0 + (t_3-t_2)*SegmentTwoTangentVector1;\n
+              tangent = (6.0*t_2-6.0*t)*SegmentTwoControlPoint0 + (-6.0*t_2+6.0*t)*SegmentTwoControlPoint1
+              + (3.0*t_2-4.0*t+1.0)*SegmentTwoTangentVector0 + (3.0*t_2-2.0*t)*SegmentTwoTangentVector1;\n
+              // a trick to eliminate some optical illusion caused by the gradient matter of normal in per-fragment shading
+              // which is caused by linear interpolation of normal vs. nonlinear lighting
+              // will notice some artifact in the areas with dramatically normal changes, so compress the normal differences here
+              tangent.y *=  min(1.0, length(position.xyz - vanishingPoint) / uPageSize.y ); \n
+            }\n
+            vec3 curvePoint = vec3(curveEnd - curvePoint2D.x*curveDirection,max(0.0,curvePoint2D.y));\n
+            vec3 tangentVector = vec3(-tangent.x*curveDirection,tangent.y);\n
+            \n
+            // locate the new vertex position on the line passing through both vanishing point and the calculated curve point position
+            vec3 curLiftDirection = vec3(0.0,-1.0,0.0);\n
+            if(currentCenter.y != originalCenter.y)\n
+            {\n
+              curLiftDirection = normalize(curvePoint - vanishingPoint);\n
+              tangentVector *= (curveDirection.y > 0.0) ? -1.0 : 1.0;\n
+              // an heuristic adjustment here, to compensate the linear parameter mapping onto the nonlinear curve
+              float Y0 = position.y - curveDirection.y * (position.x/curveDirection.x); \n
+              float proportion;
+              float refLength;\n
+              if(abs(Y0-vanishingPoint.y) > abs(curveEnd.y-vanishingPoint.y)) \n
+              {\n
+                proportion = abs(curveEnd.y - Y0) / (abs(curveEnd.y-Y0)+abs(curveEnd.y - vanishingPoint.y)); \n
+                refLength = proportion*length(originalCenter-vanishingPoint.xy) / (proportion-1.0); \n
+              }\n
+              else\n
+              {\n
+                proportion = abs(curveEnd.y - Y0) / abs(curveEnd.y - vanishingPoint.y);\n
+                refLength = proportion*length(originalCenter-vanishingPoint.xy); \n
+              }\n
+              float Y1 = currentCenter.y - (normalize(currentCenter-vanishingPoint.xy)).y * refLength; \n
+              position.y = mix(Y0, Y1, t0); \n
+            }\n
+            position.xz = curvePoint.xz - lengthFromCurve*curLiftDirection.xz;\n
+            // calculate the normal vector, will be used for lighting
+            normal = cross(curLiftDirection, normalize(tangentVector));\n
+            // the signature of Z is decided by the page turning direction:
+            // from left to right(negative); from right to left (positive)
+            position.z *= -uIsTurningBack;\n
+            normal.xy *= -uIsTurningBack;\n
+          }\n
+          // change the coordinate origin from the top-left of the page to its center
+          position.xy -= uPageSize * 0.5; \n
+        }\n
+        position.z += aPosition.z;\n
+        gl_Position = uMvpMatrix * position;\n
+        // varying parameters for fragment shader
+        vTexCoord = aTexCoord;
+        vNormal = uNormalMatrix*normal;\n
+        vPosition = uModelView * position;\n
+  );
+
+  std::string vertexShaderWithFakedShadow = DALI_COMPOSE_SHADER(
+      // display shadow, the fake shadow value is calculated according to the height and the distance from page edge
+      vTexCoord.x = (aTexCoord.x-sTextureRect.s) /( 1.0 - uShadowWidth ) + sTextureRect.s;\n
+      vTexCoord.y = ( aTexCoord.y-sTextureRect.t-0.5*uShadowWidth*(sTextureRect.q-sTextureRect.t) )/( 1.0 - uShadowWidth ) + sTextureRect.t;\n
+      float heightCoef = (1.0 + position.z*uIsTurningBack*3.0 / uPageSize.x) * 0.6;
+      vEdgeShadow = clamp(0.9 - heightCoef, 0.0, 0.9 ); \n
+      if( vTexCoord.y >= sTextureRect.q || vTexCoord.y <= sTextureRect.t || vTexCoord.x >= sTextureRect.p  )\n
+      {\n
+        float inversedShadowWidth = (1.0-uShadowWidth) / uShadowWidth ;\n
+        float alpha1 = (vTexCoord.x-sTextureRect.p) * inversedShadowWidth / (sTextureRect.p - sTextureRect.s);\n
+        inversedShadowWidth = 2.0 * inversedShadowWidth  / (sTextureRect.q - sTextureRect.t); \n
+        float alpha2 = (vTexCoord.y-sTextureRect.q) * inversedShadowWidth;\n
+        float alpha3 = (sTextureRect.t-vTexCoord.y) * inversedShadowWidth;\n
+        float alpha;\n
+        if(alpha1 > 0.0 && alpha2 > 0.0) alpha = sqrt(alpha2*alpha2+alpha1*alpha1)/sqrt(1.0 + max(alpha1,alpha2)*max(alpha1,alpha2));\n //bottom-right corner
+        else if(alpha1 > 0.0 && alpha3 > 0.0) alpha = sqrt(alpha3*alpha3+alpha1*alpha1)/sqrt(1.0+max(alpha1,alpha3)*max(alpha1,alpha3));\n //top-right corner
+        else alpha = max(alpha1,max(alpha2,alpha3)); \n
+        alpha = 0.9 - alpha*0.9;\n
+        vEdgeShadow = clamp(alpha - heightCoef, 0.0, 0.9 ); \n
+      }\n
+  );
+
+  std::string vertexShaderEnd("}");
+
+  std::string fragmentShaderPartOne = DALI_COMPOSE_SHADER(
+      precision mediump float;\n
+      uniform vec2 uPageSize;\n
+      uniform vec2 uSpineShadowParameter;\n
+      varying vec3 vNormal;\n
+      varying vec4 vPosition;\n
+      varying float vEdgeShadow;\n
+      \n
+      void main()\n
+      {\n
+        // need to re-normalize the interpolated normal
+        vec3 normal = normalize(vNormal);\n
+        vec4 texel;\n
+        float spineShadowCoef = 1.0; \n
+  );
+
+  std::string fragmentShaderWithFakedShadow = DALI_COMPOSE_SHADER(
+      if( vTexCoord.y > sTextureRect.q || vTexCoord.y < sTextureRect.t || vTexCoord.x > sTextureRect.p  )\n
+      texel = vec4(0.0,0.0,0.0,vEdgeShadow);
+      else \n
+  );
+
+  std::string fragmentShaderPartTwo = DALI_COMPOSE_SHADER(
+      { \n
+    // display page content
+    // display back image of the page, flip the texture
+    if(  dot(vPosition.xyz, normal) > 0.0 ) texel = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) );\n
+    // display front image of the page
+    else texel = texture2D( sTexture, vTexCoord );\n
+    // display book spine, a stripe of shadowed texture
+    float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageSize.x; \n
+    if(pixelPos < uSpineShadowParameter.x) \n
+    {\n
+      float x = pixelPos - uSpineShadowParameter.x;\n
+      float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x);\n
+      spineShadowCoef = normalize( vec2( uSpineShadowParameter.y*x/uSpineShadowParameter.x, y ) ).y;\n
+    }\n
+      }\n
+      // calculate the lighting
+      // set the ambient color as vec3(0.4);
+      float lightColor = abs( normal.z ) * 0.6 + 0.4;\n
+      gl_FragColor = vec4( ( spineShadowCoef* lightColor)* texel.rgb , texel.a ) * uColor;\n
+      }
+  );
+
+  // Create the implementation, temporarily owned on stack,
+  Dali::ShaderEffect shaderEffectCustom;
+  std::ostringstream vertexShaderStringStream;
+  std::ostringstream fragmentShaderStringStream;
+  if( enableBlending )
+  {
+    vertexShaderStringStream<< vertexShader << vertexShaderWithFakedShadow << vertexShaderEnd;
+    fragmentShaderStringStream<< fragmentShaderPartOne << fragmentShaderWithFakedShadow << fragmentShaderPartTwo;
+    shaderEffectCustom = Dali::ShaderEffect::New( vertexShaderStringStream.str(), fragmentShaderStringStream.str(),
+                                                  ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER | ShaderEffect::HINT_BLENDING) );
+  }
+  else
+  {
+    vertexShaderStringStream<< vertexShader << vertexShaderEnd;
+    fragmentShaderStringStream<< fragmentShaderPartOne << fragmentShaderPartTwo;
+    shaderEffectCustom = Dali::ShaderEffect::New( vertexShaderStringStream.str(), fragmentShaderStringStream.str(),
+                                                  ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER ) );
+  }
+
+  static const float DEFAULT_SHADOW_WIDTH(0.15f);
+  static const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
+
+  Vector2 defaultPageSize = Dali::Stage::GetCurrent().GetSize();
+  Dali::Matrix zeroMatrix(true);
+  shaderEffectCustom.SetUniform( "uCommonParameters", zeroMatrix );
+  shaderEffectCustom.SetUniform( "uPageSize", defaultPageSize/(1.f-DEFAULT_SHADOW_WIDTH) );
+  shaderEffectCustom.SetUniform( "uShadowWidth", DEFAULT_SHADOW_WIDTH );
+  shaderEffectCustom.SetUniform( "uSpineShadowParameter", DEFAULT_SPINE_SHADOW_PARAMETER );
+
+  shaderEffectCustom.RegisterProperty( "uOriginalCenter", Vector2( defaultPageSize[0], defaultPageSize[1]*0.5f ) );
+  shaderEffectCustom.RegisterProperty( "uCurrentCenter", Vector2( defaultPageSize[0], defaultPageSize[1]*0.5f ) );
+
+  PageTurnApplyInternalConstraint(shaderEffectCustom);
+
+  // setting isTurningBack to -1.0f here means turning page forward
+  shaderEffectCustom.SetUniform( "uIsTurningBack", -1.0f );
+
+  return shaderEffectCustom;
+}
+
diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h b/dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h
new file mode 100644 (file)
index 0000000..1a21b04
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef __DALI_PAGE_TURN_EFFECT_H_
+#define __DALI_PAGE_TURN_EFFECT_H_
+
+/*
+ * Copyright (c) 2015 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 <dali/public-api/animation/constraint.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/object/property-input.h>
+#include <dali/public-api/shader-effects/shader-effect.h>
+#include <sstream>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+
+/**
+ * @brief Re-applies PageTurnEffect internal constraints
+ * The internal constraint uses the OriginalCenter property and the CurrentCenter Property
+ * to update the variety of common parameters which are with the same value for all the vertices.
+ * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
+ * So if there are other contraints applied to the OriginalCenter or CurrentCenter while when using this effect,
+ * call this method to get the internal constraints and re-apply it afterwards.
+ *
+ * @param[in] shaderEffect The page turn effect to which internal constraints should be re-applied
+ */
+void PageTurnApplyInternalConstraint( ShaderEffect& shaderEffect);
+
+/**
+ * @brief Create a new PageTurnEffect
+ * PageTurnEffect is a custom shader effect to achieve page turn effect for Image actors.
+ *
+ * Usage example:-
+ *
+ * // create shader used for doing page-turn effect\n
+ * ShaderEffect pageTurnEffect = CreatePageTurnEffect();
+ *
+ * // set image actor shader to the page-turn one\n
+ * // for portrait view, one image actor for each page\n
+ * // for landscape view, the page turned over is still visible, so back image is needed \n
+ * //     in this case, create another image Actor using the back image and added to the page actor \n
+ * ImageActor pageActor = ImageActor::New(....); \n
+ * ImageActor backImageActor = ImageActor::New(....); \n
+ * pageActor.Add(backPageActor);\n
+ * pageActor.SetShaderEffect ( pageTurnEffect ); \n
+ *
+ * //set initial values
+ * pageTurnEffect.SetUniform("uPageSize", Vector2);\n
+ * pageTurnEffect.SetUniform("uOriginalCenter", Vector2);\n
+ * pageTurnEffect.SetUniform("uIsTurningBack", bool) SetIsTurningBack();\n
+ * pageTurnEffect.SetUniform("uCurrentCenter",Vector2);\n
+ *
+ * //Animate it with the current center property\n
+ * Animation animation[mAnimationIndex] = Animation::New( ... );\n
+ * animation.AnimateTo(Property( pageTurnEffect, "uCurrentCenter" ),
+ *                            currentCenter,
+ *                            AlphaFunction::...);\n
+ * animation[mAnimationIndex].Play(); \n
+ *
+ * Animatable/Constrainable uniforms:
+ *
+ * @param[in] enableBlending If true, apply HINT_BLENDING when creating the shader object; If false, disable the HINT_BLENDING
+ * @return A handle to a newly allocated ShaderEffect
+ */
+ShaderEffect CreatePageTurnEffect(bool enableBlending = true);
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* __DALI_TOOLKIT_SC_CURVE_EFFECT_H_ */
index 129301e..9b18917 100644 (file)
@@ -23,6 +23,9 @@
 #include <dali/public-api/object/type-registry.h>
 #include <dali/devel-api/object/type-registry-helper.h>
 
+//INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
+
 namespace Dali
 {
 
@@ -139,19 +142,19 @@ void PageTurnPortraitView::OnPossibleOutwardsFlick( const Vector2& panPosition,
     // Add the page to tuning page layer and set up PageTurnEffect
     mShadowView.Add( actor );
     actor.SetShaderEffect( mTurnEffect[mIndex] );
-    GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint();
+    PageTurnApplyInternalConstraint(mTurnEffect[mIndex]);
     mIsAnimating[mIndex] = true;
-    mTurnEffect[mIndex].SetIsTurningBack( true );
+    mTurnEffect[mIndex].SetUniform("uIsTurningBack", 1.f );
     Vector2 originalCenter( mPageSize.width*1.5f, 0.5f*mPageSize.height );
-    mTurnEffect[mIndex].SetOriginalCenter( originalCenter );
-    mTurnEffect[mIndex].SetCurrentCenter( Vector2( mPageSize.width*0.5f, mPageSize.height*0.5f ));
+    mTurnEffect[mIndex].SetUniform("uOriginalCenter", originalCenter );
+    mTurnEffect[mIndex].SetUniform("uCurrentCenter", Vector2( mPageSize.width*0.5f, mPageSize.height*0.5f ) );
 
     // Start an animation to turn the previous page back
     Animation animation = Animation::New( PAGE_TURN_OVER_ANIMATION_DURATION );
     mAnimationActorPair[animation] = actor;
     mAnimationIndexPair[animation] = mIndex;
 
-    animation.AnimateTo( Property( mTurnEffect[mIndex], mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName() ),
+    animation.AnimateTo( Property( mTurnEffect[mIndex], "uCurrentCenter" ),
                          originalCenter,
                          AlphaFunction::EASE_OUT, TimePeriod(PAGE_TURN_OVER_ANIMATION_DURATION*0.75f) );
     animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( Degree( 180.0f ), Vector3::YAXIS ) ,AlphaFunction::EASE_OUT );
index d70065f..3f0059e 100644 (file)
@@ -28,6 +28,8 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
+#include <dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h>
 
 using namespace Dali;
 
@@ -295,26 +297,26 @@ PageTurnView::~PageTurnView()
 void PageTurnView::OnInitialize()
 {
    // create the two book spine effect for static images, left and right side pages respectively
-  mSpineEffectFront = PageTurnBookSpineEffect::New();
-  mSpineEffectFront.SetIsBackImageVisible( false );
-  mSpineEffectFront.SetPageWidth( mPageSize.width );
-  mSpineEffectFront.SetShadowWidth( 0.f );
-  mSpineEffectFront.SetSpineShadowParameter( mSpineShadowParameter );
-
-  mSpineEffectBack = PageTurnBookSpineEffect::New();
-  mSpineEffectBack.SetIsBackImageVisible( true );
-  mSpineEffectBack.SetPageWidth( mPageSize.width );
-  mSpineEffectBack.SetShadowWidth( 0.f );
-  mSpineEffectBack.SetSpineShadowParameter( mSpineShadowParameter );
+  mSpineEffectFront = CreatePageTurnBookSpineEffect();
+  mSpineEffectFront.SetUniform("uIsBackImageVisible", -1.f );
+  mSpineEffectFront.SetUniform("uPageWidth", mPageSize.width );
+  mSpineEffectFront.SetUniform("uShadowWidth", 0.f );
+  mSpineEffectFront.SetUniform("uSpineShadowParameter", mSpineShadowParameter );
+
+  mSpineEffectBack = CreatePageTurnBookSpineEffect();
+  mSpineEffectBack.SetUniform("uIsBackImageVisible", 1.f );
+  mSpineEffectBack.SetUniform("uPageWidth", mPageSize.width );
+  mSpineEffectBack.SetUniform("uShadowWidth", 0.f );
+  mSpineEffectBack.SetUniform("uSpineShadowParameter", mSpineShadowParameter );
 
   // create the page turn effect objects
   for( int i = 0; i < MAXIMUM_TURNING_NUM; i++ )
   {
-    mTurnEffect[i] = Toolkit::PageTurnEffect::New( false );
+    mTurnEffect[i] = CreatePageTurnEffect( false );
     mTurnEffect[i].SetProperty( ShaderEffect::Property::GRID_DENSITY, Property::Value( DEFAULT_GRID_DENSITY ) );
-    mTurnEffect[i].SetPageSize( mPageSize );
-    mTurnEffect[i].SetShadowWidth(0.f);
-    mTurnEffect[i].SetSpineShadowParameter( mSpineShadowParameter );
+    mTurnEffect[i].SetUniform( "uPageSize", mPageSize );
+    mTurnEffect[i].SetUniform( "uShadowWidth", 0.f);
+    mTurnEffect[i].SetUniform( "uSpineShadowParameter", mSpineShadowParameter );
     mIsAnimating[i] = false;
     mIsSliding[i] = false;
     mPropertyPanDisplacement[i] = Self().RegisterProperty("PAN_DISPLACEMENT_PROPERTY_"+i, 0.0f);
@@ -345,7 +347,7 @@ void PageTurnView::OnInitialize()
     AddPage( i );
     if(mPageActors[i])
     {
-      mPageActors[i].SetZ( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
+      mPageActors[i].SetSortModifier( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
     }
   }
 
@@ -423,7 +425,7 @@ void PageTurnView::SetupShadowView()
   mShadowView.Activate();
 }
 
-void PageTurnView::OnStageConnection()
+void PageTurnView::OnStageConnection( unsigned int depth )
 {
   SetupShadowView();
   mTurningPageLayer.RaiseToTop();
@@ -458,11 +460,11 @@ void PageTurnView::SetSpineShadowParameter( const Vector2& spineShadowParameter
   mSpineShadowParameter = spineShadowParameter;
 
   // set spine shadow parameter to all the shader effects
-  mSpineEffectFront.SetSpineShadowParameter( mSpineShadowParameter );
-  mSpineEffectBack.SetSpineShadowParameter( mSpineShadowParameter );
+  mSpineEffectFront.SetUniform("uSpineShadowParameter", mSpineShadowParameter );
+  mSpineEffectBack.SetUniform("uSpineShadowParameter", mSpineShadowParameter );
   for( int i = 0; i < MAXIMUM_TURNING_NUM; i++ )
   {
-    mTurnEffect[i].SetSpineShadowParameter( mSpineShadowParameter );
+    mTurnEffect[i].SetUniform("uSpineShadowParameter", mSpineShadowParameter );
   }
 }
 
@@ -748,7 +750,7 @@ void PageTurnView::PanStarted( const Vector2& gesturePosition )
   }
 
   mOriginalCenter = gesturePosition;
-  mTurnEffect[mIndex].SetIsTurningBack( mIsTurnBack[ mPanActor] );
+  mTurnEffect[mIndex].SetUniform("uIsTurningBack", mIsTurnBack[ mPanActor] ? 1.f : -1.f);
   mPress = false;
   mPageUpdated = false;
 
@@ -785,9 +787,9 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition )
       mDistanceBottomCorner = ( mOriginalCenter - Vector2( 0.0f, mPageSize.height ) ).Length();
       mShadowView.Add( mPanActor );
       SetShaderEffect( mPanActor, mTurnEffect[mIndex] );
-      mTurnEffect[mIndex].SetOriginalCenter( mOriginalCenter );
+      mTurnEffect[mIndex].SetUniform("uOriginalCenter", mOriginalCenter );
       mCurrentCenter = mOriginalCenter;
-      mTurnEffect[mIndex].SetCurrentCenter( mCurrentCenter );
+      mTurnEffect[mIndex].SetUniform("uCurrentCenter", mCurrentCenter );
       mPanDisplacement = 0.f;
       mConstraints = true;
       mPress = true;
@@ -800,8 +802,8 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition )
       self.SetProperty( mPropertyPanDisplacement[mIndex], 0.f );
 
       Constraint shadowBlurStrengthConstraint = Constraint::New<float>( mShadowView, mShadowView.GetBlurStrengthPropertyIndex(), ShadowBlurStrengthConstraint( mPageSize.width*PAGE_TURN_OVER_THRESHOLD_RATIO ) );
-      shadowBlurStrengthConstraint.AddSource( Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName())) );
-      shadowBlurStrengthConstraint.AddSource( Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetOriginalCenterPropertyName())) );
+      shadowBlurStrengthConstraint.AddSource( Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex("uCurrentCenter")) );
+      shadowBlurStrengthConstraint.AddSource( Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex("uOriginalCenter")) );
       shadowBlurStrengthConstraint.AddSource( Source( self, mPropertyPanDisplacement[mIndex] ) );
       shadowBlurStrengthConstraint.Apply();
     }
@@ -866,18 +868,18 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition )
         offset *= k;
         Actor self = Self();
 
-        Property::Index shaderOriginalCenterPropertyIndex = mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetOriginalCenterPropertyName());
+        Property::Index shaderOriginalCenterPropertyIndex = mTurnEffect[mIndex].GetPropertyIndex("uOriginalCenter");
         Constraint originalCenterConstraint = Constraint::New<Vector2>( mTurnEffect[mIndex], shaderOriginalCenterPropertyIndex, OriginalCenterConstraint( mOriginalCenter, offset ));
         originalCenterConstraint.AddSource( Source( self, mPropertyPanDisplacement[mIndex] ) );
         originalCenterConstraint.Apply();
 
-        Property::Index shaderCurrentCenterPropertyIndex = mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName());
+        Property::Index shaderCurrentCenterPropertyIndex = mTurnEffect[mIndex].GetPropertyIndex("uCurrentCenter");
         Constraint currentCenterConstraint = Constraint::New<Vector2>( mTurnEffect[mIndex], shaderCurrentCenterPropertyIndex, CurrentCenterConstraint(mPageSize.width));
         currentCenterConstraint.AddSource( Source(self, mPropertyCurrentCenter[mIndex]) );
         currentCenterConstraint.AddSource( Source(mTurnEffect[mIndex], shaderOriginalCenterPropertyIndex) );
         currentCenterConstraint.Apply();
 
-        GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint();
+        PageTurnApplyInternalConstraint(mTurnEffect[mIndex]);
 
         float distance = offset.Length();
         Constraint rotationConstraint = Constraint::New<Quaternion>( mPanActor, Actor::Property::ORIENTATION, RotationConstraint(distance, mPageSize.width, mIsTurnBack[mPanActor]));
@@ -893,14 +895,14 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition )
       {
         mPanActor.RemoveConstraints();
         mTurnEffect[mIndex].RemoveConstraints();
-        mTurnEffect[mIndex].SetOriginalCenter( mOriginalCenter );
+        mTurnEffect[mIndex].SetUniform("uOriginalCenter",mOriginalCenter );
         mConstraints = true;
         mPanDisplacement = 0.f;
       }
 
-      mTurnEffect[mIndex].SetCurrentCenter( currentCenter );
+      mTurnEffect[mIndex].SetUniform("uCurrentCenter", currentCenter );
       mCurrentCenter = currentCenter;
-      GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint();
+      PageTurnApplyInternalConstraint(mTurnEffect[mIndex]);
     }
   }
 }
@@ -958,7 +960,7 @@ void PageTurnView::PanFinished( const Vector2& gesturePosition, float gestureSpe
     else // the pan finished position is far away from the spine, set up an animation to slide the page back instead of turning over
     {
       Animation animation= Animation::New( PAGE_SLIDE_BACK_ANIMATION_DURATION * (mOriginalCenter.x - mCurrentCenter.x) / mPageSize.width / PAGE_TURN_OVER_THRESHOLD_RATIO );
-      animation.AnimateTo( Property( mTurnEffect[mIndex], mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName() ),
+      animation.AnimateTo( Property( mTurnEffect[mIndex], "uCurrentCenter" ),
                            mOriginalCenter, AlphaFunction::LINEAR );
       mAnimationActorPair[animation] = actor;
       mAnimationIndexPair[animation] = mIndex;
@@ -1021,11 +1023,11 @@ void PageTurnView::OrganizePageDepth()
   {
     if(mCurrentPageIndex+i < mTotalPageCount)
     {
-      mPageActors[( mCurrentPageIndex+i )%NUMBER_OF_CACHED_PAGES].SetZ( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
+      mPageActors[( mCurrentPageIndex+i )%NUMBER_OF_CACHED_PAGES].SetSortModifier( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
     }
     if( mCurrentPageIndex >= i + 1 )
     {
-      mPageActors[( mCurrentPageIndex-i-1 )%NUMBER_OF_CACHED_PAGES].SetZ( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
+      mPageActors[( mCurrentPageIndex-i-1 )%NUMBER_OF_CACHED_PAGES].SetSortModifier( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
     }
   }
 }
index c09250f..8ef6148 100644 (file)
@@ -28,9 +28,6 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
-#include <dali-toolkit/internal/shader-effects/page-turn-effect-impl.h>
-#include <dali-toolkit/devel-api/shader-effects/page-turn-effect.h>
-#include <dali-toolkit/devel-api/shader-effects/page-turn-book-spine-effect.h>
 #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
 #include <dali-toolkit/devel-api/controls/shadow-view/shadow-view.h>
 
@@ -201,7 +198,7 @@ private: // from Control
   /**
    * @copydoc CustomActorImpl::OnStageConnection()
    */
-  virtual void OnStageConnection();
+  virtual void OnStageConnection( unsigned int depth );
 
   /**
    * @copydoc CustomActorImpl::OnStageDisconnection()
@@ -319,9 +316,9 @@ protected:
   CameraActor                    mCameraActor;             ///< The camera actor attached to the off screen tasks
   bool                           mPanning;                 ///< The boolean to indicate whether the pan gesture is continuing
 
-  std::vector<Toolkit::PageTurnEffect>    mTurnEffect;     ///< The group of PageTurnEffects
-  PageTurnBookSpineEffect        mSpineEffectFront;        ///< The book spine shader effect without flipping image content
-  PageTurnBookSpineEffect        mSpineEffectBack;         ///< The book spine shader effect with image content flipped
+  std::vector<ShaderEffect>      mTurnEffect;              ///< The group of PageTurnEffects
+  ShaderEffect                   mSpineEffectFront;        ///< The book spine shader effect without flipping image content
+  ShaderEffect                   mSpineEffectBack;         ///< The book spine shader effect with image content flipped
   Vector2                        mSpineShadowParameter;    ///< The spine shadow parameter for all the above shader effects
   Vector2                        mOriginalCenter;          ///< The original center set to the PageTurnEffect
   Vector2                        mCurrentCenter;           ///< The current center set to the PageTurnEffect
index 7577220..d4fcc43 100755 (executable)
@@ -35,8 +35,9 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/buttons/button.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
 #include <dali-toolkit/internal/controls/buttons/button-impl.h>
 
@@ -128,10 +129,10 @@ void Popup::OnInitialize()
   // Create Layer
   mLayer = Layer::New();
   mLayer.SetName( "POPUP_LAYER" );
+  mLayer.SetDepthTestDisabled( true );
   mLayer.SetParentOrigin(ParentOrigin::CENTER);
   mLayer.SetAnchorPoint(AnchorPoint::CENTER);
   mLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-  mLayer.SetDrawMode( DrawMode::OVERLAY );
 
   // Any content after this point which is added to Self() will be reparented to
   // mContent.
@@ -223,6 +224,11 @@ void Popup::SetBackgroundImage( Actor image )
   mBackgroundImage.SetAnchorPoint( AnchorPoint::CENTER );
   mBackgroundImage.SetParentOrigin( ParentOrigin::CENTER );
 
+  if ( ImageActor imageActor = DownCast< ImageActor >( image ) )
+  {
+    imageActor.SetSortModifier( BACKGROUND_DEPTH_INDEX );
+  }
+
   Vector3 border( mPopupStyle->backgroundOuterBorder.x, mPopupStyle->backgroundOuterBorder.z, 0.0f );
   mBackgroundImage.SetSizeModeFactor( border );
 
@@ -243,6 +249,11 @@ void Popup::SetButtonAreaImage( Actor image )
   // Adds new area image to the dialog.
   mButtonAreaImage = image;
 
+  if ( ImageActor imageActor = DownCast< ImageActor >( image ) )
+  {
+    imageActor.SetSortModifier( BACKGROUND_DEPTH_INDEX + 1 );
+  }
+
   // OnDialogTouched only consume the event. It prevents the touch event to be caught by the backing.
   mButtonAreaImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
 
@@ -416,7 +427,7 @@ void Popup::CreateBacking()
 {
   mBacking = Dali::Toolkit::CreateSolidColorActor( mPopupStyle->backingColor );
   mBacking.SetName( "POPUP_BACKING" );
-
+  mBacking.SetSortModifier( BACKGROUND_DEPTH_INDEX - 1 );
   mBacking.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   mBacking.SetSensitive(true);
 
index 998289b..d828897 100755 (executable)
@@ -220,7 +220,6 @@ void ScrollBar::SetScrollIndicator( Actor indicator )
 
     Actor self = Self();
     self.Add(mIndicator);
-    self.SetDrawMode(DrawMode::OVERLAY);
 
     if( !mPanGestureDetector )
     {
index 7f38bd4..d278eb4 100644 (file)
 #include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
 
 // EXTERNAL INCLUDES
-#include <math.h>
-#include <dali/devel-api/actors/mesh-actor.h>
-#include <dali/public-api/animation/constraint.h>
-#include <dali/devel-api/geometry/animatable-mesh.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
 #include <dali/public-api/math/vector3.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/devel-api/object/property-buffer.h>
+#include <dali/devel-api/rendering/geometry.h>
+#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/rendering/shader.h>
 
 namespace Dali
 {
@@ -38,81 +39,90 @@ namespace Internal
 namespace
 {
 // Bouncing effect is presented by stacked three layers with same color and opacity
-const size_t NUM_LAYERS( 3 );
 const Vector3 LAYER_HEIGHTS( 1.f, 27.f/42.f, 13.f/42.f);
 
-// use the actor color to paint every layer
-const char* MESH_FRAGMENT_SHADER =
-"void main()\n"
-"{\n"
-"  gl_FragColor = uColor;\n"
-"}\n";
-
-// Constraint to move the vertices vertically
-struct VertexPositionConstraint
-{
-  VertexPositionConstraint( float initialY, float range )
-  : mInitialY( initialY ),
-    mRange( range )
-  {
-  }
-
-  void operator()( Vector3& current, const PropertyInputContainer& inputs )
-  {
-    current.y = mInitialY + mRange * fabsf( inputs[0]->GetFloat() );
-  }
+#define MAKE_SHADER(A)#A
+
+// Modify the vertex position according to the bounce coefficient;
+const char* MESH_VERTEX_SHADER = MAKE_SHADER(
+attribute mediump vec3    aPosition1;\n
+attribute mediump vec3    aPosition2;\n
+uniform   mediump mat4    uMvpMatrix;\n
+uniform   mediump vec3    uSize;
+uniform   mediump float   uBounceCoefficient;\n
+\n
+void main()\n
+{\n
+  gl_Position = uMvpMatrix * vec4(mix( aPosition1, aPosition2, abs(uBounceCoefficient) )*uSize, 1.0);\n
+}
+);
 
-  float mInitialY;
-  float mRange;
-};
+// use the actor color to paint every layer
+const char* MESH_FRAGMENT_SHADER = MAKE_SHADER(
+uniform lowp  vec4    uColor;\n
+void main()\n
+{\n
+  gl_FragColor = uColor;\n
+}\n
+);
 
 } // namespace Anon
 
 Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
 {
-  Dali::AnimatableMesh             mesh;
-  Dali::MeshActor                  meshActor;
-
-  Dali::AnimatableMesh::Faces faces;
-  faces.reserve( NUM_LAYERS * 6 ); // 2 triangles per layer
-  for( size_t i=0; i<NUM_LAYERS; i++ )
-  {
-    size_t j=i*4;
-    faces.push_back(j); faces.push_back(j+3); faces.push_back(j+1);
-    faces.push_back(j); faces.push_back(j+2); faces.push_back(j+3);
-  }
-
-  mesh = Dali::AnimatableMesh::New(NUM_LAYERS*4, faces); // 4 vertices per layer
-  for( size_t i=0;i<NUM_LAYERS;i++ )
-  {
-    size_t j=i*4;
-    float positionZ = 0.01f*static_cast<float>( i ); // the interval between each layer is 0.01
-    mesh[j  ].SetPosition( Vector3( -0.5f, -0.5f, positionZ ) );
-    mesh[j+1].SetPosition( Vector3( 0.5f, -0.5f, positionZ ) );
-    mesh[j+2].SetPosition( Vector3( -0.5f, -0.5f, positionZ ) );
-    mesh[j+3].SetPosition( Vector3( 0.5f, -0.5f, positionZ ) );
-  }
-
-  meshActor = Dali::MeshActor::New(mesh);
-
-  Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( "", MESH_FRAGMENT_SHADER,
-                                                             GEOMETRY_TYPE_UNTEXTURED_MESH,
-                                                             Dali::ShaderEffect::HINT_BLENDING );
-  meshActor.SetShaderEffect(shaderEffect);
-
-  // To control the movement of all vertices with one custom property
-  bouncePropertyIndex = meshActor.RegisterProperty("BounceCoeffcient", 0.f);
-  for( size_t i=0;i<NUM_LAYERS;i++ )
+  // Create the bouncing mesh geometry
+  struct VertexPosition
   {
-    size_t j=i*4;
-    Constraint constraint = Constraint::New<Vector3>( mesh, mesh.GetPropertyIndex(j+2, AnimatableVertex::Property::POSITION ), VertexPositionConstraint(-0.5f, LAYER_HEIGHTS[i]) );
-    constraint.AddSource( Source(meshActor, bouncePropertyIndex) );
-    constraint.Apply();
-
-    constraint = Constraint::New<Vector3>( mesh, mesh.GetPropertyIndex(j+3,  AnimatableVertex::Property::POSITION), VertexPositionConstraint(-0.5f, LAYER_HEIGHTS[i]) );
-    constraint.AddSource( Source(meshActor, bouncePropertyIndex) );
-    constraint.Apply();
-  }
+    Vector3 position1;
+    Vector3 position2;
+  };
+  // 4 vertices 2 triangles per layer. The depth interval between each layer is 0.01
+  VertexPosition vertexData[12] = {
+    //bottom layer
+    { Vector3( -0.5f, -0.5f, 0.f ),  Vector3( -0.5f, -0.5f, 0.f )  },
+    { Vector3( 0.5f, -0.5f, 0.f ),   Vector3( 0.5f, -0.5f, 0.f )   },
+    { Vector3( -0.5f, -0.5f, 0.f ),  Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[0], 0.f ) },
+    { Vector3( 0.5f, -0.5f, 0.f ),   Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[0], 0.f )   },
+    // middle layer
+    { Vector3( -0.5f, -0.5f, 0.01f ),  Vector3( -0.5f, -0.5f, 0.01f )  },
+    { Vector3( 0.5f, -0.5f, 0.01f ),   Vector3( 0.5f, -0.5f, 0.01f )   },
+    { Vector3( -0.5f, -0.5f, 0.01f ),  Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[1], 0.01f ) },
+    { Vector3( 0.5f, -0.5f, 0.01f ),   Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[1], 0.01f )   },
+    // top layer
+    { Vector3( -0.5f, -0.5f, 0.02f ),  Vector3( -0.5f, -0.5f, 0.02f )  },
+    { Vector3( 0.5f, -0.5f, 0.02f ),   Vector3( 0.5f, -0.5f, 0.02f )   },
+    { Vector3( -0.5f, -0.5f, 0.02f ),  Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[2], 0.02f ) },
+    { Vector3( 0.5f, -0.5f, 0.02f ),   Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[2], 0.02f )   }
+  };
+  Property::Map vertexFormat;
+  vertexFormat["aPosition1"] = Property::VECTOR3;
+  vertexFormat["aPosition2"] = Property::VECTOR3;
+  PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 12u );
+  vertices.SetData( vertexData );
+
+  unsigned int indexData[18] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11 };
+  Property::Map indexFormat;
+  indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat, 18u );
+  indices.SetData( indexData );
+
+  Geometry meshGeometry = Geometry::New();
+  meshGeometry.AddVertexBuffer( vertices );
+  meshGeometry.SetIndexBuffer( indices );
+
+  // Create material
+  Shader shader = Shader::New( MESH_VERTEX_SHADER, MESH_FRAGMENT_SHADER );
+  Material material = Material::New( shader );
+
+  // Create renderer
+  Renderer renderer = Renderer::New( meshGeometry, material );
+
+  // Create actor
+  Actor meshActor= Actor::New();
+  meshActor.AddRenderer( renderer );
+
+  // Register property
+  bouncePropertyIndex = meshActor.RegisterProperty("uBounceCoefficient", 0.f);
 
   return meshActor;
 }
index 2fa572d..557a089 100644 (file)
@@ -418,14 +418,6 @@ void DepthLayout::GetDefaultItemSize( unsigned int itemId, const Vector3& layout
   itemSize.width = itemSize.height = itemSize.depth = ( IsVertical( GetOrientation() ) ? layoutSize.width : layoutSize.height ) / static_cast<float>( mImpl->mNumberOfColumns + 1 );
 }
 
-void DepthLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
-{
-  if(animation)
-  {
-    animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size );
-  }
-}
-
 Degree DepthLayout::GetScrollDirection() const
 {
   Degree scrollDirection(0.0f);
index c1f18f9..82ce8fc 100644 (file)
@@ -191,11 +191,6 @@ private:
   virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
 
   /**
-   * @copydoc ItemLayout::GetResizeAnimation()
-   */
-  virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const;
-
-  /**
    * @copydoc ItemLayout::GetScrollDirection()
    */
   virtual Degree GetScrollDirection() const;
index 9339f0a..e1ca4d0 100644 (file)
@@ -506,23 +506,6 @@ void GridLayout::GetDefaultItemSize( unsigned int itemId, const Vector3& layoutS
   itemSize.height = itemSize.depth = itemSize.width * 0.75f;
 }
 
-void GridLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
-{
-  if(animation)
-  {
-    Vector3 currentSize( actor.GetCurrentSize() );
-    Vector3 shrink( currentSize );
-
-    shrink.width = std::min(size.width, currentSize.width);
-    shrink.height = std::min(size.height, currentSize.height);
-
-    // Do a nonlinear size animation to shrink the actor first when the actor size changes,
-    // so that we can avoid the actors overlapping during orientation change.
-    animation.AnimateTo( Property( actor, Actor::Property::SIZE ), shrink, AlphaFunction::EASE_OUT, TimePeriod( 0.0f, durationSeconds * 0.5f ) );
-    animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, AlphaFunction::EASE_IN, TimePeriod( 0.0f, durationSeconds ) );
-  }
-}
-
 Degree GridLayout::GetScrollDirection() const
 {
   Degree scrollDirection(0.0f);
index b2b3bd9..8cbdd33 100644 (file)
@@ -234,11 +234,6 @@ private:
   virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
 
   /**
-   * @copydoc ItemLayout::GetResizeAnimation()
-   */
-  virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const;
-
-  /**
    * @copydoc ItemLayout::GetScrollDirection()
    */
   virtual Degree GetScrollDirection() const;
index 38e6216..13ab888 100644 (file)
@@ -1477,7 +1477,6 @@ void ItemView::EnableScrollOvershoot( bool enable )
     mOvershootOverlay.SetColor(mOvershootEffectColor);
     mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
     mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-    mOvershootOverlay.SetDrawMode(DrawMode::OVERLAY);
     self.Add(mOvershootOverlay);
 
     Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint );
index 731fa90..83d2a1f 100644 (file)
@@ -397,14 +397,6 @@ void SpiralLayout::GetDefaultItemSize( unsigned int itemId, const Vector3& layou
   itemSize.height = itemSize.depth = ( itemSize.width / 4.0f ) * 3.0f;
 }
 
-void SpiralLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
-{
-  if(animation)
-  {
-    animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size );
-  }
-}
-
 Degree SpiralLayout::GetScrollDirection() const
 {
   Degree scrollDirection(0);
index 326dcc7..00f550a 100644 (file)
@@ -164,11 +164,6 @@ private:
   virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
 
   /**
-   * @copydoc ItemLayout::GetResizeAnimation()
-   */
-  virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const;
-
-  /**
    * @copydoc ItemLayout::GetScrollDirection()
    */
   virtual Degree GetScrollDirection() const;
index 0d2e728..592fefc 100644 (file)
@@ -147,7 +147,6 @@ ScrollOvershootEffectRipple::ScrollOvershootEffectRipple( bool vertical, Scrolla
   mOvershootOverlay.SetColor(mAttachedScrollView.GetOvershootEffectColor());
   mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
   mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-  mOvershootOverlay.SetDrawMode(DrawMode::OVERLAY);
   mOvershootOverlay.SetVisible(false);
 
 }
index ba36907..a9714d4 100644 (file)
@@ -624,7 +624,6 @@ void ScrollView::OnInitialize()
   // Internal Actor, used to hide actors from enumerations.
   // Also actors added to Internal actor appear as overlays e.g. ScrollBar components.
   mInternalActor = Actor::New();
-  mInternalActor.SetDrawMode(DrawMode::OVERLAY);
   self.Add(mInternalActor);
 
   mInternalActor.SetParentOrigin(ParentOrigin::CENTER);
@@ -658,7 +657,7 @@ void ScrollView::OnInitialize()
   SetInternalConstraints();
 }
 
-void ScrollView::OnStageConnection()
+void ScrollView::OnStageConnection( unsigned int depth )
 {
   DALI_LOG_SCROLL_STATE("[0x%X]", this);
 
index 86577c7..ca7106e 100644 (file)
@@ -549,7 +549,7 @@ private: // private overriden functions from CustomActorImpl and Controls
   /**
    * @copydoc CustomActorImpl::OnStageConnection()
    */
-  virtual void OnStageConnection();
+  virtual void OnStageConnection( unsigned int depth );
 
   /**
    * @copydoc CustomActorImpl::OnStageDisconnection()
index f2fe0b9..31174a2 100644 (file)
@@ -240,7 +240,6 @@ void ShadowView::OnInitialize()
   mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);
 
   mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE,
-                                           Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
                                            ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ));
 
   // Create render targets needed for rendering from light's point of view
index a037767..38ceffe 100755 (executable)
@@ -570,7 +570,6 @@ void Slider::CreateHandleValueDisplay()
     mHandleValueTextLabel.SetAnchorPoint( AnchorPoint::CENTER );
     mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
     mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
-    mHandleValueTextLabel.SetDrawMode( DrawMode::OVERLAY );
     mHandle.Add( mHandleValueTextLabel );
   }
 }
index 742ef5e..0be26cd 100644 (file)
@@ -31,12 +31,25 @@ using namespace Dali;
 
 namespace
 {
+/*
+ * Custom properties for where to put the actor.
+ *
+ * When an actor is add to the tableView through Actor::Add() instead of TableView::AddChild,
+ * the following custom properties of the actor are checked to decide the actor position inside the table
+ *
+ * These non-animatable properties should be registered to the child which would be added to the table
+ */
+const char * const CELL_INDEX_PROPERTY_NAME("cell-index");
+const char * const ROW_SPAN_PROPERTY_NAME("row-span");
+const char * const COLUMN_SPAN_PROPERTY_NAME("column-span");
+const char * const CELL_HORIZONTAL_ALIGNMENT_PROPERTY_NAME("cell-horizontal-alignment");
+const char * const CELL_VERTICAL_ALIGNMENT_PROPERTY_NAME("cell-vertical-alignment");
 
 /**
  * @brief Should the tableview fit around the given actor
  *
  * @param[in] actor The child actor to test against
- * @param[dimension] The dimnesion to test against
+ * @param[dimension] The dimension to test against
  */
 bool FitToChild( Actor actor, Dimension::Type dimension )
 {
@@ -141,11 +154,27 @@ const Scripting::StringEnum LAYOUT_POLICY_STRING_TABLE[] =
 {
  { "fixed",    Toolkit::TableView::FIXED    },
  { "relative", Toolkit::TableView::RELATIVE },
- { "fill",     Toolkit::TableView::FILL     }
+ { "fill",     Toolkit::TableView::FILL     },
+ { "fit",      Toolkit::TableView::FIT      }
 };
-
 const unsigned int LAYOUT_POLICY_STRING_TABLE_COUNT = sizeof(LAYOUT_POLICY_STRING_TABLE) / sizeof( LAYOUT_POLICY_STRING_TABLE[0] );
 
+const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
+{
+  {"left",   HorizontalAlignment::LEFT},
+  {"center", HorizontalAlignment::CENTER},
+  {"right",  HorizontalAlignment::RIGHT}
+};
+const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof(HORIZONTAL_ALIGNMENT_STRING_TABLE) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
+
+const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
+{
+  {"top",    VerticalAlignment::TOP},
+  {"center", VerticalAlignment::CENTER},
+  {"bottom", VerticalAlignment::BOTTOM}
+};
+const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof(VERTICAL_ALIGNMENT_STRING_TABLE) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
+
 } // Unnamed namespace
 
 Toolkit::TableView TableView::New( unsigned int initialRows, unsigned int initialColumns )
@@ -169,10 +198,7 @@ bool TableView::AddChild( Actor& child, const Toolkit::TableView::CellPosition&
   DALI_ASSERT_ALWAYS( child );
 
   // if child is already parented, we adopt it
-  if( child.GetParent() )
-  {
-    child.GetParent().Remove( child );
-  }
+  child.Unparent();
 
   // check if we need to expand our data array
   if( position.rowIndex >= mCellData.GetRows() )
@@ -228,6 +254,15 @@ bool TableView::AddChild( Actor& child, const Toolkit::TableView::CellPosition&
   }
 
   // Relayout the whole table
+  if( mRowData[position.rowIndex].sizePolicy == Toolkit::TableView::FIT && position.rowSpan == 1 )
+  {
+    mRowDirty = true;
+  }
+  if( mColumnData[position.columnIndex].sizePolicy == Toolkit::TableView::FIT && position.columnSpan == 1 )
+  {
+    mColumnDirty = true;
+  }
+
   RelayoutRequest();
 
   return true;    // Addition successful
@@ -258,6 +293,14 @@ Actor TableView::RemoveChildAt( const Toolkit::TableView::CellPosition& position
     // relayout the table only if instances were found
     if( RemoveAllInstances( child ) )
     {
+      if( mRowData[position.rowIndex].sizePolicy == Toolkit::TableView::FIT )
+      {
+        mRowDirty = true;
+      }
+      if( mColumnData[position.columnIndex].sizePolicy == Toolkit::TableView::FIT )
+      {
+        mColumnDirty = true;
+      }
       RelayoutRequest();
     }
   }
@@ -328,7 +371,7 @@ void TableView::InsertRow( unsigned int rowIndex )
   mRowData.Insert( mRowData.Begin() + rowIndex, RowColumnData() );
 
   // Sizes may have changed, so relayout
-  mRowColumnDirty = true;
+  mRowDirty = true;
   RelayoutRequest();
 }
 
@@ -384,7 +427,10 @@ void TableView::DeleteRow( unsigned int rowIndex, std::vector<Actor>& removed )
   mRowData.Erase( mRowData.Begin() + rowIndex );
 
   // Sizes may have changed, so relayout
-  mRowColumnDirty = true;
+  mRowDirty = true;
+  // it is possible that the deletion of row leads to remove of child which might further lead to the change of FIT column
+  mColumnDirty = true;
+
   RelayoutRequest();
 }
 
@@ -427,7 +473,7 @@ void TableView::InsertColumn( unsigned int columnIndex )
   mColumnData.Insert( mColumnData.Begin() + columnIndex, RowColumnData() );
 
   // Sizes may have changed so relayout
-  mRowColumnDirty = true;
+  mColumnDirty = true;
   RelayoutRequest();
 }
 
@@ -483,7 +529,10 @@ void TableView::DeleteColumn( unsigned int columnIndex, std::vector<Actor>& remo
   mColumnData.Erase( mColumnData.Begin() + columnIndex );
 
   // Size may have changed so relayout
-  mRowColumnDirty = true;
+  mColumnDirty = true;
+  // it is possible that the deletion of column leads to remove of child which might further lead to the change of FIT row
+  mRowDirty = true;
+
   RelayoutRequest();
 }
 
@@ -524,7 +573,8 @@ void TableView::Resize( unsigned int rows, unsigned int columns, std::vector<Act
   RemoveAndGetLostActors( lost, removed, rowsRemoved, columnsRemoved );
 
   // Sizes may have changed so request a relayout
-  mRowColumnDirty = true;
+  mRowDirty = true;
+  mColumnDirty = true;
   RelayoutRequest();
 }
 
@@ -544,44 +594,44 @@ Size TableView::GetCellPadding()
   return mPadding;
 }
 
-void TableView::SetRowPolicy( unsigned int rowIndex, CellSizePolicy policy )
+void TableView::SetFitHeight( unsigned int rowIndex )
 {
   DALI_ASSERT_ALWAYS( rowIndex < mRowData.Size() );
 
-  if( mRowData[ rowIndex ].sizePolicy != policy )
+  if( mRowData[ rowIndex ].sizePolicy != Toolkit::TableView::FIT )
   {
-    mRowData[ rowIndex ].sizePolicy = policy;
+    mRowData[ rowIndex ].sizePolicy = Toolkit::TableView::FIT;
 
-    mRowColumnDirty = true;
+    mRowDirty = true;
     RelayoutRequest();
   }
 }
 
-TableView::CellSizePolicy TableView::GetRowPolicy( unsigned int rowIndex ) const
+bool TableView::IsFitHeight( unsigned int rowIndex ) const
 {
   DALI_ASSERT_ALWAYS( rowIndex < mRowData.Size() );
 
-  return mRowData[ rowIndex ].sizePolicy;
+  return mRowData[ rowIndex ].sizePolicy == Toolkit::TableView::FIT;
 }
 
-void TableView::SetColumnPolicy( unsigned int columnIndex, CellSizePolicy policy )
+void TableView::SetFitWidth( unsigned int columnIndex )
 {
   DALI_ASSERT_ALWAYS( columnIndex < mColumnData.Size() );
 
-  if( mColumnData[ columnIndex ].sizePolicy != policy )
+  if( mColumnData[ columnIndex ].sizePolicy != Toolkit::TableView::FIT )
   {
-    mColumnData[ columnIndex ].sizePolicy = policy;
+    mColumnData[ columnIndex ].sizePolicy = Toolkit::TableView::FIT;
 
-    mRowColumnDirty = true;
+    mColumnDirty = true;
     RelayoutRequest();
   }
 }
 
-TableView::CellSizePolicy TableView::GetColumnPolicy( unsigned int columnIndex ) const
+bool TableView::IsFitWidth( unsigned int columnIndex ) const
 {
   DALI_ASSERT_ALWAYS( columnIndex < mColumnData.Size() );
 
-  return mColumnData[ columnIndex ].sizePolicy;
+  return mColumnData[ columnIndex ].sizePolicy == Toolkit::TableView::FIT;
 }
 
 void TableView::SetFixedHeight( unsigned int rowIndex, float height )
@@ -590,9 +640,9 @@ void TableView::SetFixedHeight( unsigned int rowIndex, float height )
 
   RowColumnData& data = mRowData[ rowIndex ];
   data.size = height;
-  data.sizePolicy = FIXED;
+  data.sizePolicy = Toolkit::TableView::FIXED;
 
-  mRowColumnDirty = true;
+  mRowDirty = true;
   RelayoutRequest();
 }
 
@@ -609,9 +659,9 @@ void TableView::SetFixedWidth( unsigned int columnIndex, float width )
 
   RowColumnData& data = mColumnData[ columnIndex ];
   data.size = width;
-  data.sizePolicy = FIXED;
+  data.sizePolicy = Toolkit::TableView::FIXED;
 
-  mRowColumnDirty = true;
+  mColumnDirty = true;
   RelayoutRequest();
 }
 
@@ -628,10 +678,9 @@ void TableView::SetRelativeHeight( unsigned int rowIndex, float heightPercentage
 
   RowColumnData& data = mRowData[ rowIndex ];
   data.fillRatio = heightPercentage;
-  data.userFillRatio = true;
-  data.sizePolicy = FILL;
+  data.sizePolicy = Toolkit::TableView::RELATIVE;
 
-  mRowColumnDirty = true;
+  mRowDirty = true;
   RelayoutRequest();
 }
 
@@ -648,10 +697,9 @@ void TableView::SetRelativeWidth( unsigned int columnIndex, float widthPercentag
 
   RowColumnData& data = mColumnData[ columnIndex ];
   data.fillRatio = widthPercentage;
-  data.userFillRatio = true;
-  data.sizePolicy = FILL;
+  data.sizePolicy = Toolkit::TableView::RELATIVE;
 
-  mRowColumnDirty = true;
+  mColumnDirty = true;
   RelayoutRequest();
 }
 
@@ -662,41 +710,45 @@ float TableView::GetRelativeWidth( unsigned int columnIndex ) const
   return mColumnData[ columnIndex ].fillRatio;
 }
 
-void TableView::CalculateRowColumnData()
-{
-  // Calculate the relative sizes
-  if( mRowColumnDirty )
-  {
-    ComputeRelativeSizes( mRowData );
-    ComputeRelativeSizes( mColumnData );
-
-    mRowColumnDirty = false;
-  }
-}
-
 void TableView::OnCalculateRelayoutSize( Dimension::Type dimension )
 {
-  CalculateRowColumnData();
-
-  if( dimension & Dimension::WIDTH )
+  if( (dimension & Dimension::WIDTH) && mColumnDirty )
   {
-    CalculateFixedSizes( mColumnData, Dimension::WIDTH );
+    /*
+     * FIXED and FIT have size in pixel
+     * Nothing to do with FIXED, as its value is assigned by user and will not get changed
+     *
+     * Need to update the size for FIT column here
+     */
+    CalculateFitSizes( mColumnData, Dimension::WIDTH );
+
+    /* RELATIVE and FILL have size in ratio
+     * Their size in pixel is not available until we get the negotiated size for the whole table
+     * Nothing to do with RELATIVE, as its ratio is assigned by user and will not get changed
+     *
+     * Need to update the ratio for FILL column here
+     */
+    CalculateFillSizes( mColumnData );
+
     mFixedTotals.width = CalculateTotalFixedSize( mColumnData );
   }
 
-  if( dimension & Dimension::HEIGHT )
+  if( (dimension & Dimension::HEIGHT) && mRowDirty )
   {
-    CalculateFixedSizes( mRowData, Dimension::HEIGHT );
+    // refer to the comment above
+    CalculateFitSizes( mRowData, Dimension::HEIGHT );
+
+    // refer to the comment above
+    CalculateFillSizes( mRowData );
+
     mFixedTotals.height = CalculateTotalFixedSize( mRowData );
   }
 }
 
 void TableView::OnLayoutNegotiated( float size, Dimension::Type dimension )
 {
-  CalculateRowColumnData();
-
-  // Calculate the value of all relative sized rows and columns
-  if( dimension & Dimension::WIDTH )
+  // Update the column sizes
+  if( (dimension & Dimension::WIDTH) && mColumnDirty )
   {
     float remainingSize = size - mFixedTotals.width;
     if( remainingSize < 0.0f )
@@ -704,10 +756,24 @@ void TableView::OnLayoutNegotiated( float size, Dimension::Type dimension )
       remainingSize = 0.0f;
     }
 
-    CalculateRelativeSizes( mColumnData, remainingSize );
+    // update every column position in ColumnData array
+    float cumulatedWidth = 0.0f;
+    for( unsigned int column = 0, columnCount = mCellData.GetColumns(); column < columnCount; ++column )
+    {
+      if( mColumnData[ column ].sizePolicy == Toolkit::TableView::FILL ||  mColumnData[ column ].sizePolicy == Toolkit::TableView::RELATIVE)
+      {
+        mColumnData[ column ].size = mColumnData[ column ].fillRatio * remainingSize;
+      }
+
+      cumulatedWidth += mColumnData[ column ].size;
+      mColumnData[column].position = cumulatedWidth;
+    }
+
+    mColumnDirty = false;
   }
 
-  if( dimension & Dimension::HEIGHT )
+  // Update the row sizes
+  if( (dimension & Dimension::HEIGHT) && mRowDirty )
   {
     float remainingSize = size - mFixedTotals.height;
     if( remainingSize < 0.0f )
@@ -715,53 +781,78 @@ void TableView::OnLayoutNegotiated( float size, Dimension::Type dimension )
       remainingSize = 0.0f;
     }
 
-    CalculateRelativeSizes( mRowData, remainingSize );
+    // update every row position in RowData array
+    float cumulatedHeight = 0.0f;
+    for( unsigned int row = 0, rowCount = mCellData.GetRows(); row < rowCount; ++row )
+    {
+      if( mRowData[ row ].sizePolicy == Toolkit::TableView::FILL ||  mRowData[ row ].sizePolicy == Toolkit::TableView::RELATIVE)
+      {
+        mRowData[ row ].size = mRowData[ row ].fillRatio * remainingSize;
+      }
+
+      cumulatedHeight += mRowData[ row ].size;
+      mRowData[row].position = cumulatedHeight;
+    }
+
+    mRowDirty = false;
   }
 }
 
 void TableView::OnRelayout( const Vector2& size, RelayoutContainer& container )
 {
-  CalculateRowColumnData();
-
   // Go through the layout data
-  float cumulatedHeight = 0.0f;
-
-  const unsigned int rowCount = mCellData.GetRows();
-  const unsigned int columnCount = mCellData.GetColumns();
-
-  for( unsigned int row = 0; row < rowCount; ++row )
+  for( unsigned int row = 0, rowCount = mCellData.GetRows(); row < rowCount; ++row )
   {
-    float cumulatedWidth = 0.0f;
-
-    for( unsigned int column = 0; column < columnCount; ++column )
+    for( unsigned int column = 0, columnCount = mCellData.GetColumns(); column < columnCount; ++column )
     {
-      Actor& actor = mCellData[ row ][ column ].actor;
-      const Toolkit::TableView::CellPosition position = mCellData[ row ][ column ].position;
+      CellData& cellData= mCellData[ row ][ column ];
+      Actor& actor = cellData.actor;
+      const Toolkit::TableView::CellPosition position = cellData.position;
 
       // If there is an actor and this is the main cell of the actor.
-      // An actor can be in multiple cells if its row or columnspan is more than 1.
+      // An actor can be in multiple cells if its row or column span is more than 1.
       // We however must lay out each actor only once.
-      if( actor && ( position.rowIndex == row ) && ( position.columnIndex == column ) )
+      if( actor &&  position.rowIndex == row && position.columnIndex == column )
       {
-        // Anchor actor to top left of table view
+        // Anchor actor to top left of the cell
         actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
         actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
 
         Padding padding;
         actor.GetPadding( padding );
 
-        Vector3 actorPosition( cumulatedWidth + mPadding.width + padding.left,       // Left padding
-                               cumulatedHeight + mPadding.height + padding.top,      // Top padding
-                               0.0f );
-        actor.SetPosition( actorPosition );
-      }
+        float left = column > 0 ? mColumnData[column-1].position : 0.f;
+        float right = mColumnData[column+position.columnSpan-1].position;
+        float top = row > 0 ? mRowData[row-1].position : 0.f;
+        float bottom = mRowData[row+position.rowSpan-1].position;
 
-      DALI_ASSERT_DEBUG( column < mColumnData.Size() );
-      cumulatedWidth += mColumnData[ column ].size;
-    }
+        if( cellData.horizontalAlignment == HorizontalAlignment::LEFT )
+        {
+          actor.SetX( left + mPadding.width + padding.left );
+        }
+        else if( cellData.horizontalAlignment ==  HorizontalAlignment::RIGHT )
+        {
+          actor.SetX( right - mPadding.width - padding.right - actor.GetRelayoutSize( Dimension::WIDTH ) );
+        }
+        else //if( cellData.horizontalAlignment ==  HorizontalAlignment::CENTER )
+        {
+          actor.SetX( (left + right + padding.left - padding.right - actor.GetRelayoutSize( Dimension::WIDTH )) * 0.5f );
+        }
 
-    DALI_ASSERT_DEBUG( row < mRowData.Size() );
-    cumulatedHeight += mRowData[ row ].size;
+        if( cellData.verticalAlignment == VerticalAlignment::TOP )
+        {
+          actor.SetY( top + mPadding.height + padding.top );
+        }
+        else if( cellData.verticalAlignment == VerticalAlignment::BOTTOM )
+        {
+          actor.SetY( bottom - mPadding.height - padding.bottom -  actor.GetRelayoutSize( Dimension::HEIGHT ) );
+        }
+        else //if( cellData.verticalAlignment = VerticalAlignment::CENTER )
+        {
+          actor.SetY( (top + bottom + padding.top - padding.bottom - actor.GetRelayoutSize( Dimension::HEIGHT )) * 0.5f );
+        }
+      }
+    }
   }
 }
 
@@ -807,12 +898,12 @@ void TableView::SetProperty( BaseObject* object, Property::Index index, const Pr
       }
       case Toolkit::TableView::Property::LAYOUT_ROWS:
       {
-        SetHeightOrWidthProperty( tableViewImpl, &TableView::SetFixedHeight, &TableView::SetRelativeHeight, value );
+        SetHeightOrWidthProperty( tableViewImpl, &TableView::SetFixedHeight, &TableView::SetRelativeHeight, &TableView::SetFitHeight, value );
         break;
       }
       case Toolkit::TableView::Property::LAYOUT_COLUMNS:
       {
-        SetHeightOrWidthProperty( tableViewImpl, &TableView::SetFixedWidth, &TableView::SetRelativeWidth, value );
+        SetHeightOrWidthProperty( tableViewImpl, &TableView::SetFixedWidth, &TableView::SetRelativeWidth, &TableView::SetFitWidth, value );
         break;
       }
     }
@@ -869,27 +960,46 @@ void TableView::OnControlChildAdd( Actor& child )
     return;
   }
 
-  RelayoutRequest();
-
   // Test properties on actor
+  HorizontalAlignment::Type horizontalAlignment = HorizontalAlignment::LEFT;
+  VerticalAlignment::Type verticalAlignment = VerticalAlignment::TOP;
+  if( child.GetPropertyIndex( CELL_HORIZONTAL_ALIGNMENT_PROPERTY_NAME ) != Property::INVALID_INDEX )
+  {
+    std::string value = child.GetProperty( child.GetPropertyIndex(CELL_HORIZONTAL_ALIGNMENT_PROPERTY_NAME) ).Get<std::string >();
+    Scripting::GetEnumeration< HorizontalAlignment::Type >( value.c_str(),
+                                                            HORIZONTAL_ALIGNMENT_STRING_TABLE,
+                                                            HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
+                                                            horizontalAlignment );
+  }
+  if( child.GetPropertyIndex( CELL_VERTICAL_ALIGNMENT_PROPERTY_NAME ) != Property::INVALID_INDEX )
+  {
+    std::string value = child.GetProperty( child.GetPropertyIndex(CELL_VERTICAL_ALIGNMENT_PROPERTY_NAME) ).Get<std::string >();
+    Scripting::GetEnumeration< VerticalAlignment::Type >( value.c_str(),
+                                                          VERTICAL_ALIGNMENT_STRING_TABLE,
+                                                          VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
+                                                          verticalAlignment );
+  }
+
+
   Toolkit::TableView::CellPosition cellPosition;
-  if( child.GetPropertyIndex(Toolkit::TableView::ROW_SPAN_PROPERTY_NAME) != Property::INVALID_INDEX )
+  if( child.GetPropertyIndex(ROW_SPAN_PROPERTY_NAME) != Property::INVALID_INDEX )
   {
-    cellPosition.rowSpan = static_cast<unsigned int>( child.GetProperty( child.GetPropertyIndex(Toolkit::TableView::ROW_SPAN_PROPERTY_NAME) ).Get<float>() );
+    cellPosition.rowSpan = static_cast<unsigned int>( child.GetProperty( child.GetPropertyIndex(ROW_SPAN_PROPERTY_NAME) ).Get<float>() );
   }
 
-  if( child.GetPropertyIndex(Toolkit::TableView::COLUMN_SPAN_PROPERTY_NAME) != Property::INVALID_INDEX )
+  if( child.GetPropertyIndex(COLUMN_SPAN_PROPERTY_NAME) != Property::INVALID_INDEX )
   {
-    cellPosition.columnSpan = static_cast<unsigned int>( child.GetProperty( child.GetPropertyIndex(Toolkit::TableView::COLUMN_SPAN_PROPERTY_NAME) ).Get<float>() );
+    cellPosition.columnSpan = static_cast<unsigned int>( child.GetProperty( child.GetPropertyIndex(COLUMN_SPAN_PROPERTY_NAME) ).Get<float>() );
   }
 
-  if( child.GetPropertyIndex(Toolkit::TableView::CELL_INDICES_PROPERTY_NAME) != Property::INVALID_INDEX )
+  if( child.GetPropertyIndex(CELL_INDEX_PROPERTY_NAME) != Property::INVALID_INDEX )
   {
-    Vector2 indices = child.GetProperty( child.GetPropertyIndex(Toolkit::TableView::CELL_INDICES_PROPERTY_NAME) ).Get<Vector2 >();
+    Vector2 indices = child.GetProperty( child.GetPropertyIndex(CELL_INDEX_PROPERTY_NAME) ).Get<Vector2 >();
     cellPosition.rowIndex = static_cast<unsigned int>( indices.x );
     cellPosition.columnIndex = static_cast<unsigned int>( indices.y );
 
     AddChild( child, cellPosition );
+    SetCellAlignment(cellPosition, horizontalAlignment, verticalAlignment);
 
     // Do not continue
     return;
@@ -909,9 +1019,12 @@ void TableView::OnControlChildAdd( Actor& child )
         data.actor = child;
         data.position.columnIndex = column;
         data.position.rowIndex = row;
+        data.horizontalAlignment = horizontalAlignment;
+        data.verticalAlignment = verticalAlignment;
         mCellData[ row ][ column ] = data;
 
         // Don't continue
+        RelayoutRequest();
         return;
       }
     }
@@ -926,7 +1039,10 @@ void TableView::OnControlChildAdd( Actor& child )
   data.actor = child;
   data.position.rowIndex = rowCount;
   data.position.columnIndex = 0;
+  data.horizontalAlignment = horizontalAlignment;
+  data.verticalAlignment = verticalAlignment;
   mCellData[ rowCount ][ 0 ] = data;
+  RelayoutRequest();
 }
 
 void TableView::OnControlChildRemove( Actor& child )
@@ -943,10 +1059,11 @@ void TableView::OnControlChildRemove( Actor& child )
 }
 
 TableView::TableView( unsigned int initialRows, unsigned int initialColumns )
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mCellData( initialRows, initialColumns ),
   mLayoutingChild( false ),
-  mRowColumnDirty( true )     // Force recalculation first time
+  mRowDirty( true ),     // Force recalculation first time
+  mColumnDirty( true )
 {
   SetKeyboardNavigationSupport( true );
   ResizeContainers( initialRows, initialColumns );
@@ -1048,18 +1165,19 @@ bool TableView::RemoveAllInstances( const Actor& child )
 void TableView::SetHeightOrWidthProperty(TableView& tableViewImpl,
                                          void(TableView::*funcFixed)(unsigned int, float),
                                          void(TableView::*funcRelative)(unsigned int, float),
+                                         void(TableView::*funcFit)(unsigned int),
                                          const Property::Value& value )
 {
   Property::Map* map = value.GetMap();
   if( map )
   {
-    unsigned int rowIndex(0);
+    unsigned int index(0);
     for ( unsigned int i = 0, count = map->Count(); i < count; ++i )
     {
       Property::Value& item = map->GetValue(i);
       Property::Map* childMap = item.GetMap();
 
-      std::istringstream( map->GetKey(i) ) >> rowIndex;
+      std::istringstream( map->GetKey(i) ) >> index;
       if( childMap )
       {
         Property::Value* policy = childMap->Find( "policy" );
@@ -1074,14 +1192,19 @@ void TableView::SetHeightOrWidthProperty(TableView& tableViewImpl,
                                                                              LAYOUT_POLICY_STRING_TABLE_COUNT,
                                                                              policy ) )
           {
-            if( policy == Toolkit::TableView::FIXED )
+            if( policy == Toolkit::TableView::FIXED  )
             {
-              (tableViewImpl.*funcFixed)( rowIndex, value->Get<float>() );
+              (tableViewImpl.*funcFixed)( index, value->Get<float>() );
             }
             else if( policy == Toolkit::TableView::RELATIVE )
             {
-              (tableViewImpl.*funcRelative)( rowIndex, value->Get<float>() );
+              (tableViewImpl.*funcRelative)( index, value->Get<float>() );
             }
+            else if( policy == Toolkit::TableView::FIT )
+            {
+              (tableViewImpl.*funcFit)( index );
+            }
+            // do nothing for FILL policy
           }
         }
       }
@@ -1105,63 +1228,56 @@ Property::Value TableView::GetColumnWidthsPropertyValue()
 
 void TableView::GetMapPropertyValue( const RowColumnArray& data, Property::Map& map )
 {
-  const char* name = Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::FIXED,
-                                                                                        LAYOUT_POLICY_STRING_TABLE,
-                                                                                        LAYOUT_POLICY_STRING_TABLE_COUNT );
-  std::string fixedPolicy;
-  if( name )
-  {
-    fixedPolicy = name;
-  }
-  name = Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::RELATIVE,
-                                                                            LAYOUT_POLICY_STRING_TABLE,
-                                                                            LAYOUT_POLICY_STRING_TABLE_COUNT );
-  std::string relativePolicy;
-  if( name )
-  {
-    relativePolicy = name;
-  }
+  const char* fixedPolicy = Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::FIXED,
+                                                                                               LAYOUT_POLICY_STRING_TABLE,
+                                                                                               LAYOUT_POLICY_STRING_TABLE_COUNT );
+  const char* relativePolicy = Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::RELATIVE,
+                                                                                                  LAYOUT_POLICY_STRING_TABLE,
+                                                                                                  LAYOUT_POLICY_STRING_TABLE_COUNT );
+  const char* fillPolicy = Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::FILL,
+                                                                                              LAYOUT_POLICY_STRING_TABLE,
+                                                                                              LAYOUT_POLICY_STRING_TABLE_COUNT );
+  const char* fitPolicy = Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::FIT,
+                                                                                             LAYOUT_POLICY_STRING_TABLE,
+                                                                                             LAYOUT_POLICY_STRING_TABLE_COUNT );
 
   const RowColumnArray::SizeType count = data.Size();
   for( RowColumnArray::SizeType i = 0; i < count; i++ )
   {
     const RowColumnData& dataInstance = data[ i ];
 
+    Property::Map item;
     switch( dataInstance.sizePolicy )
     {
-      case FIXED:
+      case Toolkit::TableView::FIXED:
       {
-        Property::Map item;
         item[ "policy" ] = fixedPolicy;
         item[ "value" ] = dataInstance.size;
-
-        std::ostringstream ss;
-        ss << i;
-
-        map[ ss.str() ] = item;
-
         break;
       }
-
-      case FILL:
+      case Toolkit::TableView::RELATIVE:
       {
-        Property::Map item;
         item[ "policy" ] = relativePolicy;
         item[ "value" ] = dataInstance.fillRatio;
-
-        std::ostringstream ss;
-        ss << i;
-
-        map[ ss.str() ] = item;
-
         break;
       }
-
+      case Toolkit::TableView::FIT:
+      {
+        item[ "policy" ] = fitPolicy;
+        item[ "value" ] = 0.f;
+        break;
+      }
+      case Toolkit::TableView::FILL:
       default:
       {
+        item[ "policy" ] = fillPolicy;
+        item[ "value" ] = 0.f;
         break;
       }
     }
+    std::ostringstream ss;
+    ss << i;
+    map[ ss.str() ] = item;
   }
 }
 
@@ -1264,76 +1380,44 @@ Vector3 TableView::GetNaturalSize()
 
 float TableView::CalculateChildSize( const Actor& child, Dimension::Type dimension )
 {
-  CalculateRowColumnData();
-
-  const unsigned int rowCount = mCellData.GetRows();
-  const unsigned int columnCount = mCellData.GetColumns();
-
-  for( unsigned int row = 0; row < rowCount; ++row )
+  Toolkit::TableView::CellPosition position;
+  if( FindChildPosition( child, position) )
   {
-    for( unsigned int column = 0; column < columnCount; ++column )
+    switch( dimension )
     {
-      // check if this cell has an actor
-      Actor& actor = mCellData[ row ][ column ].actor;
-
-      if( actor && ( actor == child ) )
+      case Dimension::WIDTH:
       {
-        const Toolkit::TableView::CellPosition position = mCellData[ row ][ column ].position;
+        float cellSize = 0.0f;
+        cellSize = mColumnData[position.columnIndex+position.columnSpan-1].position
+                 - (position.columnIndex > 0 ? mColumnData[position.columnIndex-1].position : 0.f)
+                 - mPadding.width * 2.0f;
 
-        // If there is an actor and this is the main cell of the actor.
-        // An actor can be in multiple cells if its row or columnspan is more than 1.
-        if ( ( position.rowIndex == row ) && ( position.columnIndex == column ) )
+        if( cellSize < 0.0f )
         {
-          switch( dimension )
-          {
-            case Dimension::WIDTH:
-            {
-              float cellSize = 0.0f;
-
-              // Accumulate the width
-              for( unsigned int i = 0; i < position.columnSpan; ++i )
-              {
-                DALI_ASSERT_DEBUG( column + i < mColumnData.Size() );
-                cellSize += mColumnData[ column + i ].size;
-              }
-
-              // Apply padding
-              cellSize -= mPadding.width * 2.0f;
-              if( cellSize < 0.0f )
-              {
-                cellSize = 0.0f;
-              }
-
-              return cellSize;
-            }
+          cellSize = 0.0f;
+        }
 
-            case Dimension::HEIGHT:
-            {
-              float cellSize = 0.0f;
-
-              // Accumulate the height
-              for( unsigned int i = 0; i < position.rowSpan; ++i )
-              {
-                DALI_ASSERT_DEBUG( row + i < mRowData.Size() );
-                cellSize += mRowData[ row + i ].size;
-              }
-
-              // Apply padding
-              cellSize -= mPadding.width * 2.0f;
-              if( cellSize < 0.0f )
-              {
-                cellSize = 0.0f;
-              }
-
-              return cellSize;
-            }
+        return cellSize;
+      }
 
-            default:
-            {
-              return 0.0f;
-            }
-          }
+      case Dimension::HEIGHT:
+      {
+        float cellSize = 0.0f;
+
+        cellSize = mRowData[position.rowIndex+position.rowSpan-1].position
+                 - (position.rowIndex > 0 ? mRowData[position.rowIndex-1].position : 0.f)
+                 - mPadding.height * 2.0f;
+
+        if( cellSize < 0.0f )
+        {
+          cellSize = 0.0f;
         }
+
+        return cellSize;
+      }
+      default:
+      {
+        return 0.0f;
       }
     }
   }
@@ -1372,7 +1456,7 @@ void TableView::SetCellAlignment( Toolkit::TableView::CellPosition position, Hor
   data.verticalAlignment = vertical;
 }
 
-void TableView::ComputeRelativeSizes( RowColumnArray& data )
+void TableView::CalculateFillSizes( RowColumnArray& data )
 {
   // First pass: Count number of fill entries and calculate used relative space
   Dali::Vector< RowColumnData* > fillData;
@@ -1384,16 +1468,13 @@ void TableView::ComputeRelativeSizes( RowColumnArray& data )
   {
     RowColumnData& dataInstance = data[ i ];
 
-    if( dataInstance.sizePolicy == FILL )
+    if( dataInstance.sizePolicy == Toolkit::TableView::RELATIVE )
     {
-      if( dataInstance.userFillRatio )
-      {
-        relativeTotal += dataInstance.fillRatio;
-      }
-      else
-      {
-        fillData.PushBack( &dataInstance );
-      }
+      relativeTotal += dataInstance.fillRatio;
+    }
+    else if(dataInstance.sizePolicy == Toolkit::TableView::FILL)
+    {
+      fillData.PushBack( &dataInstance );
     }
   }
 
@@ -1427,8 +1508,9 @@ float TableView::CalculateTotalFixedSize( const RowColumnArray& data )
 
     switch( dataInstance.sizePolicy )
     {
-      case FIXED:
-      case FIT:
+      // we have absolute size to FIXED and FIT column/row and relative size for RELATIVE and FILL column/row
+      case Toolkit::TableView::FIXED:
+      case Toolkit::TableView::FIT:
       {
         totalSize += dataInstance.size;
         break;
@@ -1465,7 +1547,7 @@ Vector2 TableView::GetCellPadding( Dimension::Type dimension )
   return Vector2();
 }
 
-void TableView::CalculateFixedSizes( RowColumnArray& data, Dimension::Type dimension )
+void TableView::CalculateFitSizes( RowColumnArray& data, Dimension::Type dimension )
 {
   Vector2 cellPadding = GetCellPadding( dimension );
 
@@ -1475,7 +1557,7 @@ void TableView::CalculateFixedSizes( RowColumnArray& data, Dimension::Type dimen
   {
     RowColumnData& dataInstance = data[ i ];
 
-    if( dataInstance.sizePolicy == FIT )
+    if( dataInstance.sizePolicy == Toolkit::TableView::FIT )
     {
       // Find the size of the biggest actor in the row or column
       float maxActorHeight = 0.0f;
@@ -1505,26 +1587,11 @@ void TableView::CalculateFixedSizes( RowColumnArray& data, Dimension::Type dimen
   }
 }
 
-void TableView::CalculateRelativeSizes( RowColumnArray& data, float size )
-{
-  const unsigned int dataCount = data.Size();
-
-  for( unsigned int i = 0; i < dataCount; ++i )
-  {
-    RowColumnData& dataInstance = data[ i ];
-
-    if( dataInstance.sizePolicy == FILL )
-    {
-      dataInstance.size = dataInstance.fillRatio * size;
-    }
-  }
-}
-
 bool TableView::FindFit( const RowColumnArray& data )
 {
   for( unsigned int i = 0, count = data.Size(); i < count; ++i )
   {
-    if( data[ i ].sizePolicy == FIT )
+    if( data[ i ].sizePolicy == Toolkit::TableView::FIT )
     {
       return true;
     }
index d1d8aef..2543b5e 100644 (file)
@@ -41,16 +41,6 @@ class TableView : public Control
 public:
 
   /**
-   * Enum for the size policies of rows and columns
-   */
-  enum CellSizePolicy
-  {
-    FILL,       ///< Fill up available space, may have a ratio associated with it
-    FIXED,      ///< A specific fixed width or height
-    FIT         ///< Fit around actors in the row or column
-  };
-
-  /**
    * Create a new TableView.
    * @return A smart-pointer to the newly allocated TableView.
    */
@@ -127,36 +117,24 @@ public:
   Size GetCellPadding();
 
   /**
-   * @brief Set a row policy
-   *
-   * @param[in] rowIndex The row to set the policy for
-   * @param[in] policy The policy to set
+   * @copydoc Toolkit::TableView::SetFitHeight
    */
-  void SetRowPolicy( unsigned int rowIndex, CellSizePolicy policy );
+  void SetFitHeight( unsigned int rowIndex );
 
   /**
-   * @brief Querry a row policy
-   *
-   * @param[in] rowIndex The row to querry
-   * @return Return the policy
+   * @copydoc Toolkit::TableView::IsFitHeight
    */
-  CellSizePolicy GetRowPolicy( unsigned int rowIndex ) const;
+  bool IsFitHeight( unsigned int rowIndex ) const;
 
   /**
-   * @brief Set a column policy
-   *
-   * @param[in] columnIndex The column to set the policy for
-   * @param[in] policy The policy to set
+   * @copydoc Toolkit::TableView::SetFitWidth
    */
-  void SetColumnPolicy( unsigned int columnIndex, CellSizePolicy policy );
+  void SetFitWidth( unsigned int columnIndex );
 
   /**
-   * @brief Querry a column policy
-   *
-   * @param[in] columnIndex The column to querry
-   * @return Return the policy
+   * @copydoc Toolkit::TableView::IsFitWidth
    */
-  CellSizePolicy GetColumnPolicy( unsigned int columnIndex ) const;
+  bool IsFitWidth( unsigned int columnIndex ) const;
 
   /**
    * @copydoc Toolkit::TableView::SetFixedWidth
@@ -289,7 +267,7 @@ private: // Implementation
    * Struct to hold data for rows and columns
    *
    * If sizePolicy is FIXED then size is the absolute size to use.
-   * If sizePolicy is FIT or FILL then size is the calculated value of size.
+   * If sizePolicy is FIT, RELATIVE or FILL then size is the calculated value of size.
    */
   struct RowColumnData
   {
@@ -299,8 +277,8 @@ private: // Implementation
     RowColumnData()
     : size( 0.0f ),
       fillRatio( 0.0f ),
-      sizePolicy( FILL ),
-      userFillRatio( false )
+      position( 0.0f ),
+      sizePolicy( Toolkit::TableView::FILL )
     {
     }
 
@@ -310,18 +288,18 @@ private: // Implementation
      * @param[in] newSize The size to set for this data
      * @param[in] newSizePolicy The policy used to interpret the size value
      */
-    RowColumnData( float newSize, float newFillRatio, CellSizePolicy newSizePolicy, bool newUserFillRatio )
+    RowColumnData( float newSize, float newFillRatio, Toolkit::TableView::LayoutPolicy newSizePolicy )
     : size( newSize ),
       fillRatio( newFillRatio ),
-      sizePolicy( newSizePolicy ),
-      userFillRatio( newUserFillRatio )
+      position( 0.0f ),
+      sizePolicy( newSizePolicy )
     {
     }
 
-    float size;                       ///< Set or calculated size
-    float fillRatio;                  ///< Ratio to fill remaining space
-    CellSizePolicy sizePolicy;        ///< The size policy used to interpret the size value
-    bool userFillRatio : 1;           ///< FillRatio was set by user
+    float size;                                  ///< Set or calculated size
+    float fillRatio;                             ///< Ratio to fill remaining space, only valid with RELATIVE or FILL policy
+    float position;                              ///< Position of the row/column, this value is updated during every Relayout round
+    Toolkit::TableView::LayoutPolicy sizePolicy; ///< The size policy used to interpret the size value
   };
 
   typedef Dali::Vector<RowColumnData> RowColumnArray;
@@ -387,11 +365,11 @@ private:
   bool RemoveAllInstances( const Actor& child );
 
   /**
-   * @brief Compute relative sizes for an array
+   * @brief Calculate the ratio of FILL rows/columns
    *
    * @param[in] data The RowColumn data to compute the relative sizes for
    */
-  void ComputeRelativeSizes( RowColumnArray& data );
+  void CalculateFillSizes( RowColumnArray& data );
 
   /**
    * @brief Calculate the total fixed sizes for a row or column
@@ -401,20 +379,12 @@ private:
   float CalculateTotalFixedSize( const RowColumnArray& data );
 
   /**
-   * @brief Calculate the fixed sizes for a row or column
+   * @brief Calculate the sizes of FIT rows/columns
    *
    * @param[in] data The row or column data to process
    * @param[in] dimension The dimension being calculated: row == Dimension::HEIGHT, column == Dimension::WIDTH
    */
-  void CalculateFixedSizes( RowColumnArray& data, Dimension::Type dimension );
-
-  /**
-   * @brief Calculate the value of the relative sizes
-   *
-   * @param[in] data The row or column data to process
-   * @param[in] size The size of the table view in that dimension
-   */
-  void CalculateRelativeSizes( RowColumnArray& data, float size );
+  void CalculateFitSizes( RowColumnArray& data, Dimension::Type dimension );
 
   /**
    * @brief Search for a FIT cell in the array
@@ -425,11 +395,6 @@ private:
   bool FindFit( const RowColumnArray& data );
 
   /**
-   * @brief Calculate row and column data when it is dirty
-   */
-  void CalculateRowColumnData();
-
-  /**
    * @brief Return the cell padding for a given dimension
    *
    * @param[in] dimension The dimension to return the padding for
@@ -447,13 +412,15 @@ private: // scripting support
   /**
    * Called to set the heights/widths property.
    * @param[in] tableViewImpl The object whose property is set.
-   * @param[in] funcFixed The set function to call, it can be SetFixedHeight or SetFixedWidths.
-   * @param[in] funcRelative The set function to call, it can be SetRelativeHeight or SetRelativeWidths.
+   * @param[in] funcFixed The set function to call, it can be SetFixedHeight or SetFixedWidth.
+   * @param[in] funcRelative The set function to call, it can be SetRelativeHeight or SetRelativeWidth.
+   * @param[in] funcFit The set function to call, it can be SetFitHeight or SetFiltWidth.
    * @param[in] value The new property value.
    */
   static void SetHeightOrWidthProperty( TableView& tableViewImpl,
                                         void(TableView::*funcFixed)(unsigned int, float),
                                         void(TableView::*funcRelative)(unsigned int, float),
+                                        void(TableView::*funcFit)(unsigned int),
                                         const Property::Value& map );
 
   /**
@@ -518,7 +485,7 @@ private:
 
 private: // Data
 
-  Array2d<CellData> mCellData;                ///< Data for each cell: Actor, alignment settings etc
+  Array2d<CellData> mCellData;   ///< Data for each cell: Actor, alignment settings etc
 
   RowColumnArray mRowData;       ///< Data for each row
   RowColumnArray mColumnData;    ///< Data for each column
@@ -526,7 +493,8 @@ private: // Data
 
   Size mPadding;                 ///< Padding to apply to each cell
   bool mLayoutingChild;          ///< Can't be a bitfield due to Relayouting lock
-  bool mRowColumnDirty : 1;       ///< Flag to indicate the row column data is dirty
+  bool mRowDirty : 1;            ///< Flag to indicate the row data is dirty
+  bool mColumnDirty : 1;         ///< Flag to indicate the column data is dirty
 };
 
 } // namespace Internal
index 126518d..fbe2fd5 100644 (file)
@@ -897,6 +897,7 @@ void TextField::OnInitialize()
   // Fill-parent area by default
   self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
   self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
+  self.OnStageSignal().Connect( this, &TextField::OnStageConnect );
 }
 
 void TextField::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
@@ -931,35 +932,39 @@ void TextField::OnRelayout( const Vector2& size, RelayoutContainer& container )
       mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
     }
 
-    RenderableActor renderableActor;
-    if( mRenderer )
-    {
-      renderableActor = mRenderer->Render( mController->GetView() );
-    }
-
+    RenderText();
     EnableClipping( (Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy), size );
+  }
+}
 
-    if( renderableActor != mRenderableActor )
-    {
-      UnparentAndReset( mRenderableActor );
-      mRenderableActor = renderableActor;
-    }
+void TextField::RenderText()
+{
+  Actor renderableActor;
+  if( mRenderer )
+  {
+    renderableActor = mRenderer->Render( mController->GetView(), mDepth );
+  }
 
-    if( mRenderableActor )
-    {
-      const Vector2 offset = mController->GetScrollPosition() + mController->GetAlignmentOffset();
+  if( renderableActor != mRenderableActor )
+  {
+    UnparentAndReset( mRenderableActor );
+    mRenderableActor = renderableActor;
+  }
 
-      mRenderableActor.SetPosition( offset.x, offset.y );
+  if( mRenderableActor )
+  {
+    const Vector2 offset = mController->GetScrollPosition() + mController->GetAlignmentOffset();
 
-      // Make sure the actor is parented correctly with/without clipping
-      if( mClipper )
-      {
-        mClipper->GetRootActor().Add( mRenderableActor );
-      }
-      else
-      {
-        Self().Add( mRenderableActor );
-      }
+    mRenderableActor.SetPosition( offset.x, offset.y );
+
+    // Make sure the actor is parented correctly with/without clipping
+    if( mClipper )
+    {
+      mClipper->GetRootActor().Add( mRenderableActor );
+    }
+    else
+    {
+      Self().Add( mRenderableActor );
     }
 
     for( std::vector<Actor>::const_iterator it = mClippingDecorationActors.begin(),
@@ -1001,6 +1006,13 @@ void TextField::OnKeyInputFocusGained()
     imfManager.SetRestoreAfterFocusLost( true );
   }
 
+   ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+
+   if ( notifier )
+   {
+      notifier.ContentSelectedSignal().Connect( this, &TextField::OnClipboardTextSelected );
+   }
+
   mController->KeyboardFocusGainEvent();
 
   EmitKeyInputFocusSignal( true ); // Calls back into the Control hence done last.
@@ -1024,6 +1036,13 @@ void TextField::OnKeyInputFocusLost()
     imfManager.EventReceivedSignal().Disconnect( this, &TextField::OnImfEvent );
   }
 
+  ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+
+  if ( notifier )
+  {
+    notifier.ContentSelectedSignal().Disconnect( this, &TextField::OnClipboardTextSelected );
+  }
+
   mController->KeyboardFocusLostEvent();
 
   EmitKeyInputFocusSignal( false ); // Calls back into the Control hence done last.
@@ -1090,6 +1109,18 @@ void TextField::TextChanged()
   mTextChangedSignal.Emit( handle );
 }
 
+void TextField::OnStageConnect( Dali::Actor actor )
+{
+  if ( mHasBeenStaged )
+  {
+    RenderText();
+  }
+  else
+  {
+    mHasBeenStaged = true;
+  }
+}
+
 void TextField::MaxLengthReached()
 {
   Dali::Toolkit::TextField handle( GetOwner() );
@@ -1130,6 +1161,11 @@ void TextField::EnableClipping( bool clipping, const Vector2& size )
   }
 }
 
+void TextField::OnClipboardTextSelected( ClipboardEventNotifier& clipboard )
+{
+  mController->PasteClipboardItemEvent();
+}
+
 void TextField::KeyboardStatusChanged(bool keyboardShown)
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::KeyboardStatusChanged %p keyboardShown %d\n", mController.Get(), keyboardShown );
@@ -1139,6 +1175,15 @@ void TextField::KeyboardStatusChanged(bool keyboardShown)
   {
     mController->KeyboardFocusLostEvent();
   }
+  else
+  {
+    mController->KeyboardFocusGainEvent();
+  }
+}
+
+void TextField::OnStageConnection( unsigned int depth )
+{
+  mDepth = depth;
 }
 
 bool TextField::OnTouched( Actor actor, const TouchEvent& event )
@@ -1149,7 +1194,9 @@ bool TextField::OnTouched( Actor actor, const TouchEvent& event )
 TextField::TextField()
 : Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
-  mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP )
+  mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP ),
+  mDepth( 0 ),
+  mHasBeenStaged( false )
 {
 }
 
index 876972d..eb35b4f 100644 (file)
@@ -27,6 +27,9 @@
 #include <dali-toolkit/internal/text/text-controller.h>
 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
 
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
+
 namespace Dali
 {
 
@@ -137,6 +140,11 @@ private: // From Control
   virtual void OnPan( const PanGesture& gesture );
 
   /**
+   * @copydoc Control::OnStageConnection()
+   */
+  virtual void OnStageConnection( unsigned int depth );
+
+  /**
    * @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
    */
   virtual bool OnKeyEvent(const KeyEvent& event);
@@ -166,6 +174,12 @@ private: // From Control
    */
   ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
 
+  /**
+   * @brief Callback when Clipboard signals an item should be pasted
+   * @param[in] clipboard handle to Clipboard Event Notifier
+   */
+  void OnClipboardTextSelected( ClipboardEventNotifier& clipboard );
+
 private: // Implementation
 
   /**
@@ -205,6 +219,14 @@ private: // Implementation
   TextField(const TextField&);
   TextField& operator=(const TextField& rhs);
 
+  /**
+   * @brief Render view, create and attach actor(s) to this Text Field.
+   */
+  void RenderText();
+
+  // Connection needed to re-render text, when a Text Field returns to the stage.
+  void OnStageConnect( Dali::Actor actor );
+
 private: // Data
 
   // Signals
@@ -217,10 +239,12 @@ private: // Data
   Text::ClipperPtr mClipper; ///< For EXCEED_POLICY_CLIP
   std::vector<Actor> mClippingDecorationActors;   ///< Decoration actors which need clipping.
 
-  RenderableActor mRenderableActor;
+  Actor mRenderableActor;
 
   int mRenderingBackend;
   int mExceedPolicy;
+  unsigned int mDepth;
+  bool mHasBeenStaged:1;
 };
 
 } // namespace Internal
index 77da8f9..4bbadfb 100644 (file)
@@ -453,6 +453,7 @@ void TextLabel::OnInitialize()
   // Enable the text ellipsis.
   LayoutEngine& engine = mController->GetLayoutEngine();
   engine.SetTextEllipsisEnabled( true );
+  self.OnStageSignal().Connect( this, &TextLabel::OnStageConnect );
 }
 
 void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
@@ -479,27 +480,47 @@ void TextLabel::OnRelayout( const Vector2& size, RelayoutContainer& container )
     {
       mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
     }
+    RenderText();
+  }
+}
 
-    RenderableActor renderableActor;
-    if( mRenderer )
-    {
-      renderableActor = mRenderer->Render( mController->GetView() );
-    }
+void TextLabel::RequestTextRelayout()
+{
+  RelayoutRequest();
+}
 
-    if( renderableActor != mRenderableActor )
-    {
-      UnparentAndReset( mRenderableActor );
+void TextLabel::RenderText()
+{
+  Actor renderableActor;
+  if( mRenderer )
+  {
+    renderableActor = mRenderer->Render( mController->GetView(), mDepth );
+  }
 
-      if( renderableActor )
-      {
-        const Vector2& alignmentOffset = mController->GetAlignmentOffset();
-        renderableActor.SetPosition( alignmentOffset.x, alignmentOffset.y );
+  if( renderableActor != mRenderableActor )
+  {
+    UnparentAndReset( mRenderableActor );
 
-        Self().Add( renderableActor );
-      }
+    if( renderableActor )
+    {
+      const Vector2& alignmentOffset = mController->GetAlignmentOffset();
+      renderableActor.SetPosition( alignmentOffset.x, alignmentOffset.y );
 
-      mRenderableActor = renderableActor;
+      Self().Add( renderableActor );
     }
+    mRenderableActor = renderableActor;
+  }
+}
+
+void TextLabel::OnStageConnect( Dali::Actor actor )
+{
+  if ( mHasBeenStaged )
+  {
+    RenderText();
+  }
+  else
+  {
+    mHasBeenStaged = true;
   }
 }
 
@@ -508,9 +529,9 @@ void TextLabel::AddDecoration( Actor& actor, bool needsClipping )
   // TextLabel does not show decorations
 }
 
-void TextLabel::RequestTextRelayout()
+void TextLabel::OnStageConnection( unsigned int depth )
 {
-  RelayoutRequest();
+  mDepth = depth;
 }
 
 void TextLabel::TextChanged()
@@ -525,7 +546,9 @@ void TextLabel::MaxLengthReached()
 
 TextLabel::TextLabel()
 : Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
-  mRenderingBackend( DEFAULT_RENDERING_BACKEND )
+  mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
+  mDepth( 0 ),
+  mHasBeenStaged( false )
 {
 }
 
index e45797a..0984475 100644 (file)
@@ -98,6 +98,11 @@ private: // From Control
   virtual void AddDecoration( Actor& actor, bool needsClipping );
 
   /**
+   * @copydoc Control::OnStageConnection()
+   */
+  virtual void OnStageConnection( unsigned int depth );
+
+  /**
    * @copydoc Text::ControlInterface::RequestTextRelayout()
    */
   virtual void RequestTextRelayout();
@@ -130,13 +135,22 @@ private:
   TextLabel(const TextLabel&);
   TextLabel& operator=(const TextLabel& rhs);
 
+  // Connection needed to re-render text, when a Text Label returns to the stage
+  void OnStageConnect( Dali::Actor actor );
+
+  /**
+   * @brief Render view, create and attach actor(s) to this Text Label
+   */
+  void RenderText();
+
 private: // Data
 
   Text::ControllerPtr mController;
   Text::RendererPtr mRenderer;
-  RenderableActor mRenderableActor;
-
+  Actor mRenderableActor;
   int mRenderingBackend;
+  unsigned int mDepth;
+  bool mHasBeenStaged:1;
 };
 
 } // namespace Internal
index 91ef03b..db7596a 100644 (file)
@@ -20,6 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 
@@ -576,12 +577,10 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But
    // Both containers will be added to a button.
 
    Toolkit::TableView optionContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 );
-   optionContainer.SetDrawMode( DrawMode::OVERLAY );
    optionContainer.SetFitHeight( 0 );
    optionContainer.SetFitWidth( 0 );
 
    Toolkit::TableView  optionPressedContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 );
-   optionPressedContainer.SetDrawMode( DrawMode::OVERLAY );
    optionPressedContainer.SetFitHeight( 0 );
    optionPressedContainer.SetFitWidth( 0 );
    optionPressedContainer.SetBackgroundColor( mPressedColor );
@@ -619,6 +618,8 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But
    {
      ImageActor pressedIcon = ImageActor::New(  iconImage );
      ImageActor icon = ImageActor::New(  iconImage );
+     icon.SetSortModifier( DECORATION_DEPTH_INDEX - 1 );
+     pressedIcon.SetSortModifier( DECORATION_DEPTH_INDEX - 1 );
 
      icon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
      pressedIcon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
@@ -767,8 +768,8 @@ TextSelectionPopup::TextSelectionPopup( TextSelectionPopupCallbackInterface* cal
   mPressedColor( DEFAULT_OPTION_ICON_PRESSED ),
   mSelectOptionPriority( 1 ),
   mSelectAllOptionPriority ( 2 ),
-  mCutOptionPriority ( 3 ),
-  mCopyOptionPriority ( 4 ),
+  mCutOptionPriority ( 4 ),
+  mCopyOptionPriority ( 3 ),
   mPasteOptionPriority ( 5 ),
   mClipboardOptionPriority( 6 ),
   mShowIcons( false ),
index 381cac6..1dc683b 100644 (file)
@@ -19,7 +19,7 @@
 #include "tool-bar-impl.h"
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/renderable-actor.h>
+#include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/devel-api/object/type-registry-helper.h>
index f5a9b35..807c3a2 100644 (file)
@@ -15,6 +15,7 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/alignment/alignment-impl.cpp \
    $(toolkit_src_dir)/controls/bloom-view/bloom-view-impl.cpp \
    $(toolkit_src_dir)/controls/bubble-effect/bubble-emitter-impl.cpp \
+   $(toolkit_src_dir)/controls/bubble-effect/bubble-actor.cpp \
    $(toolkit_src_dir)/controls/buttons/button-impl.cpp \
    $(toolkit_src_dir)/controls/buttons/check-box-button-impl.cpp \
    $(toolkit_src_dir)/controls/buttons/push-button-impl.cpp \
@@ -25,6 +26,7 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/popup/popup-impl.cpp \
    $(toolkit_src_dir)/controls/popup/popup-style-impl.cpp \
    $(toolkit_src_dir)/controls/page-turn-view/page-turn-portrait-view-impl.cpp \
+   $(toolkit_src_dir)/controls/page-turn-view/page-turn-effect.cpp \
    $(toolkit_src_dir)/controls/page-turn-view/page-turn-landscape-view-impl.cpp \
    $(toolkit_src_dir)/controls/page-turn-view/page-turn-view-impl.cpp \
    $(toolkit_src_dir)/controls/scroll-bar/scroll-bar-impl.cpp \
@@ -48,15 +50,13 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/text-controls/text-selection-popup-impl.cpp \
    $(toolkit_src_dir)/controls/text-controls/text-selection-toolbar-impl.cpp \
    $(toolkit_src_dir)/controls/tool-bar/tool-bar-impl.cpp \
-   $(toolkit_src_dir)/focus-manager/accessibility-focus-manager-impl.cpp \
+   $(toolkit_src_dir)/accessibility-manager/accessibility-manager-impl.cpp \
    $(toolkit_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \
    $(toolkit_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \
    $(toolkit_src_dir)/filters/blur-two-pass-filter.cpp \
    $(toolkit_src_dir)/filters/emboss-filter.cpp \
    $(toolkit_src_dir)/filters/image-filter.cpp \
    $(toolkit_src_dir)/filters/spread-filter.cpp \
-   $(toolkit_src_dir)/shader-effects/page-turn-effect-impl.cpp \
-   $(toolkit_src_dir)/shader-effects/water-effect-impl.cpp \
    $(toolkit_src_dir)/styling/style-manager-impl.cpp \
    $(toolkit_src_dir)/text/bidirectional-support.cpp \
    $(toolkit_src_dir)/text/character-set-conversion.cpp \
@@ -80,7 +80,6 @@ toolkit_src_files = \
    $(toolkit_src_dir)/text/rendering/atlas/text-atlas-renderer.cpp \
    $(toolkit_src_dir)/text/rendering/atlas/atlas-glyph-manager.cpp \
    $(toolkit_src_dir)/text/rendering/atlas/atlas-glyph-manager-impl.cpp \
-   $(toolkit_src_dir)/text/rendering/basic/text-basic-renderer.cpp \
    $(toolkit_src_dir)/text/rendering/shaders/text-basic-shader.cpp \
    $(toolkit_src_dir)/text/rendering/shaders/text-basic-shadow-shader.cpp \
    $(toolkit_src_dir)/text/rendering/shaders/text-bgra-shader.cpp \
diff --git a/dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h b/dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h
deleted file mode 100644 (file)
index fc2b114..0000000
+++ /dev/null
@@ -1,428 +0,0 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_FOCUS_MANAGER_H__
-#define __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_FOCUS_MANAGER_H__
-
-/*
- * Copyright (c) 2015 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/devel-api/common/map-wrapper.h>
-#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
-#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-class AccessibilityFocusManager;
-
-/**
- * @copydoc Toolkit::AccessibilityFocusManager
- */
-class AccessibilityFocusManager : public Dali::BaseObject, Dali::AccessibilityActionHandler, Dali::AccessibilityGestureHandler
-{
-public:
-
-  struct ActorAdditionalInfo
-  {
-    ActorAdditionalInfo()
-    : mFocusOrder(0)
-    {
-    }
-
-    unsigned int mFocusOrder; ///< The focus order of the actor. It is undefined by default.
-
-    std::string mAccessibilityAttributes[Toolkit::AccessibilityFocusManager::ACCESSIBILITY_ATTRIBUTE_NUM]; ///< The array of attribute texts
-  };
-
-  typedef std::pair<unsigned int, unsigned int>        FocusIDPair;
-  typedef std::map<unsigned int, unsigned int>         FocusIDContainer;
-  typedef FocusIDContainer::iterator                   FocusIDIter;
-  typedef FocusIDContainer::const_iterator             FocusIDConstIter;
-
-  typedef std::pair<unsigned int, ActorAdditionalInfo> IDAdditionalInfoPair;
-  typedef std::map<unsigned int, ActorAdditionalInfo>  IDAdditionalInfoContainer;
-  typedef IDAdditionalInfoContainer::iterator          IDAdditionalInfoIter;
-  typedef IDAdditionalInfoContainer::const_iterator    IDAdditionalInfoConstIter;
-
-  /**
-   * Construct a new AccessibilityFocusManager.
-   */
-  AccessibilityFocusManager();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::SetAccessibilityAttribute
-   */
-  void SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type, const std::string& text);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetAccessibilityAttribute
-   */
-  std::string GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type) const;
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::SetFocusOrder
-   */
-  void SetFocusOrder(Actor actor, const unsigned int order);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetFocusOrder
-   */
-  unsigned int GetFocusOrder(Actor actor) const;
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GenerateNewFocusOrder
-   */
-  unsigned int GenerateNewFocusOrder() const;
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetActorByFocusOrder
-   */
-  Actor GetActorByFocusOrder(const unsigned int order);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::SetCurrentFocusActor
-   */
-  bool SetCurrentFocusActor(Actor actor);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetCurrentFocusActor
-   */
-  Actor GetCurrentFocusActor();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetCurrentFocusGroup
-   */
-  Actor GetCurrentFocusGroup();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetCurrentFocusOrder
-   */
-  unsigned int GetCurrentFocusOrder();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::MoveFocusForward
-   */
-  bool MoveFocusForward();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::MoveFocusBackward
-   */
-  bool MoveFocusBackward();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::ClearFocus
-   */
-  void ClearFocus();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::Reset
-   */
-  void Reset();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::SetFocusGroup
-   */
-  void SetFocusGroup(Actor actor, bool isFocusGroup);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::IsFocusGroup
-   */
-  bool IsFocusGroup(Actor actor) const;
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::SetGroupMode
-   */
-  void SetGroupMode(bool enabled);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetGroupMode
-   */
-  bool GetGroupMode() const;
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::SetWrapMode
-   */
-  void SetWrapMode(bool wrapped);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetWrapMode
-   */
-  bool GetWrapMode() const;
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::SetFocusIndicatorActor
-   */
-  void SetFocusIndicatorActor(Actor indicator);
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetFocusIndicatorActor
-   */
-  Actor GetFocusIndicatorActor();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::GetFocusGroup
-   */
-  Actor GetFocusGroup(Actor actor);
-
-public:
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::FocusChangedSignal()
-   */
-  Toolkit::AccessibilityFocusManager::FocusChangedSignalType& FocusChangedSignal();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::FocusOvershotSignal()
-   */
-  Toolkit::AccessibilityFocusManager::FocusOvershotSignalType& FocusOvershotSignal();
-
-  /**
-   * @copydoc Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignal()
-   */
-  Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
-
-  /**
-   * Connects a callback function with the object's signals.
-   * @param[in] object The object providing the signal.
-   * @param[in] tracker Used to disconnect the signal.
-   * @param[in] signalName The signal to connect to.
-   * @param[in] functor A newly allocated FunctorDelegate.
-   * @return True if the signal was connected.
-   * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
-   */
-  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
-
-protected:
-
-  /**
-   * Destructor
-   */
-  virtual ~AccessibilityFocusManager();
-
-private:
-
-  /**
-   * Get the additional information (e.g. focus order and description) of the given actor.
-   * @param actorID The ID of the actor to be queried
-   * @return The additional information of the actor
-   */
-  ActorAdditionalInfo GetActorAdditionalInfo(const unsigned int actorID) const;
-
-  /**
-   * Synchronize the actor's additional information to reflect its latest focus order
-   * @param actorID The ID of the actor
-   * @param order The focus order of the actor
-   * @return The additional information of the actor
-   */
-  void SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order);
-
-  /**
-   * Move the focus to the specified actor and send notification for the focus change.
-   * @param actorID The ID of the actor to be queried
-   * @return Whether the focus is successful or not
-   */
-  bool DoSetCurrentFocusActor(const unsigned int actorID);
-
-  /**
-   * Move the focus to the next actor in the focus chain towards the specified direction.
-   * @param focusIDIter The iterator pointing to the current focused actor
-   * @param forward Whether the focus movement is forward or not. The focus movement will be backward if this is false.
-   * @param wrapped Whether the focus shoule be moved wrapped around or not
-   * @return Whether the focus is successful or not
-   */
-  bool DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped);
-
-  /**
-   * Activate the actor. If the actor is control, call OnActivated virtual function.
-   * This function will emit FocusedActorActivatedSignal.
-   * @param actor The actor to activate
-   */
-  void DoActivate(Actor actor);
-
-  /**
-   * Create the default indicator actor to highlight the focused actor.
-   */
-  void CreateDefaultFocusIndicatorActor();
-
-  /**
-   * Set whether the actor is focusable or not. A focusable property will be registered for
-   * the actor if not yet.
-   * @param actor The actor to be focused
-   * @param focusable Whether the actor is focusable or not
-   */
-  void SetFocusable(Actor actor, bool focusable);
-
-  /**
-   * Handle the accessibility pan gesture.
-   * @param[in]  panEvent  The pan event to be handled.
-   * @return whether the gesture is handled successfully or not.
-   */
-  virtual bool HandlePanGesture(const Integration::PanGestureEvent& panEvent);
-
-  /**
-   * Change the accessibility status when Accessibility feature(screen-reader) turned on or off.
-   * @return whether the status is changed or not.
-   */
-  virtual bool ChangeAccessibilityStatus();
-
-  /**
-   * Clear the accessibility focus from the current focused actor.
-   * @return whether the focus is cleared or not.
-   */
-  virtual bool ClearAccessibilityFocus();
-
-  /**
-   * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up).
-   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionPrevious(bool allowEndFeedback);
-
-  /**
-   * Perform the accessibility action to move focus to the next focusable actor (by one finger flick down).
-   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionNext(bool allowEndFeedback);
-
-  /**
-   * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick left).
-   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionReadPrevious(bool allowEndFeedback);
-
-  /**
-   * Perform the accessibility action to move focus to the next focusable actor (by one finger flick right).
-   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionReadNext(bool allowEndFeedback);
-
-  /**
-   * Perform the accessibility action to focus and read the actor (by one finger tap or move).
-   * @param allowReadAgain true if the action read again the same object (i.e. read action)
-   *                       false if the action just read when the focus object is changed (i.e. over action)
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionRead(bool allowReadAgain);
-
-  /**
-   * Perform the accessibility action to activate the current focused actor (by one finger double tap).
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionActivate();
-
-  /**
-   * Perform the accessibility action to change the value when the current focused actor is a slider
-   * (by double finger down and move up and right).
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionUp();
-
-  /**
-   * Perform the accessibility action to change the value when the current focused actor is a slider
-   * (by double finger down and move down and left).
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionDown();
-
-  /**
-   * Perform the accessibility action to navigate back (by two fingers circle draw).
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionBack();
-
-  /**
-   * Perform the accessibility action to mouse move (by one finger tap & hold and move).
-   * @param touchEvent touch event structure
-   * @return whether the accessibility action is performed or not.
-   */
-  virtual bool AccessibilityActionTouch(const TouchEvent& touchEvent);
-
-private:
-
-  // Undefined
-  AccessibilityFocusManager(const AccessibilityFocusManager&);
-
-  AccessibilityFocusManager& operator=(const AccessibilityFocusManager& rhs);
-
-private:
-
-  Toolkit::AccessibilityFocusManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
-  Toolkit::AccessibilityFocusManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted
-  Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
-
-  bool mIsWrapped; ///< Whether the focus movement is wrapped around or not
-  bool mIsFocusWithinGroup; ///< Whether the focus movement is limited to the current focus group or not
-
-  bool mIsEndcapFeedbackEnabled; ///< Whether the endcap feedback need to be played when the focus leaves the end or vice versa
-  bool mIsEndcapFeedbackPlayed; ///< Whether the endcap feedback was played or not
-
-  FocusIDContainer mFocusIDContainer; ///< The container to look up actor ID by focus order
-  IDAdditionalInfoContainer mIDAdditionalInfoContainer; ///< The container to look up additional information by actor ID
-
-  FocusIDPair mCurrentFocusActor; ///< The focus order and actor ID of current focused actor
-  Actor mCurrentGesturedActor; ///< The actor that will handle the gesture
-
-  Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the focusable actors for highlight
-
-  Vector2 mPreviousPosition; ///< The previous pan position; useful for calculating velocity for Gesture::Finished events
-
-  unsigned int mRecursiveFocusMoveCounter; ///< The counter to count the number of recursive focus movement attempted before the focus movement is successful.
-
-  bool mIsAccessibilityTtsEnabled; ///< Whether accessibility feature(screen-reader) turned on/off
-
-  bool mIsFocusIndicatorEnabled; ///< Whether indicator should be shown / hidden. It could be enabled when TTS enabled or 'Tab' key operated.
-};
-
-} // namespace Internal
-
-inline Internal::AccessibilityFocusManager& GetImpl(Dali::Toolkit::AccessibilityFocusManager& obj)
-{
-  DALI_ASSERT_ALWAYS(obj);
-
-  Dali::BaseObject& handle = obj.GetBaseObject();
-
-  return static_cast<Internal::AccessibilityFocusManager&>(handle);
-}
-
-inline const Internal::AccessibilityFocusManager& GetImpl(const Dali::Toolkit::AccessibilityFocusManager& obj)
-{
-  DALI_ASSERT_ALWAYS(obj);
-
-  const Dali::BaseObject& handle = obj.GetBaseObject();
-
-  return static_cast<const Internal::AccessibilityFocusManager&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_FOCUS_MANAGER_H__
index 5be38ac..0c37f7c 100644 (file)
@@ -21,7 +21,7 @@
 // EXTERNAL INCLUDES
 #include <cstring> // for strcmp
 #include <dali/public-api/actors/layer.h>
-#include <dali/devel-api/adaptor-framework/accessibility-manager.h>
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
 #include <dali/devel-api/adaptor-framework/singleton-service.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
@@ -34,7 +34,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 
 namespace Dali
@@ -81,7 +81,7 @@ DALI_TYPE_REGISTRATION_BEGIN_CREATE( Toolkit::KeyboardFocusManager, Dali::BaseHa
 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-pre-focus-change",        SIGNAL_PRE_FOCUS_CHANGE        )
 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focus-changed",           SIGNAL_FOCUS_CHANGED           )
 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focus-group-changed",     SIGNAL_FOCUS_GROUP_CHANGED     )
-DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focused-actor-activated", SIGNAL_FOCUSED_ACTOR_ACTIVATED )
+DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focused-actor-enter-key", SIGNAL_FOCUSED_ACTOR_ENTER_KEY )
 
 DALI_TYPE_REGISTRATION_END()
 
@@ -339,21 +339,21 @@ bool KeyboardFocusManager::DoMoveFocusToNextFocusGroup(bool forward)
   return succeed;
 }
 
-void KeyboardFocusManager::DoActivate(Actor actor)
+void KeyboardFocusManager::DoKeyboardEnter(Actor actor)
 {
-  if(actor)
+  if( actor )
   {
-    Toolkit::Control control = Toolkit::Control::DownCast(actor);
-    if(control)
+    Toolkit::Control control = Toolkit::Control::DownCast( actor );
+    if( control )
     {
-      // Notify the control that it is activated
-      GetImplementation( control ).AccessibilityActivate();
+      // Notify the control that enter has been pressed on it.
+      GetImplementation( control ).KeyboardEnter();
     }
 
-    // Send notification for the activation of focused actor
-    if( !mFocusedActorActivatedSignal.Empty() )
+    // Send a notification for the actor.
+    if( !mFocusedActorEnterKeySignal.Empty() )
     {
-      mFocusedActorActivatedSignal.Emit(actor);
+      mFocusedActorEnterKeySignal.Emit( actor );
     }
   }
 }
@@ -515,10 +515,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
     return;
   }
 
-  AccessibilityManager accessibilityManager = AccessibilityManager::Get();
-  bool isAccessibilityEnabled = accessibilityManager.IsEnabled();
+  AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get();
+  bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled();
 
-  Toolkit::AccessibilityFocusManager accessibilityFocusManager = Toolkit::AccessibilityFocusManager::Get();
+  Toolkit::AccessibilityManager accessibilityManager = Toolkit::AccessibilityManager::Get();
 
   std::string keyName = event.keyPressedName;
 
@@ -546,7 +546,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
       else
       {
         // Move the accessibility focus backward
-        accessibilityFocusManager.MoveFocusBackward();
+        accessibilityManager.MoveFocusBackward();
       }
     }
     else if (keyName == "Right")
@@ -567,7 +567,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
       else
       {
         // Move the accessibility focus forward
-        accessibilityFocusManager.MoveFocusForward();
+        accessibilityManager.MoveFocusForward();
       }
 
       isFocusStartableKey = true;
@@ -655,20 +655,20 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
       }
       else
       {
-        // Activate the focused actor
+        // The focused actor has enter pressed on it
         Actor actor;
-        if(!isAccessibilityEnabled)
+        if( !isAccessibilityEnabled )
         {
           actor = GetCurrentFocusActor();
         }
         else
         {
-          actor = accessibilityFocusManager.GetCurrentFocusActor();
+          actor = accessibilityManager.GetCurrentFocusActor();
         }
 
-        if(actor)
+        if( actor )
         {
-          DoActivate(actor);
+          DoKeyboardEnter( actor );
         }
       }
 
@@ -714,9 +714,9 @@ Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType& KeyboardFocusManager
   return mFocusGroupChangedSignal;
 }
 
-Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType& KeyboardFocusManager::FocusedActorActivatedSignal()
+Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType& KeyboardFocusManager::FocusedActorEnterKeySignal()
 {
-  return mFocusedActorActivatedSignal;
+  return mFocusedActorEnterKeySignal;
 }
 
 bool KeyboardFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
@@ -738,9 +738,9 @@ bool KeyboardFocusManager::DoConnectSignal( BaseObject* object, ConnectionTracke
   {
     manager->FocusGroupChangedSignal().Connect( tracker, functor );
   }
-  else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
+  else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ENTER_KEY ) )
   {
-    manager->FocusedActorActivatedSignal().Connect( tracker, functor );
+    manager->FocusedActorEnterKeySignal().Connect( tracker, functor );
   }
   else
   {
index bc456c2..de3770f 100644 (file)
@@ -125,9 +125,9 @@ public:
   Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType& FocusGroupChangedSignal();
 
   /**
-   * @copydoc Toolkit::KeyboardFocusManager::FocusedActorActivatedSignal()
+   * @copydoc Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignal()
    */
-  Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+  Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType& FocusedActorEnterKeySignal();
 
   /**
    * Connects a callback function with the object's signals.
@@ -183,11 +183,11 @@ private:
   bool DoMoveFocusToNextFocusGroup(bool forward);
 
   /**
-   * Activate the actor. If the actor is control, call OnActivated virtual function.
-   * This function will emit FocusedActorActivatedSignal.
-   * @param actor The actor to activate
+   * Enter has been pressed on the actor. If the actor is control, call the OnKeybaordEnter virtual function.
+   * This function will emit FocusedActorEnterKeySignal.
+   * @param actor The actor to notify
    */
-  void DoActivate(Actor actor);
+  void DoKeyboardEnter( Actor actor );
 
   /**
    * Create the default indicator actor to highlight the focused actor.
@@ -243,7 +243,7 @@ private:
   Toolkit::KeyboardFocusManager::PreFocusChangeSignalType mPreFocusChangeSignal; ///< The signal to notify the focus will be changed
   Toolkit::KeyboardFocusManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
   Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType mFocusGroupChangedSignal; ///< The signal to notify the focus group change
-  Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
+  Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType mFocusedActorEnterKeySignal; ///< The signal to notify that enter has been pressed on the focused actor
 
   unsigned int mCurrentFocusActor; ///< The actor ID of current focused actor
 
index 8b08f99..a84ee70 100644 (file)
@@ -36,14 +36,6 @@ namespace
 const char* PLUGIN_FILE = "libdali-script-plugin-v8.so";
 }
 
-void Script::ExecuteFile( const std::string& filename )
-{
-  if( mPlugin )
-  {
-    mPlugin->ExecuteFile(filename);
-  }
-}
-
 Script::Script(void) : mPlugin(NULL)
 {
   ScriptPluginProxy *plugin = new ScriptPluginProxy( PLUGIN_FILE );
@@ -66,6 +58,15 @@ Script::Script(void) : mPlugin(NULL)
 
 }
 
+bool Script::ExecuteFile( const std::string& filename )
+{
+  if( mPlugin )
+  {
+    return mPlugin->ExecuteFile(filename);
+  }
+  return false;
+}
+
 Script::~Script()
 {
   if( mPlugin )
index c8d9c6d..e8677b3 100644 (file)
@@ -51,7 +51,7 @@ public:
   /**
    * @copydoc Toolkit::Script::ExecuteFile
    */
-  void ExecuteFile( const std::string& filename );
+  bool ExecuteFile( const std::string& filename );
 
 protected:
 
index 1e0a6c2..0af3711 100644 (file)
@@ -57,20 +57,22 @@ void ScriptPluginProxy::SetFlags(const std::string& flags)
   }
 }
 
-void ScriptPluginProxy::ExecuteBuffer(const std::string &buffer, const std::string &filename)
+bool ScriptPluginProxy::ExecuteBuffer(const std::string &buffer, const std::string &filename)
 {
   if( mIsInitialized )
   {
-    mScriptingPlugin->ExecuteBuffer( buffer, filename );
+    return mScriptingPlugin->ExecuteBuffer( buffer, filename );
   }
+  return false;
 }
 
-void ScriptPluginProxy::ExecuteFile(const std::string &filename)
+bool ScriptPluginProxy::ExecuteFile(const std::string &filename)
 {
   if( mIsInitialized )
   {
-    mScriptingPlugin->ExecuteFile( filename );
+    return mScriptingPlugin->ExecuteFile( filename );
   }
+  return false;
 }
 
 bool ScriptPluginProxy::IsInitialized() const
@@ -78,7 +80,6 @@ bool ScriptPluginProxy::IsInitialized() const
   return mIsInitialized;
 };
 
-
 void ScriptPluginProxy::Initialize()
 {
   if( mIsInitialized )
index 05da08f..2c359c7 100644 (file)
@@ -56,18 +56,21 @@ public:
   virtual void SetFlags( const std::string& flags );
 
   /**
-   *  @brief Exececute the buffer contents as a script
+   * @brief Exececute the buffer contents as a script
    * @param [in] buffer script file contents
    * @param [in] filename a nominal name for the buffer contents.
-   * (NB filename extension may be used to disambiguate script language)
+   * @note filename extension may be used to disambiguate script language
+   * @return true on success, false on failure
+   *
    */
-  virtual void ExecuteBuffer( const std::string& buffer, const std::string& filename );
+  virtual bool ExecuteBuffer( const std::string& buffer, const std::string& filename );
 
   /**
    * @brief  execture the file as a script
    * @param [in] filename the filename to read and execute
+   * @return true on success, false on failure
    */
-  virtual void ExecuteFile( const std::string& fileName );
+  virtual bool ExecuteFile( const std::string& fileName );
 
   /**
    * @brief check if the plugin is initialized
diff --git a/dali-toolkit/internal/shader-effects/page-turn-effect-impl.cpp b/dali-toolkit/internal/shader-effects/page-turn-effect-impl.cpp
deleted file mode 100644 (file)
index 732bbf9..0000000
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (c) 2014 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 "page-turn-effect-impl.h"
-
-// EXTERNAL HEADERS
-#include <sstream>
-#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/common/stage.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace
-{
-#define MAKE_STRING(A)#A
-
-const std::string CURRENT_CENTER_PROPERTY_NAME("uCurrentCenter");
-const std::string ORIGINAL_CENTER_PROPERTY_NAME("uOriginalCenter");
-const std::string PAGE_SIZE_PROPERTY_NAME("uPageSize");
-const std::string IS_TURNING_BACK_PROPERTY_NAME("uIsTurningBack");
-const std::string SHADOW_WIDTH_PROPERTY_NAME("uShadowWidth");
-const std::string SPINE_SHADOW_PARAMETER_PROPERTY_NAME("uSpineShadowParameter");
-
-// fake shadow is used to enhance the effect, with its default maximum width to be pageSize * 0.15
-const float DEFAULT_SHADOW_WIDTH(0.15f);
-
-// the major&minor radius (in pixels) to form an ellipse shape
-// the top-left quarter of this ellipse is used to calculate spine normal for simulating shadow
-const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
-
-// when the vanishing point is very far away(pageHeight*THRESHOLD), make it infinitely, in this case, the page bent horizontally
-const float THRESHOLD(20.0);
-
-void CommonParametersConstraint( Matrix& current, const PropertyInputContainer& inputs )
-{
-  const Vector2& originalCenter = inputs[0]->GetVector2();
-  Vector2 currentCenter = inputs[1]->GetVector2();
-  const Vector2& pageSize = inputs[2]->GetVector2();
-
-  // calculate the curve direction and the vanishing point
-  // here, the vanishing point is the intersection of spine with the line passing through original center and vertical to curve direction
-  Vector2 curveDirection( currentCenter - originalCenter );
-  curveDirection.Normalize();
-  if( fabs(curveDirection.y) < 0.01f) // eliminate the possibility of division by zero in the next step
-  {
-    curveDirection.y = 0.01f;
-  }
-  float vanishingPointY = originalCenter.y + curveDirection.x * originalCenter.x / curveDirection.y;
-
-  float curveEndY, cosTheta ,sinTheta ,translateX, translateY;
-  // when the vanishing point is very far away, make it infinitely, in this case, the page bent horizontally
-  if( fabs(vanishingPointY-pageSize.y*0.5f) >= pageSize.y*THRESHOLD )
-  {
-    curveDirection = Vector2(-1.f,0.f);
-    currentCenter.y = originalCenter.y;
-
-    curveEndY = originalCenter.y;
-    cosTheta = 1.f;
-    sinTheta = 0.f;
-    translateX = currentCenter.x - originalCenter.x;
-    translateY = vanishingPointY;
-  }
-  else
-  {
-    curveEndY = currentCenter.y - curveDirection.y * (currentCenter.x/curveDirection.x) ;
-    Vector2 v1( currentCenter.x, currentCenter.y - vanishingPointY );
-    v1.Normalize();
-    Vector2 v2( originalCenter.x, originalCenter.y - vanishingPointY );
-    v2.Normalize();
-    cosTheta = v1.x*v2.x + v1.y*v2.y;
-    sinTheta = ( vanishingPointY > pageSize.y*0.5f ) ? sqrt(1.0-cosTheta*cosTheta) : -sqrt(1.0-cosTheta*cosTheta);
-    translateX = currentCenter.x - cosTheta*originalCenter.x - sinTheta*( originalCenter.y-vanishingPointY );
-    translateY = currentCenter.y + sinTheta*originalCenter.x - cosTheta*( originalCenter.y-vanishingPointY );
-  }
-
-  float originalLength = fabs(originalCenter.x/curveDirection.x);
-  float currentLength = fabs(currentCenter.x/curveDirection.x);
-  float curveHeight = 0.45f*sqrt(originalLength*originalLength - currentLength*currentLength);
-
-  float* parameterArray = current.AsFloat();
-  parameterArray[0] = cosTheta;
-  parameterArray[1] = -sinTheta;
-  parameterArray[2] = originalCenter.x;
-  parameterArray[3] = originalCenter.y;
-  parameterArray[4] = sinTheta;
-  parameterArray[5] = cosTheta;
-  parameterArray[6] = currentCenter.x;
-  parameterArray[7] = currentCenter.y;
-  parameterArray[8] = translateX;
-  parameterArray[9] = translateY;
-  parameterArray[10] = vanishingPointY;
-  parameterArray[11] = curveEndY;
-  parameterArray[12] = curveDirection.x;
-  parameterArray[13] = curveDirection.y;
-  parameterArray[14] = curveHeight;
-  parameterArray[15] = currentLength;
-}
-
-}//namespace
-
-PageTurnEffect::PageTurnEffect()
-: mOriginalCenterPropertyIndex(Property::INVALID_INDEX),
-  mCurrentCenterPropertyIndex(Property::INVALID_INDEX)
-{
-}
-
-PageTurnEffect::~PageTurnEffect()
-{
-}
-
-Toolkit::PageTurnEffect PageTurnEffect::CreateShaderEffect( bool enableBlending )
-{
-  std::string vertexShader = MAKE_STRING(
-    /*
-     * The common parameters for all the vertices, calculate in CPU then pass into the shader as uniforms
-     *
-     *  first part of the page, (outside the the line passing through original center and vertical to curve direction)
-     * no Z change, only 2D rotation and translation
-     * ([0][0],[0][1],[1][0],[1][1]) mat2 rotateMatrix
-     * ([2][0],[2][1]) vec2 translationVector
-     *
-     * ([0][2],[0][3]) vec2 originalCenter: Typically the press down position of the Pan Gesture
-     * ([1][2],[1][3]) vec2 currentCenter: Typically the current position of the Pan Gesture
-     * ([3][0],[3][1]) vec2 curveDirection: The normalized vector pointing from original center to current center
-     * ([2][2]) float vanishingPointY: The Y coordinate of the intersection of the spine
-     *                                 and the line which goes through the original center and is vertical to the curveDirection
-     * ([2][3]) float curveEndY: The Y coordinate of intersection of the spine and the line through both original and current center
-     * ([3][2]) float curveHeight: The height of the interpolated hermite curve.
-     * ([3][3]) float currentLength: The length from the current center to the curveEnd.
-     */
-    precision mediump float;\n
-    uniform mat4 uCommonParameters;\n
-    \n
-    uniform vec2 uPageSize;\n
-    uniform float uIsTurningBack;\n
-    uniform float uShadowWidth;\n
-    varying vec3 vNormal;\n
-    varying vec4 vPosition;\n
-    varying float vEdgeShadow;\n
-    \n
-    void main()\n
-    {\n
-      vec4 position = vec4( aPosition.xy, 0.0, 1.0);\n
-      vec2 currentCenter = vec2( uCommonParameters[1][2], uCommonParameters[1][3]);\n
-      vec2 originalCenter = vec2( uCommonParameters[0][2], uCommonParameters[0][3]);\n
-      vec3 normal = vec3(0.0,0.0,1.0);\n
-      \n
-      if(currentCenter.x < originalCenter.x)\n
-      {\n
-        // change the coordinate origin from the center of the page to its top-left
-        position.xy += uPageSize * 0.5;\n
-        vec2 curveDirection = vec2( uCommonParameters[3]);\n
-        vec3 vanishingPoint = vec3(0.0, uCommonParameters[2][2], 0.0);\n
-        // first part of the page, (outside the the line passing through original center and vertical to curve direction)
-        //no Z change, only 2D rotation and translation
-        if( dot(curveDirection, position.xy - originalCenter) < 0.0 )
-        {\n
-          position.y -= vanishingPoint.y;\n
-          position.xy = mat2(uCommonParameters)*position.xy + vec2( uCommonParameters[2]);\n
-        }\n
-         // second part of the page, bent as a ruled surface
-        else\n
-        {\n
-          // calculate on the flat plane, between
-          // the first line passing through current vertex and vanishing point
-          // the second line passing through original center and current center
-          vec2 curveEnd = vec2( 0.0, uCommonParameters[2][3] );\n
-          vec2 curFlatDirection = vec2(0.0,1.0);\n
-          float lengthFromCurve = position.y - originalCenter.y;\n
-          float lengthOnCurve = position.x;\n
-          if(currentCenter.y != originalCenter.y)\n
-          {\n
-            curFlatDirection = normalize(position.xy - vanishingPoint.xy);\n
-            lengthFromCurve = (curveEnd.x*curveDirection.y-curveEnd.y*curveDirection.x-position.x*curveDirection.y+position.y*curveDirection.x)
-                            / (curFlatDirection.x*curveDirection.y-curFlatDirection.y*curveDirection.x);\n
-            lengthOnCurve = length(position.xy+lengthFromCurve*curFlatDirection-curveEnd);\n
-          }\n
-          \n
-          // define the control points of hermite curve, composed with two segments
-          // calulation is carried out on the 2D plane which is passing through both current and original center and vertical to the image plane
-          float currentLength = uCommonParameters[3][3];\n
-          float originalLength =  abs(originalCenter.x/curveDirection.x);\n
-          float height = uCommonParameters[3][2];\n
-          float percentage = currentLength/originalLength;\n
-          //vec2 SegmentOneControlPoint0 = vec2(0.0, 0.0);
-          vec2 SegmentOneControlPoint1 = vec2((0.65*percentage - 0.15)*originalLength, (0.8 + 0.2 * percentage)*height); \n
-          vec2 SegmentTwoControlPoint0 = SegmentOneControlPoint1;\n
-          vec2 SegmentTwoControlPoint1 = vec2(currentLength, 0.0); \n
-          vec2 SegmentOneTangentVector0 = SegmentOneControlPoint1;\n
-          vec2 SegmentOneTangentVector1 = vec2(0.5*originalLength,0.0);\n
-          vec2 SegmentTwoTangentVector0 = SegmentOneTangentVector1;\n
-          vec2 SegmentTwoTangentVector1 = SegmentOneTangentVector1;\n
-          \n
-          // calulate the corresponding curve point position and its tangent vector
-          // it is a linear mapping onto nonlinear curves, might cause some unwanted deformation
-          // but as there are no analytical method to calculate the curve length on arbitrary segment
-          // no efficient way to solve this nonlinear mapping, Numerical approximation would cost too much computation in shader
-          vec2 curvePoint2D;\n
-          vec2 tangent;\n
-          float t0 = lengthOnCurve / originalLength;\n
-          if(t0<=0.5)\n
-          {\n
-            float t = 2.0*t0;\n
-            float t_2 = t*t;\n
-            float t_3 = t*t_2;\n
-            curvePoint2D = (-2.0*t_3+3.0*t_2)*SegmentOneControlPoint1
-                         + (t_3-2.0*t_2+t)*SegmentOneTangentVector0 + (t_3-t_2)*SegmentOneTangentVector1;\n
-            tangent = (-6.0*t_2+6.0*t)*SegmentOneControlPoint1
-                    + (3.0*t_2-4.0*t+1.0)*SegmentOneTangentVector0 + (3.0*t_2-2.0*t)*SegmentOneTangentVector1;\n
-          }\n
-          else\n
-          {\n
-            float t = 2.0*t0-1.0;\n
-            float t_2 = t*t;\n
-            float t_3 = t*t_2;\n
-            curvePoint2D = (2.0*t_3-3.0*t_2+1.0)*SegmentTwoControlPoint0 + (-2.0*t_3+3.0*t_2)*SegmentTwoControlPoint1
-                         + (t_3-2.0*t_2+t)*SegmentTwoTangentVector0 + (t_3-t_2)*SegmentTwoTangentVector1;\n
-            tangent = (6.0*t_2-6.0*t)*SegmentTwoControlPoint0 + (-6.0*t_2+6.0*t)*SegmentTwoControlPoint1
-                    + (3.0*t_2-4.0*t+1.0)*SegmentTwoTangentVector0 + (3.0*t_2-2.0*t)*SegmentTwoTangentVector1;\n
-            // a trick to eliminate some optical illusion caused by the gradient matter of normal in per-fragment shading
-            // which is caused by linear interpolation of normal vs. nonlinear lighting
-            // will notice some artifact in the areas with dramatically normal changes, so compress the normal differences here
-            tangent.y *=  min(1.0, length(position.xyz - vanishingPoint) / uPageSize.y ); \n
-          }\n
-          vec3 curvePoint = vec3(curveEnd - curvePoint2D.x*curveDirection,max(0.0,curvePoint2D.y));\n
-          vec3 tangentVector = vec3(-tangent.x*curveDirection,tangent.y);\n
-          \n
-          // locate the new vertex position on the line passing through both vanishing point and the calculated curve point position
-          vec3 curLiftDirection = vec3(0.0,-1.0,0.0);\n
-          if(currentCenter.y != originalCenter.y)\n
-          {\n
-            curLiftDirection = normalize(curvePoint - vanishingPoint);\n
-            tangentVector *= (curveDirection.y > 0.0) ? -1.0 : 1.0;\n
-          // an heuristic adjustment here, to compensate the linear parameter mapping onto the nonlinear curve
-            float Y0 = position.y - curveDirection.y * (position.x/curveDirection.x); \n
-            float proportion;
-            float refLength;\n
-            if(abs(Y0-vanishingPoint.y) > abs(curveEnd.y-vanishingPoint.y)) \n
-            {\n
-              proportion = abs(curveEnd.y - Y0) / (abs(curveEnd.y-Y0)+abs(curveEnd.y - vanishingPoint.y)); \n
-              refLength = proportion*length(originalCenter-vanishingPoint.xy) / (proportion-1.0); \n
-            }\n
-            else\n
-            {\n
-              proportion = abs(curveEnd.y - Y0) / abs(curveEnd.y - vanishingPoint.y);\n
-              refLength = proportion*length(originalCenter-vanishingPoint.xy); \n
-            }\n
-            float Y1 = currentCenter.y - (normalize(currentCenter-vanishingPoint.xy)).y * refLength; \n
-            position.y = mix(Y0, Y1, t0); \n
-          }\n
-          position.xz = curvePoint.xz - lengthFromCurve*curLiftDirection.xz;\n
-          // calculate the normal vector, will be used for lighting
-          normal = cross(curLiftDirection, normalize(tangentVector));\n
-          // the signature of Z is decided by the page turning direction:
-          // from left to right(negative); from right to left (positive)
-          position.z *= -uIsTurningBack;\n
-          normal.xy *= -uIsTurningBack;\n
-        }\n
-        // change the coordinate origin from the top-left of the page to its center
-        position.xy -= uPageSize * 0.5; \n
-      }\n
-      position.z += aPosition.z;\n
-      gl_Position = uMvpMatrix * position;\n
-     // varying parameters for fragment shader
-      vTexCoord = aTexCoord;
-      vNormal = uNormalMatrix*normal;\n
-      vPosition = uModelView * position;\n
-  );
-
-  std::string vertexShaderWithFakedShadow = MAKE_STRING(
-      // display shadow, the fake shadow value is calculated according to the height and the distance from page edge
-      vTexCoord.x = (aTexCoord.x-sTextureRect.s) /( 1.0 - uShadowWidth ) + sTextureRect.s;\n
-      vTexCoord.y = ( aTexCoord.y-sTextureRect.t-0.5*uShadowWidth*(sTextureRect.q-sTextureRect.t) )/( 1.0 - uShadowWidth ) + sTextureRect.t;\n
-      float heightCoef = (1.0 + position.z*uIsTurningBack*3.0 / uPageSize.x) * 0.6;
-      vEdgeShadow = clamp(0.9 - heightCoef, 0.0, 0.9 ); \n
-      if( vTexCoord.y >= sTextureRect.q || vTexCoord.y <= sTextureRect.t || vTexCoord.x >= sTextureRect.p  )\n
-      {\n
-        float inversedShadowWidth = (1.0-uShadowWidth) / uShadowWidth ;\n
-        float alpha1 = (vTexCoord.x-sTextureRect.p) * inversedShadowWidth / (sTextureRect.p - sTextureRect.s);\n
-        inversedShadowWidth = 2.0 * inversedShadowWidth  / (sTextureRect.q - sTextureRect.t); \n
-        float alpha2 = (vTexCoord.y-sTextureRect.q) * inversedShadowWidth;\n
-        float alpha3 = (sTextureRect.t-vTexCoord.y) * inversedShadowWidth;\n
-        float alpha;\n
-        if(alpha1 > 0.0 && alpha2 > 0.0) alpha = sqrt(alpha2*alpha2+alpha1*alpha1)/sqrt(1.0 + max(alpha1,alpha2)*max(alpha1,alpha2));\n //bottom-right corner
-        else if(alpha1 > 0.0 && alpha3 > 0.0) alpha = sqrt(alpha3*alpha3+alpha1*alpha1)/sqrt(1.0+max(alpha1,alpha3)*max(alpha1,alpha3));\n //top-right corner
-        else alpha = max(alpha1,max(alpha2,alpha3)); \n
-        alpha = 0.9 - alpha*0.9;\n
-        vEdgeShadow = clamp(alpha - heightCoef, 0.0, 0.9 ); \n
-      }\n
-  );
-
-  std::string vertexShaderEnd("}");
-
-  std::string fragmentShaderPartOne = MAKE_STRING(
-    precision mediump float;\n
-    uniform vec2 uPageSize;\n
-    uniform vec2 uSpineShadowParameter;\n
-    varying vec3 vNormal;\n
-    varying vec4 vPosition;\n
-    varying float vEdgeShadow;\n
-    \n
-    void main()\n
-    {\n
-      // need to re-normalize the interpolated normal
-      vec3 normal = normalize(vNormal);\n
-      vec4 texel;\n
-      float spineShadowCoef = 1.0; \n
-   );
-
-  std::string fragmentShaderWithFakedShadow = MAKE_STRING(
-      if( vTexCoord.y > sTextureRect.q || vTexCoord.y < sTextureRect.t || vTexCoord.x > sTextureRect.p  )\n
-         texel = vec4(0.0,0.0,0.0,vEdgeShadow);
-      else \n
-  );
-
-  std::string fragmentShaderPartTwo = MAKE_STRING(
-      { \n
-        // display page content
-        // display back image of the page, flip the texture
-        if(  dot(vPosition.xyz, normal) > 0.0 ) texel = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) );\n
-        // display front image of the page
-        else texel = texture2D( sTexture, vTexCoord );\n
-        // display book spine, a stripe of shadowed texture
-        float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageSize.x; \n
-        if(pixelPos < uSpineShadowParameter.x) \n
-        {\n
-          float x = pixelPos - uSpineShadowParameter.x;\n
-          float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x);\n
-          spineShadowCoef = normalize( vec2( uSpineShadowParameter.y*x/uSpineShadowParameter.x, y ) ).y;\n
-        }\n
-      }\n
-    // calculate the lighting
-    // set the ambient color as vec3(0.4);
-      float lightColor = abs( normal.z ) * 0.6 + 0.4;\n
-      gl_FragColor = vec4( ( spineShadowCoef* lightColor)* texel.rgb , texel.a ) * uColor;\n
-    }
-  );
-
-  // Create the implementation, temporarily owned on stack,
-  Dali::ShaderEffect shaderEffectCustom;
-  std::ostringstream vertexShaderStringStream;
-  std::ostringstream fragmentShaderStringStream;
-  if( enableBlending )
-  {
-    vertexShaderStringStream<< vertexShader << vertexShaderWithFakedShadow << vertexShaderEnd;
-    fragmentShaderStringStream<< fragmentShaderPartOne << fragmentShaderWithFakedShadow << fragmentShaderPartTwo;
-    shaderEffectCustom = Dali::ShaderEffect::New( vertexShaderStringStream.str(), fragmentShaderStringStream.str(), GeometryType( GEOMETRY_TYPE_IMAGE ),
-            ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER | ShaderEffect::HINT_BLENDING) );
-  }
-  else
-  {
-    vertexShaderStringStream<< vertexShader << vertexShaderEnd;
-    fragmentShaderStringStream<< fragmentShaderPartOne << fragmentShaderPartTwo;
-    shaderEffectCustom = Dali::ShaderEffect::New( vertexShaderStringStream.str(), fragmentShaderStringStream.str(), GeometryType( GEOMETRY_TYPE_IMAGE ),
-            ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER ) );
-  }
-
-  PageTurnEffect* shaderImpl = new PageTurnEffect();
-  Dali::Toolkit::PageTurnEffect handle = Toolkit::PageTurnEffect( shaderEffectCustom, shaderImpl );
-
-  shaderImpl->Initialize( handle );
-
-  Vector2 defaultPageSize = Dali::Stage::GetCurrent().GetSize();
-  Matrix zeroMatrix(true);
-  handle.SetUniform( "uCommonParameters", zeroMatrix );
-  handle.SetUniform( PAGE_SIZE_PROPERTY_NAME, defaultPageSize/(1.f-DEFAULT_SHADOW_WIDTH) );
-  handle.SetUniform( SHADOW_WIDTH_PROPERTY_NAME, DEFAULT_SHADOW_WIDTH );
-  handle.SetUniform( SPINE_SHADOW_PARAMETER_PROPERTY_NAME, DEFAULT_SPINE_SHADOW_PARAMETER );
-
-  shaderImpl->mOriginalCenterPropertyIndex = handle.RegisterProperty( ORIGINAL_CENTER_PROPERTY_NAME, Vector2( defaultPageSize[0], defaultPageSize[1]*0.5f ) );
-  shaderImpl->mCurrentCenterPropertyIndex = handle.RegisterProperty( CURRENT_CENTER_PROPERTY_NAME, Vector2( defaultPageSize[0], defaultPageSize[1]*0.5f ) );
-
-  shaderImpl->ApplyInternalConstraint();
-
-  // setting isTurningBack to -1.0f here means turning page forward
-  handle.SetUniform( IS_TURNING_BACK_PROPERTY_NAME, -1.0f );
-
-  return handle;
-}
-
-void PageTurnEffect::SetPageSize(const Vector2& pageSize)
-{
-  mShaderEffect.SetUniform(PAGE_SIZE_PROPERTY_NAME, pageSize);
-}
-
-void PageTurnEffect::SetOriginalCenter(const Vector2& originalCenter)
-{
-  mShaderEffect.SetProperty( mOriginalCenterPropertyIndex, originalCenter );
-}
-
-void PageTurnEffect::SetCurrentCenter(const Vector2& currentCenter)
-{
-  mShaderEffect.SetProperty( mCurrentCenterPropertyIndex, currentCenter );
-}
-
-void PageTurnEffect::SetIsTurningBack(bool isTurningBack)
-{
-  float direction = isTurningBack ? 1.0f : -1.0f;
-  mShaderEffect.SetUniform(IS_TURNING_BACK_PROPERTY_NAME, direction);
-}
-
-void PageTurnEffect::SetShadowWidth(float shadowWidth)
-{
-  mShaderEffect.SetUniform( SHADOW_WIDTH_PROPERTY_NAME, shadowWidth );
-}
-
-void PageTurnEffect::SetSpineShadowParameter(const Vector2& spineShadowParameter)
-{
-  mShaderEffect.SetUniform( SPINE_SHADOW_PARAMETER_PROPERTY_NAME, spineShadowParameter);
-}
-
-void PageTurnEffect::ApplyInternalConstraint()
-{
-  Constraint constraint = Constraint::New<Matrix>( mShaderEffect, mShaderEffect.GetPropertyIndex( "uCommonParameters" ), CommonParametersConstraint );
-  constraint.AddSource( LocalSource( mOriginalCenterPropertyIndex ) );
-  constraint.AddSource( LocalSource( mCurrentCenterPropertyIndex ) );
-  constraint.AddSource( LocalSource( mShaderEffect.GetPropertyIndex( PAGE_SIZE_PROPERTY_NAME ) ) );
-  constraint.Apply();
-}
-
-const std::string& PageTurnEffect::GetPageSizePropertyName() const
-{
-  return PAGE_SIZE_PROPERTY_NAME;
-}
-
-const std::string& PageTurnEffect::GetOriginalCenterPropertyName() const
-{
-  return ORIGINAL_CENTER_PROPERTY_NAME;
-}
-
-const std::string& PageTurnEffect::GetCurrentCenterPropertyName() const
-{
-  return CURRENT_CENTER_PROPERTY_NAME;
-}
-
-void PageTurnEffect::Initialize( Dali::ShaderEffect shaderEffect )
-{
-  // Save a reference to the shader handle
-  mShaderEffect = shaderEffect;
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/internal/shader-effects/page-turn-effect-impl.h b/dali-toolkit/internal/shader-effects/page-turn-effect-impl.h
deleted file mode 100644 (file)
index 83f6fc0..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_PAGE_TURN_EFFECT_H__
-#define __DALI_TOOLKIT_INTERNAL_PAGE_TURN_EFFECT_H__
-
-/*
- * Copyright (c) 2014 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 <dali/public-api/animation/constraint.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/shader-effects/page-turn-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-/**
- * PageTurnEffect implementation class
- */
-class PageTurnEffect : public ShaderEffect::Extension
-{
-public:
-
-  PageTurnEffect();
-  /**
-   * Virtual destructor.
-   */
-  virtual ~PageTurnEffect();
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::New
-   */
-  static Toolkit::PageTurnEffect CreateShaderEffect( bool enableBlending );
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::SetPageSize
-   */
-  void SetPageSize(const Vector2& pageSize);
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::SetOriginalCenter
-   */
-  void SetOriginalCenter(const Vector2& originalCenter);
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::SetCurrentCenter
-   */
-  void SetCurrentCenter(const Vector2& currentCenter);
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::SetIsTurningBack
-   */
-  void SetIsTurningBack(bool isTurningBack);
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::SetShadowWidth
-   */
-  void SetShadowWidth(float shadowWidth);
-
-  /**
-   *@copydoc Dali::Toolkit::PageTurnEffect::SetSpineShadowParameter
-   */
-  void SetSpineShadowParameter(const Vector2& spineShadowParameter);
-
-  /**
-   * The internal constraint uses the OriginalCenter property and the CurrentCenter Property
-   * to update the variety of common parameters which are with the same value for all the vertices.
-   * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
-   * So if there are other contraints applied to the OriginalCenter or CurrentCenter while when using this effect,
-   * call this method to get the internal constraints and re-apply it afterwards.
-   */
-  void ApplyInternalConstraint();
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::GetPageSizePropertyName
-   */
-  const std::string& GetPageSizePropertyName() const;
-
-  /**
-  * @copydoc Dali::Toolkit::PageTurnEffect::GetOriginalCenterPropertyName
-  */
-  const std::string& GetOriginalCenterPropertyName() const;
-
-  /**
-   * @copydoc Dali::Toolkit::PageTurnEffect::GetCurrentCenterPropertyName
-   */
-  const std::string& GetCurrentCenterPropertyName() const;
-
-private:
-
-  void Initialize( ShaderEffect shaderEffect );
-
-private:
-  ShaderEffect mShaderEffect;
-
-  Property::Index mOriginalCenterPropertyIndex;
-  Property::Index mCurrentCenterPropertyIndex;
-
-private:
-  //undefined copy constructor.
-  PageTurnEffect( const PageTurnEffect& );
-
-  //Undefined assignment operator.
-  PageTurnEffect& operator=( const PageTurnEffect& );
-
-};
-
-} // namespace Internal
-
-//Helpers for public-api forwarding methods
-inline Toolkit::Internal::PageTurnEffect& GetImpl( Toolkit::PageTurnEffect& effect )
-{
-  DALI_ASSERT_ALWAYS( effect );
-  return static_cast<Internal::PageTurnEffect&>( effect.GetExtension() );
-}
-
-inline const Toolkit::Internal::PageTurnEffect& GetImpl( const Toolkit::PageTurnEffect& effect )
-{
-  DALI_ASSERT_ALWAYS( effect );
-  return static_cast<const Internal::PageTurnEffect&>( effect.GetExtension() );
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif /* __DALI_TOOLKIT_INTERNAL_PAGE_TURN_EFFECT_H__*/
diff --git a/dali-toolkit/internal/shader-effects/water-effect-impl.cpp b/dali-toolkit/internal/shader-effects/water-effect-impl.cpp
deleted file mode 100644 (file)
index 9c78f32..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2014 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 "water-effect-impl.h"
-
-// EXTERNAL INCLUDES
-#include <sstream>
-#include <iomanip>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/shader-effects/water-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace
-{
-
-static const unsigned int LIGHT_MAP_SIZE = 512; ///< Size of the bitmap created for the pre-calculated wave function
-static const float MAX_WAVE_RADIUS = 80.0f;     ///< Maximum radius of the wave in percentage of the texture coordinates
-
-} // namespace
-
-WaterEffect::WaterEffect( unsigned int numberOfWaves )
-: mNumberOfWaves( numberOfWaves )
-{
-}
-
-WaterEffect::~WaterEffect()
-{
-}
-
-unsigned int WaterEffect::GetNumberOfWaves() const
-{
-  return mNumberOfWaves;
-}
-
-
-Dali::Toolkit::WaterEffect WaterEffect::CreateShaderEffect( unsigned int numberOfWaves )
-{
-  std::ostringstream vertexShaderStringStream;
-  vertexShaderStringStream << "#define NUMBER_OF_DROPS " << numberOfWaves << "\n";
-  vertexShaderStringStream << "#define MAX_WAVE_RADIUS " << std::setprecision(1) << MAX_WAVE_RADIUS << "\n";
-
-  std::string vertexShader(
-      "mediump vec4 position = vec4( aPosition, 1.0 );\n"
-      "\n"
-      "struct Drops\n"
-      "{\n"
-      "  mediump vec2 center;\n"
-      "  mediump float radius;\n"
-      "  mediump float amplitude;\n"
-      "};\n"
-      "uniform Drops uDrops[NUMBER_OF_DROPS];\n"
-      "varying mediump vec4 vColor;\n"
-      "void main()\n"
-      "{\n"
-      "  position = uModelView * position;\n"
-      "  mediump float refraction = 0.0;\n"
-      "  for (int i=0; i<NUMBER_OF_DROPS; ++i)\n"
-      "  {\n"
-      "    mediump float distance = distance( uDrops[i].center, position.xy );\n"
-      "    mediump float attenuation = clamp(distance / uDrops[i].radius, 0.0, 1.0) * 1.57;\n"
-      "    refraction += uDrops[i].amplitude * cos( (distance - uDrops[i].radius) *0.075 ) * cos(attenuation);\n"
-      "  }\n"
-      "  vColor = uColor + vec4(vec3(clamp(refraction, -0.1, 1.0)), 1.0);\n"
-      "  vTexCoord = aTexCoord + vec2( sin(refraction)/MAX_WAVE_RADIUS );\n"
-      "  gl_Position = uProjection * position;\n"
-      "}\n");
-  vertexShaderStringStream << vertexShader;
-
-  std::ostringstream fragmentShaderStringStream;
-
-  std::string fragmentShader(
-      "varying mediump vec4 vColor;\n"
-      "void main()\n"
-      "{\n"
-      "  gl_FragColor = texture2D( sTexture, vTexCoord)*vColor;\n"
-      "}\n");
-  fragmentShaderStringStream << fragmentShader;
-
-  // Create the implementation, temporarily owned on stack
-  ShaderEffect shaderEffect = ShaderEffect::New(
-      vertexShaderStringStream.str(),
-      fragmentShaderStringStream.str(),
-      GEOMETRY_TYPE_IMAGE,
-      ShaderEffect::HINT_GRID );
-
-  WaterEffect* shaderImpl = new WaterEffect( numberOfWaves );
-
-  Dali::Toolkit::WaterEffect handle = Dali::Toolkit::WaterEffect( shaderEffect, shaderImpl );
-
-  shaderImpl->Initialize( handle );
-
-  for ( unsigned int index = 0; index < shaderImpl->mNumberOfWaves; ++index )
-  {
-    handle.SetUniform( shaderImpl->GetAmplitudePropertyName( index ), 0.0f );
-    handle.SetUniform( shaderImpl->GetCenterPropertyName( index ), Vector2(0.0f, 0.0f), ShaderEffect::COORDINATE_TYPE_VIEWPORT_POSITION );
-    handle.SetUniform( shaderImpl->GetPropagationPropertyName( index ), 0.0f );
-  }
-
-  return handle;
-}
-
-void WaterEffect::SetAmplitude( unsigned int index, float amplitude )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  mShaderEffect.SetUniform( GetAmplitudePropertyName( index ), amplitude );
-}
-
-void WaterEffect::SetCenter( unsigned int index, const Vector2& center )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  mShaderEffect.SetUniform( GetCenterPropertyName( index ), center, ShaderEffect::COORDINATE_TYPE_VIEWPORT_POSITION );
-}
-
-void WaterEffect::SetPropagation( unsigned int index, float radius )
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  mShaderEffect.SetUniform( GetPropagationPropertyName( index ) , radius );
-}
-
-float WaterEffect::GetAmplitude( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  Property::Index propertyIndex = mShaderEffect.GetPropertyIndex( GetAmplitudePropertyName( index ) );
-  return mShaderEffect.GetProperty( propertyIndex ).Get<float>();
-}
-
-Vector2 WaterEffect::GetCenter( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  Property::Index propertyIndex = mShaderEffect.GetPropertyIndex( GetCenterPropertyName( index ) );
-  return mShaderEffect.GetProperty( propertyIndex ).Get<Vector2>();
-}
-
-float WaterEffect::GetPropagation( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  Property::Index propertyIndex = mShaderEffect.GetPropertyIndex( GetPropagationPropertyName( index ) );
-  return mShaderEffect.GetProperty( propertyIndex ).Get<float>();
-}
-
-std::string WaterEffect::GetAmplitudePropertyName( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  std::ostringstream oss;
-  oss << "uDrops[" << index << "].amplitude";
-  return oss.str();
-}
-
-std::string WaterEffect::GetCenterPropertyName( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  std::ostringstream oss;
-  oss << "uDrops[" << index << "].center";
-  return oss.str();
-}
-
-std::string WaterEffect::GetPropagationPropertyName( unsigned int index ) const
-{
-  DALI_ASSERT_ALWAYS( index < mNumberOfWaves );
-  std::ostringstream oss;
-  oss << "uDrops[" << index << "].radius";
-  return oss.str();
-}
-
-void WaterEffect::Initialize( Dali::ShaderEffect shaderEffect )
-{
-  // Save a reference to the shader handle
-  mShaderEffect = shaderEffect;
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/internal/shader-effects/water-effect-impl.h b/dali-toolkit/internal/shader-effects/water-effect-impl.h
deleted file mode 100644 (file)
index 2f1e5b9..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_WATER_EFFECT_H__
-#define __DALI_TOOLKIT_INTERNAL_WATER_EFFECT_H__
-
-/*
- * Copyright (c) 2014 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 <sstream>
-#include <cmath>
-#include <dali/public-api/shader-effects/shader-effect.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/shader-effects/water-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-/**
- * WaterEffect implementation class
- */
-class WaterEffect : public ShaderEffect::Extension
-{
-public:
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::WaterEffect
-   */
-  WaterEffect( unsigned int numberOfWaves );
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::~WaterEffect
-   */
-  virtual ~WaterEffect();
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::GetNumberOfWaves
-   */
-  unsigned int GetNumberOfWaves() const;
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::CreateShaderEffect
-   */
-  static Dali::Toolkit::WaterEffect CreateShaderEffect( unsigned int numberOfWaves );
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::SetAmplitude
-   */
-  void SetAmplitude( unsigned int index, float amplitude );
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::SetCenter
-   */
-  void SetCenter( unsigned int index, const Vector2& center );
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::SetPropagation
-   */
-  void SetPropagation( unsigned int index, float radius );
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::GetPropagation
-   */
-  float GetPropagation( unsigned int index ) const;
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::GetAmplitude
-   */
-  float GetAmplitude( unsigned int index ) const;
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::GetCenter
-   */
-  Vector2 GetCenter( unsigned int index ) const;
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::GetAmplitudePropertyName
-   */
-  std::string GetAmplitudePropertyName( unsigned int index ) const;
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::GetCenterPropertyName
-   */
-  std::string GetCenterPropertyName( unsigned int index ) const;
-
-  /**
-   * @copydoc Dali::Toolkit::WaterEffect::GetPropagationPropertyName
-   */
-  std::string GetPropagationPropertyName( unsigned int index ) const;
-
-private:
-
-  void Initialize( ShaderEffect shaderEffect );
-
-private:
-
-  ShaderEffect mShaderEffect;
-
-  unsigned int mNumberOfWaves;
-
-
-private:
-
-  // Undefined copy constructor.
-  WaterEffect( const WaterEffect& );
-
-  // Undefined assignment operator.
-  WaterEffect& operator=( const WaterEffect& );
-
-};
-
-} // namespace Internal
-
-inline Internal::WaterEffect& GetImpl( Toolkit::WaterEffect& waterEffect )
-{
-  return static_cast<Internal::WaterEffect&>( waterEffect.GetExtension() );
-}
-
-inline const Internal::WaterEffect& GetImpl( const Toolkit::WaterEffect& waterEffect )
-{
-  return static_cast<const Internal::WaterEffect&>( waterEffect.GetExtension() );
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_WATER_EFFECT_H__
index 02de592..cf450ef 100644 (file)
@@ -24,7 +24,6 @@
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/actors/layer.h>
-#include <dali/devel-api/actors/mesh-actor.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/common/constants.h>
 #include <dali/public-api/common/stage.h>
@@ -33,8 +32,6 @@
 #include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/events/pan-gesture.h>
 #include <dali/public-api/events/pan-gesture-detector.h>
-#include <dali/devel-api/geometry/mesh.h>
-#include <dali/devel-api/geometry/mesh-data.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/object/property-notification.h>
 #include <dali/public-api/signals/connection-tracker.h>
 
+#include <dali/devel-api/object/property-buffer.h>
+#include <dali/devel-api/rendering/geometry.h>
+#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/rendering/shader.h>
+
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 
 #endif
 
+#define MAKE_SHADER(A)#A
+
+namespace
+{
+const char* VERTEX_SHADER = MAKE_SHADER(
+attribute mediump vec2    aPosition;
+uniform   mediump mat4    uMvpMatrix;
+uniform   mediump vec3    uSize;
+
+void main()
+{
+  mediump vec4 position = vec4( aPosition, 0.0, 1.0 );
+  position.xyz *= uSize;
+  gl_Position = uMvpMatrix * position;
+}
+);
+
+const char* FRAGMENT_SHADER = MAKE_SHADER(
+uniform      lowp vec4 uColor;
+
+void main()
+{
+  gl_FragColor = uColor;
+}
+);
+}
+
 namespace Dali
 {
 namespace Internal
@@ -235,6 +266,7 @@ struct Decorator::Impl : public ConnectionTracker
     mTextSelectionPopupCallbackInterface( callbackInterface ),
     mBoundingBox( Rect<int>() ),
     mHighlightColor( LIGHT_BLUE ),
+    mHighlightPosition( Vector2::ZERO ),
     mActiveCursor( ACTIVE_CURSOR_NONE ),
     mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ),
     mCursorBlinkDuration( 0.0f ),
@@ -247,8 +279,12 @@ struct Decorator::Impl : public ConnectionTracker
     mCursorBlinkStatus( true ),
     mPrimaryCursorVisible( false ),
     mSecondaryCursorVisible( false ),
-    mSwapSelectionHandles( false )
+    mSwapSelectionHandles( false ),
+    mNotifyEndOfScroll( false )
   {
+    mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
+    mQuadIndexFormat[ "indices" ] = Property::UNSIGNED_INTEGER;
+    mHighlightMaterial = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
   }
 
   /**
@@ -269,17 +305,6 @@ struct Decorator::Impl : public ConnectionTracker
       if( mPrimaryCursorVisible )
       {
         Vector2 position = cursor.position;
-        if( GRAB_HANDLE == mHandleScrolling )
-        {
-          if( mScrollDirection == SCROLL_RIGHT )
-          {
-            position.x = 0.f;
-          }
-          else
-          {
-            position.x = size.width;
-          }
-        }
 
         mPrimaryCursor.SetPosition( position.x,
                                     position.y );
@@ -306,18 +331,6 @@ struct Decorator::Impl : public ConnectionTracker
     {
       Vector2 position = grabHandle.position;
 
-      if( GRAB_HANDLE == mHandleScrolling )
-      {
-        if( mScrollDirection == SCROLL_RIGHT )
-        {
-          position.x = 0.f;
-        }
-        else
-        {
-          position.x = size.width;
-        }
-      }
-
       const bool isVisible = ( position.x <= size.width ) && ( position.x >= 0.f );
 
       if( isVisible )
@@ -344,29 +357,6 @@ struct Decorator::Impl : public ConnectionTracker
       Vector2 primaryPosition = primary.position;
       Vector2 secondaryPosition = secondary.position;
 
-      if( LEFT_SELECTION_HANDLE == mHandleScrolling )
-      {
-        if( mScrollDirection == SCROLL_RIGHT )
-        {
-          primaryPosition.x = 0.f;
-        }
-        else
-        {
-          primaryPosition.x = size.width;
-        }
-      }
-      else if( RIGHT_SELECTION_HANDLE == mHandleScrolling )
-      {
-        if( mScrollDirection == SCROLL_RIGHT )
-        {
-          secondaryPosition.x = 0.f;
-        }
-        else
-        {
-          secondaryPosition.x = size.width;
-        }
-      }
-
       const bool isPrimaryVisible = ( primaryPosition.x <= size.width ) && ( primaryPosition.x >= 0.f );
       const bool isSecondaryVisible = ( secondaryPosition.x <= size.width ) && ( secondaryPosition.x >= 0.f );
 
@@ -391,6 +381,9 @@ struct Decorator::Impl : public ConnectionTracker
       primary.actor.SetVisible( isPrimaryVisible );
       secondary.actor.SetVisible( isSecondaryVisible );
 
+      // Shouldn't be needed......
+      UnparentAndReset( mHighlightActor );
+
       CreateHighlight();
       UpdateHighlight();
     }
@@ -398,7 +391,7 @@ struct Decorator::Impl : public ConnectionTracker
     {
       UnparentAndReset( primary.actor );
       UnparentAndReset( secondary.actor );
-      UnparentAndReset( mHighlightMeshActor );
+      UnparentAndReset( mHighlightActor );
     }
 
     if ( mActiveCopyPastePopup )
@@ -477,6 +470,7 @@ struct Decorator::Impl : public ConnectionTracker
   void CreateCursor( ImageActor& cursor, const Vector4& color )
   {
     cursor = CreateSolidColorActor( color );
+    cursor.SetSortModifier( DECORATION_DEPTH_INDEX );
     cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one.
     cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
   }
@@ -491,7 +485,7 @@ struct Decorator::Impl : public ConnectionTracker
     }
     else
     {
-      /* Create Primary and or Secondary Cursor(s) if active and add to parent */
+      // Create Primary and or Secondary Cursor(s) if active and add to parent
       if ( mActiveCursor == ACTIVE_CURSOR_PRIMARY ||
            mActiveCursor == ACTIVE_CURSOR_BOTH )
       {
@@ -590,8 +584,8 @@ struct Decorator::Impl : public ConnectionTracker
       }
 
       grabHandle.actor = ImageActor::New( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] );
+      grabHandle.actor.SetSortModifier( DECORATION_DEPTH_INDEX );
       grabHandle.actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
-      grabHandle.actor.SetDrawMode( DrawMode::OVERLAY );
       // Area that Grab handle responds to, larger than actual handle so easier to move
 #ifdef DECORATOR_DEBUG
       grabHandle.actor.SetName( "GrabHandleActor" );
@@ -642,7 +636,7 @@ struct Decorator::Impl : public ConnectionTracker
       primary.actor.SetName("SelectionHandleOne");
 #endif
       primary.actor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); // Change to BOTTOM_RIGHT if Look'n'Feel requires handle above text.
-      primary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
+      primary.actor.SetSortModifier( DECORATION_DEPTH_INDEX );
       primary.flipped = false;
 
       primary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
@@ -679,7 +673,7 @@ struct Decorator::Impl : public ConnectionTracker
       secondary.actor.SetName("SelectionHandleTwo");
 #endif
       secondary.actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Change to BOTTOM_LEFT if Look'n'Feel requires handle above text.
-      secondary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
+      secondary.actor.SetSortModifier( DECORATION_DEPTH_INDEX );
       secondary.flipped = false;
 
       secondary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
@@ -702,118 +696,92 @@ struct Decorator::Impl : public ConnectionTracker
 
   void CreateHighlight()
   {
-    if ( !mHighlightMeshActor )
+    if ( !mHighlightActor )
     {
-      mHighlightMaterial = Material::New( "HighlightMaterial" );
-      mHighlightMaterial.SetDiffuseColor( mHighlightColor );
+      mHighlightActor = Actor::New();
 
-      mHighlightMeshData.SetMaterial( mHighlightMaterial );
-      mHighlightMeshData.SetHasNormals( true );
-
-      mHighlightMesh = Mesh::New( mHighlightMeshData );
-
-      mHighlightMeshActor = MeshActor::New( mHighlightMesh );
 #ifdef DECORATOR_DEBUG
-      mHighlightMeshActor.SetName( "HighlightMeshActor" );
+      mHighlightActor.SetName( "HighlightActor" );
 #endif
-      mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+      mHighlightActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+      mHighlightActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
+      mHighlightActor.SetSize( 1.0f, 1.0f );
+      mHighlightActor.SetColor( mHighlightColor );
+      mHighlightActor.SetColorMode( USE_OWN_COLOR );
 
       // Add the highlight box telling the controller it needs clipping.
-      mController.AddDecoration( mHighlightMeshActor, true );
+      mController.AddDecoration( mHighlightActor, true );
     }
-
-    mHighlightMeshActor.SetPosition( mHighlightPosition.x, mHighlightPosition.y, DISPLAYED_HIGHLIGHT_Z_OFFSET );
   }
 
   void UpdateHighlight()
   {
-    //  Construct a Mesh with a texture to be used as the highlight 'box' for selected text
-    //
-    //  Example scenarios where mesh is made from 3, 1, 2, 2 ,3 or 3 quads.
-    //
-    //   [ TOP   ]  [ TOP ]      [TOP ]  [ TOP    ]      [ TOP  ]      [ TOP  ]
-    //  [ MIDDLE ]             [BOTTOM]  [BOTTOM]      [ MIDDLE ]   [ MIDDLE  ]
-    //  [ BOTTOM]                                      [ MIDDLE ]   [ MIDDLE  ]
-    //                                                 [BOTTOM]     [ MIDDLE  ]
-    //                                                              [BOTTOM]
-    //
-    //  Each quad is created as 2 triangles.
-    //  Middle is just 1 quad regardless of its size.
-    //
-    //  (0,0)         (0,0)
-    //     0*    *2     0*       *2
-    //     TOP          TOP
-    //     3*    *1     3*       *1
-    //  4*       *1     4*     *6
-    //     MIDDLE         BOTTOM
-    //  6*       *5     7*     *5
-    //  6*    *8
-    //   BOTTOM
-    //  9*    *7
-    //
-
-    if ( mHighlightMesh && mHighlightMaterial && !mHighlightQuadList.empty() )
+
+    if ( mHighlightActor && !mHighlightQuadList.empty() )
     {
-      MeshData::VertexContainer vertices;
-      Dali::MeshData::FaceIndices faceIndices;
+      Vector< Vector2 > vertices;
+      Vector< unsigned int> indices;
+      Vector2 vertex;
 
       std::vector<QuadCoordinates>::iterator iter = mHighlightQuadList.begin();
       std::vector<QuadCoordinates>::iterator endIter = mHighlightQuadList.end();
 
-      // vertex position defaults to (0 0 0)
-      MeshData::Vertex vertex;
-      // set normal for all vertices as (0 0 1) pointing outward from TextInput Actor.
-      vertex.nZ = 1.0f;
-
       for(std::size_t v = 0; iter != endIter; ++iter,v+=4 )
       {
-        // Add each quad geometry (a sub-selection) to the mesh data.
-
-        // 0-----1
-        // |\    |
-        // | \ A |
-        // |  \  |
-        // | B \ |
-        // |    \|
-        // 2-----3
 
         QuadCoordinates& quad = *iter;
+
         // top-left (v+0)
         vertex.x = quad.min.x;
         vertex.y = quad.min.y;
-        vertices.push_back( vertex );
+        vertices.PushBack( vertex );
 
         // top-right (v+1)
         vertex.x = quad.max.x;
         vertex.y = quad.min.y;
-        vertices.push_back( vertex );
+        vertices.PushBack( vertex );
 
         // bottom-left (v+2)
         vertex.x = quad.min.x;
         vertex.y = quad.max.y;
-        vertices.push_back( vertex );
+        vertices.PushBack( vertex );
 
         // bottom-right (v+3)
         vertex.x = quad.max.x;
         vertex.y = quad.max.y;
-        vertices.push_back( vertex );
+        vertices.PushBack( vertex );
 
         // triangle A (3, 1, 0)
-        faceIndices.push_back( v + 3 );
-        faceIndices.push_back( v + 1 );
-        faceIndices.push_back( v );
+        indices.PushBack( v + 3 );
+        indices.PushBack( v + 1 );
+        indices.PushBack( v );
 
         // triangle B (0, 2, 3)
-        faceIndices.push_back( v );
-        faceIndices.push_back( v + 2 );
-        faceIndices.push_back( v + 3 );
-
-        mHighlightMeshData.SetFaceIndices( faceIndices );
+        indices.PushBack( v );
+        indices.PushBack( v + 2 );
+        indices.PushBack( v + 3 );
       }
 
-      BoneContainer bones(0); // passed empty as bones not required
-      mHighlightMeshData.SetData( vertices, faceIndices, bones, mHighlightMaterial );
-      mHighlightMesh.UpdateMeshData( mHighlightMeshData );
+      PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, vertices.Size() );
+      PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, indices.Size() );
+
+      quadVertices.SetData( &vertices[ 0 ] );
+      quadIndices.SetData( &indices[ 0 ] );
+
+      Geometry quadGeometry = Geometry::New();
+      quadGeometry.AddVertexBuffer( quadVertices );
+      quadGeometry.SetIndexBuffer( quadIndices );
+
+ //     if ( mHighlightRenderer )
+ //     {
+ //       mHighlightRenderer.SetGeometry( quadGeometry );
+ //     }
+ //     else
+ //     {
+        mHighlightRenderer = Dali::Renderer::New( quadGeometry, mHighlightMaterial );
+        mHighlightRenderer.SetDepthIndex( DECORATION_DEPTH_INDEX - 1 );
+ //     }
+      mHighlightActor.AddRenderer( mHighlightRenderer );
     }
   }
 
@@ -866,8 +834,10 @@ struct Decorator::Impl : public ConnectionTracker
     else if( Gesture::Finished  == gesture.state ||
              Gesture::Cancelled == gesture.state )
     {
-      if( mScrollTimer && mScrollTimer.IsRunning() )
+      if( mScrollTimer &&
+          ( mScrollTimer.IsRunning() || mNotifyEndOfScroll ) )
       {
+        mNotifyEndOfScroll = false;
         mHandleScrolling = HANDLE_TYPE_COUNT;
         StopScrollTimer();
         mController.DecorationEvent( type, HANDLE_STOP_SCROLLING, x, y );
@@ -933,7 +903,8 @@ struct Decorator::Impl : public ConnectionTracker
           mHandle[GRAB_HANDLE].actor.SetImage( imagePressed );
         }
       }
-      else if( TouchPoint::Up == point.state )
+      else if( ( TouchPoint::Up == point.state ) ||
+               ( TouchPoint::Interrupted == point.state ) )
       {
         mHandle[GRAB_HANDLE].pressed = false;
         Image imageReleased = mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED];
@@ -966,7 +937,8 @@ struct Decorator::Impl : public ConnectionTracker
           mHandle[LEFT_SELECTION_HANDLE].actor.SetImage( imagePressed );
         }
       }
-      else if( TouchPoint::Up == point.state )
+      else if( ( TouchPoint::Up == point.state ) ||
+               ( TouchPoint::Interrupted == point.state ) )
       {
         mHandle[LEFT_SELECTION_HANDLE].pressed = false;
         Image imageReleased = mHandleImages[flip ? RIGHT_SELECTION_HANDLE : LEFT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED];
@@ -999,7 +971,8 @@ struct Decorator::Impl : public ConnectionTracker
           mHandle[RIGHT_SELECTION_HANDLE].actor.SetImage( imagePressed );
         }
       }
-      else if( TouchPoint::Up == point.state )
+      else if( ( TouchPoint::Up == point.state ) ||
+               ( TouchPoint::Interrupted == point.state ) )
       {
         Image imageReleased = mHandleImages[flip ? LEFT_SELECTION_HANDLE : RIGHT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED];
         mHandle[RIGHT_SELECTION_HANDLE].pressed = false;
@@ -1155,6 +1128,16 @@ struct Decorator::Impl : public ConnectionTracker
     return mScrollSpeed;
   }
 
+  void NotifyEndOfScroll()
+  {
+    StopScrollTimer();
+
+    if( mScrollTimer )
+    {
+      mNotifyEndOfScroll = true;
+    }
+  }
+
   /**
    * Creates and starts a timer to scroll the text when handles are close to the edges of the text.
    *
@@ -1213,25 +1196,26 @@ struct Decorator::Impl : public ConnectionTracker
   Layer               mActiveLayer;               ///< Layer for active handles and alike that ensures they are above all else.
   ImageActor          mPrimaryCursor;
   ImageActor          mSecondaryCursor;
-  MeshActor           mHighlightMeshActor;        ///< Mesh Actor to display highlight
 
+  Actor               mHighlightActor;        ///< Actor to display highlight
+  Renderer            mHighlightRenderer;
+  Material            mHighlightMaterial;         ///< Material used for highlight
+  Property::Map       mQuadVertexFormat;
+  Property::Map       mQuadIndexFormat;
   PopupImpl           mCopyPastePopup;
   TextSelectionPopup::Buttons mEnabledPopupButtons; /// Bit mask of currently enabled Popup buttons
   TextSelectionPopupCallbackInterface& mTextSelectionPopupCallbackInterface;
 
   Image               mHandleImages[HANDLE_TYPE_COUNT][HANDLE_IMAGE_TYPE_COUNT];
   Image               mCursorImage;
-  Mesh                mHighlightMesh;             ///< Mesh for highlight
-  MeshData            mHighlightMeshData;         ///< Mesh Data for highlight
-  Material            mHighlightMaterial;         ///< Material used for highlight
 
   CursorImpl          mCursor[CURSOR_COUNT];
   HandleImpl          mHandle[HANDLE_TYPE_COUNT];
   QuadContainer       mHighlightQuadList;         ///< Sub-selections that combine to create the complete selection highlight
-  Vector2             mHighlightPosition;         ///< The position of the highlight actor.
 
   Rect<int>           mBoundingBox;
   Vector4             mHighlightColor;            ///< Color of the highlight
+  Vector2             mHighlightPosition;         ///< The position of the highlight actor.
 
   unsigned int        mActiveCursor;
   unsigned int        mCursorBlinkInterval;
@@ -1241,13 +1225,13 @@ struct Decorator::Impl : public ConnectionTracker
   float               mScrollThreshold;         ///< Defines a square area inside the control, close to the edge. A cursor entering this area will trigger scroll events.
   float               mScrollSpeed;             ///< The scroll speed in pixels per second.
   float               mScrollDistance;          ///< Distance the text scrolls during a scroll interval.
-  unsigned int        mScrollInterval;          ///< Time in milliseconds of a scroll interval.
 
   bool                mActiveCopyPastePopup   : 1;
   bool                mCursorBlinkStatus      : 1; ///< Flag to switch between blink on and blink off.
   bool                mPrimaryCursorVisible   : 1; ///< Whether the primary cursor is visible.
   bool                mSecondaryCursorVisible : 1; ///< Whether the secondary cursor is visible.
   bool                mSwapSelectionHandles   : 1; ///< Whether to swap the selection handle images.
+  bool                mNotifyEndOfScroll      : 1; ///< Whether to notify the end of the scroll.
 };
 
 DecoratorPtr Decorator::New( ControllerInterface& controller,
@@ -1367,6 +1351,20 @@ float Decorator::GetCursorBlinkDuration() const
 void Decorator::SetHandleActive( HandleType handleType, bool active )
 {
   mImpl->mHandle[handleType].active = active;
+
+  if( !active )
+  {
+    // TODO: this is a work-around.
+    // The problem is the handle actor does not receive the touch event with the Interrupt
+    // state when the power button is pressed and the application goes to background.
+    mImpl->mHandle[handleType].pressed = false;
+    Image imageReleased = mImpl->mHandleImages[handleType][HANDLE_IMAGE_RELEASED];
+    ImageActor imageActor = mImpl->mHandle[handleType].actor;
+    if( imageReleased && imageActor )
+    {
+       imageActor.SetImage( imageReleased );
+    }
+  }
 }
 
 bool Decorator::IsHandleActive( HandleType handleType ) const
@@ -1481,6 +1479,11 @@ float Decorator::GetScrollSpeed() const
   return mImpl->GetScrollSpeed();
 }
 
+void Decorator::NotifyEndOfScroll()
+{
+  mImpl->NotifyEndOfScroll();
+}
+
 Decorator::~Decorator()
 {
   delete mImpl;
index 893d981..f38c467 100644 (file)
@@ -467,18 +467,9 @@ public:
   float GetScrollSpeed() const;
 
   /**
-   * @brief Sets the scroll interval.
-   *
-   * @param[in] seconds The scroll interval in seconds.
-   */
-  void SetScrollTickInterval( float seconds );
-
-  /**
-   * @brief Retrieves the scroll interval.
-   *
-   * @return The scroll interval.
+   * @brief Notifies the decorator the whole text has been scrolled.
    */
-  float GetScrollTickInterval() const;
+  void NotifyEndOfScroll();
 
 protected:
 
index d7fde4e..fea111d 100644 (file)
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/common/stage.h>
 
+#define MAKE_SHADER(A)#A
+
+namespace
+{
+const char* VERTEX_SHADER = MAKE_SHADER(
+attribute mediump vec2    aPosition;
+attribute mediump vec2    aTexCoord;
+uniform   mediump mat4    uMvpMatrix;
+uniform   mediump vec3    uSize;
+varying   mediump vec2    vTexCoord;
+
+void main()
+{
+  mediump vec4 position = vec4( aPosition, 0.0, 1.0 );
+  position.xyz *= uSize;
+  gl_Position = uMvpMatrix * position;
+  vTexCoord = aTexCoord;
+}
+);
+
+const char* FRAGMENT_SHADER = MAKE_SHADER(
+uniform         sampler2D sTexture;
+varying mediump vec2      vTexCoord;
+
+void main()
+{
+  gl_FragColor = texture2D( sTexture, vTexCoord );
+}
+);
+
+const char* VERTEX_SHADER_SHADOW = MAKE_SHADER(
+attribute mediump vec2    aPosition;
+attribute mediump vec2    aTexCoord;
+uniform   mediump vec3    uSize;
+varying   mediump vec2    vTexCoord;
+
+void main()
+{
+  mediump vec4 position = vec4( aPosition, 0.0, 1.0 );
+  position.xyz *= uSize;
+  gl_Position = position;
+  vTexCoord = aTexCoord;
+}
+);
+
+const char* FRAGMENT_SHADER_SHADOW = MAKE_SHADER(
+uniform         sampler2D sTexture;
+uniform lowp    vec4      uColor;
+varying mediump vec2      vTexCoord;
+
+void main()
+{
+  mediump vec4 color = texture2D( sTexture, vTexCoord );
+  gl_FragColor = vec4(uColor.rgb, uColor.a*color.r);
+}
+);
+}
+
 namespace Dali
 {
 
@@ -30,12 +88,11 @@ namespace Toolkit
 namespace Internal
 {
 
-//#define DISPLAY_ATLAS
-
 AtlasGlyphManager::AtlasGlyphManager()
-: mCount( 0 )
 {
   mAtlasManager = Dali::Toolkit::AtlasManager::New();
+  mEffectBufferShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
+  mShadowShader = Shader::New( VERTEX_SHADER_SHADOW, FRAGMENT_SHADER_SHADOW, Dali::Shader::HINT_MODIFIES_GEOMETRY );
 }
 
 AtlasGlyphManager::~AtlasGlyphManager()
@@ -93,36 +150,18 @@ void AtlasGlyphManager::Add( Text::FontId fontId,
     fontGlyphRecord.mGlyphRecords.PushBack( record );
     mFontGlyphRecords.push_back( fontGlyphRecord );
   }
-
-#ifdef DISPLAY_ATLAS
-  {
-    uint32_t atlasCount = mAtlasManager.GetAtlasCount();
-    if ( atlasCount > mCount )
-    {
-      for ( uint32_t i = 0; i < atlasCount; ++i )
-      {
-        ImageActor actor = ImageActor::New( mAtlasManager.GetAtlasContainer( i + 1u ) );
-        actor.SetParentOrigin( Vector3( 0.5f, 0.25f + ( static_cast< float >( i ) * 0.25f ), 0.5f ) );
-        actor.SetAnchorPoint( AnchorPoint::CENTER );
-        actor.SetSize( 256.0f, 256.0f );
-        Stage::GetCurrent().Add( actor );
-      }
-    }
-    mCount = atlasCount;
-  }
-#endif
 }
 
 void AtlasGlyphManager::GenerateMeshData( uint32_t imageId,
                                           const Vector2& position,
-                                          MeshData& meshData )
+                                          Toolkit::AtlasManager::Mesh2D& mesh )
 {
   // Generate mesh data and tell Atlas Manager not to handle reference counting ( we'll do it )
-  mAtlasManager.GenerateMeshData( imageId, position, meshData, false );
+  mAtlasManager.GenerateMeshData( imageId, position, mesh, false );
 }
 
-void AtlasGlyphManager::StitchMesh( MeshData& first,
-                                    const MeshData& second )
+void AtlasGlyphManager::StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
+                                    const Toolkit::AtlasManager::Mesh2D& second )
 {
   mAtlasManager.StitchMesh( first, second );
 }
@@ -209,6 +248,16 @@ void AtlasGlyphManager::AdjustReferenceCount( Text::FontId fontId, uint32_t imag
   }
 }
 
+Material AtlasGlyphManager::GetMaterial( uint32_t atlasId ) const
+{
+  return mAtlasManager.GetMaterial( atlasId );
+}
+
+Sampler AtlasGlyphManager::GetSampler( uint32_t atlasId ) const
+{
+  return mAtlasManager.GetSampler( atlasId );
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index 5008106..9fe8ead 100644 (file)
@@ -84,13 +84,13 @@ public:
    */
   void GenerateMeshData( uint32_t imageId,
                          const Vector2& position,
-                         MeshData& meshData );
+                         Toolkit::AtlasManager::Mesh2D& mesh );
 
   /**
    * @copydoc Toolkit::AtlasGlyphManager::StitchMesh
    */
-  void StitchMesh( MeshData& first,
-                   const MeshData& second );
+  void StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
+                   const Toolkit::AtlasManager::Mesh2D& second );
 
   /**
    * @copydoc Toolkit::AtlasGlyphManager::Cached
@@ -110,26 +110,53 @@ public:
   void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
 
   /**
-   * @copydoc toolkit::AtlasGlyphManager::GetPixelFormat
+   * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
    */
   Pixel::Format GetPixelFormat( uint32_t atlasId );
 
   /**
-   * @copydoc toolkit::AtlasGlyphManager::GetMetrics
+   * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
+   */
+  void AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta );
+
+  /**
+   * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
+   */
+  Material GetMaterial( uint32_t atlasId ) const;
+
+  /**
+   * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
+   */
+  Sampler GetSampler( uint32_t atlasId ) const;
+
+  /**
+   * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
    */
   const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
 
   /**
-   * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
+   * @copydoc Toolkit::AtlasGlyphManager::GetEffectBufferShader
    */
-  void AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta );
+  Shader GetEffectBufferShader() const
+  {
+    return mEffectBufferShader;
+  }
+
+  /**
+   * @copydoc Toolkit::AtlasGlyphManager::GetGlyphShadowShader
+   */
+  Shader GetGlyphShadowShader() const
+  {
+    return mShadowShader;
+  }
 
 private:
 
-  Dali::Toolkit::AtlasManager mAtlasManager;
+  Dali::Toolkit::AtlasManager mAtlasManager;          ///> Atlas Manager created by GlyphManager
   std::vector< FontGlyphRecord > mFontGlyphRecords;
-  uint32_t mCount;
-  Toolkit::AtlasGlyphManager::Metrics mMetrics;
+  Toolkit::AtlasGlyphManager::Metrics mMetrics;       ///> Metrics to pass back on GlyphManager status
+  Shader mEffectBufferShader;                         ///> Shader used to render drop shadow buffer textures
+  Shader mShadowShader;                               ///> Shader used to render drop shadow into buffer
 };
 
 } // namespace Internal
@@ -157,4 +184,4 @@ inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager
 } // namespace Dali
 
 
- #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
\ No newline at end of file
+ #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
index 0438314..304a531 100644 (file)
@@ -79,15 +79,15 @@ void AtlasGlyphManager::Add( Text::FontId fontId,
 
 void AtlasGlyphManager::GenerateMeshData( uint32_t imageId,
                                           const Vector2& position,
-                                          MeshData& meshData )
+                                          Toolkit::AtlasManager::Mesh2D& mesh )
 {
   GetImplementation(*this).GenerateMeshData( imageId,
                                              position,
-                                             meshData );
+                                             mesh );
 }
 
-void AtlasGlyphManager::StitchMesh( MeshData& first,
-                                    const MeshData& second )
+void AtlasGlyphManager::StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
+                                    const Toolkit::AtlasManager::Mesh2D& second )
 {
   GetImplementation(*this).StitchMesh( first, second );
 }
@@ -114,6 +114,16 @@ Pixel::Format AtlasGlyphManager::GetPixelFormat( uint32_t atlasId )
   return GetImplementation(*this).GetPixelFormat( atlasId );
 }
 
+Material AtlasGlyphManager::GetMaterial( uint32_t atlasId ) const
+{
+  return GetImplementation(*this).GetMaterial( atlasId );
+}
+
+Sampler AtlasGlyphManager::GetSampler( uint32_t atlasId ) const
+{
+  return GetImplementation(*this).GetSampler( atlasId );
+}
+
 const Toolkit::AtlasGlyphManager::Metrics& AtlasGlyphManager::GetMetrics()
 {
   return GetImplementation(*this).GetMetrics();
@@ -124,6 +134,16 @@ void AtlasGlyphManager::AdjustReferenceCount( Text::FontId fontId, uint32_t imag
   GetImplementation(*this).AdjustReferenceCount( fontId, imageId, delta );
 }
 
+Shader AtlasGlyphManager::GetEffectBufferShader() const
+{
+  return GetImplementation(*this).GetEffectBufferShader();
+}
+
+Shader AtlasGlyphManager::GetGlyphShadowShader() const
+{
+  return GetImplementation(*this).GetGlyphShadowShader();
+}
+
 } // namespace Toolkit
 
 } // namespace Dali
index fdc4141..cda8fb6 100644 (file)
@@ -90,7 +90,7 @@ public:
    */
   void GenerateMeshData( uint32_t imageId,
                          const Vector2& position,
-                         MeshData& meshData );
+                         Toolkit::AtlasManager::Mesh2D& mesh );
 
   /**
    * @brief Stitch Two Meshes together
@@ -98,8 +98,8 @@ public:
    * @param[in] first first mesh
    * @param[in] second second mesh
    */
-  void StitchMesh( MeshData& first,
-                   const MeshData& second );
+  void StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
+                   const Toolkit::AtlasManager::Mesh2D& second );
 
   /**
    * @brief Check to see if a glyph is being cached
@@ -143,6 +143,24 @@ public:
   Pixel::Format GetPixelFormat( uint32_t atlasId );
 
   /**
+   * @brief Get the material used by an atlas
+   *
+   * @param[in] atlasId Id of an atlas
+   *
+   * @return The material used by the atlas
+   */
+  Material GetMaterial( uint32_t atlasId ) const;
+
+  /**
+   * @brief Get the sampler used by an atlas
+   *
+   * @param[in] atlasId Id of an atlas
+   *
+   * @return The sampler used by the atlas
+   */
+  Sampler GetSampler( uint32_t atlasId ) const;
+
+  /**
    * @brief Get Glyph Manager metrics
    *
    * @return const reference to glyph manager metrics
@@ -158,6 +176,20 @@ public:
    */
   void AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta );
 
+  /**
+   * @brief Get Shader used for rendering glyph effect buffers
+   *
+   * @return Handle of shader needed
+   */
+  Shader GetEffectBufferShader() const;
+
+  /**
+   * @brief Get Shader used rendering Glyph Shadows
+   *
+   * @return Handle of shader needed
+   */
+  Shader GetGlyphShadowShader() const;
+
 private:
 
   explicit DALI_INTERNAL AtlasGlyphManager(Internal::AtlasGlyphManager *impl);
index 5eca29d..457959f 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/dali.h>
-#include <dali/integration-api/debug.h>
+#include <dali/devel-api/object/property-buffer.h>
+#include <dali/devel-api/rendering/geometry.h>
+#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/rendering/sampler.h>
+#include <dali/devel-api/rendering/shader.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
-#include <dali/devel-api/actors/mesh-actor.h>
-#include <dali/devel-api/geometry/mesh.h>
-
-
+#include <dali/integration-api/debug.h>
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/atlas-manager/atlas-manager.h>
-#include <dali-toolkit/internal/text/line-run.h>
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
-#include <dali-toolkit/internal/text/rendering/shaders/text-basic-shader.h>
-#include <dali-toolkit/internal/text/rendering/shaders/text-bgra-shader.h>
-#include <dali-toolkit/internal/text/rendering/shaders/text-basic-shadow-shader.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -44,14 +41,13 @@ namespace
   Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
 #endif
 
-  const float ZERO( 0.0f );
-  const float HALF( 0.5f );
-  const float ONE( 1.0f );
-  const float TWO( 2.0f );
-  const uint32_t DEFAULT_ATLAS_WIDTH = 512u;
-  const uint32_t DEFAULT_ATLAS_HEIGHT = 512u;
+const float ZERO( 0.0f );
+const float HALF( 0.5f );
+const float ONE( 1.0f );
+const float TWO( 2.0f );
+const uint32_t DEFAULT_ATLAS_WIDTH = 512u;
+const uint32_t DEFAULT_ATLAS_HEIGHT = 512u;
 }
-
 struct AtlasRenderer::Impl : public ConnectionTracker
 {
 
@@ -65,7 +61,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
   {
     Vector4 mColor;
     uint32_t mAtlasId;
-    MeshData mMeshData;
+    AtlasManager::Mesh2D mMesh;
     FrameBufferImage mBuffer;
     bool mIsUnderline;
   };
@@ -104,13 +100,10 @@ struct AtlasRenderer::Impl : public ConnectionTracker
   {
     mGlyphManager = AtlasGlyphManager::Get();
     mFontClient = TextAbstraction::FontClient::Get();
-    mBasicShader = BasicShader::New();
-    mBgraShader = BgraShader::New();
-    mBasicShadowShader = BasicShadowShader::New();
 
-    mFace.reserve( 6u );
-    mFace.push_back( 0 ); mFace.push_back( 2u ); mFace.push_back( 1u );
-    mFace.push_back( 1u ); mFace.push_back( 2u ); mFace.push_back( 3u );
+    mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
+    mQuadVertexFormat[ "aTexCoord" ] = Property::VECTOR2;
+    mQuadIndexFormat[ "indices" ] = Property::UNSIGNED_INTEGER;
   }
 
   void AddGlyphs( const std::vector<Vector2>& positions,
@@ -120,12 +113,14 @@ struct AtlasRenderer::Impl : public ConnectionTracker
                   const Vector4& shadowColor,
                   bool underlineEnabled,
                   const Vector4& underlineColor,
-                  float underlineHeight )
+                  float underlineHeight,
+                  unsigned int depth )
   {
     AtlasManager::AtlasSlot slot;
     std::vector< MeshRecord > meshContainer;
     Vector< Extent > extents;
     TextCacheEntry textCacheEntry;
+    mDepth = static_cast< int >( depth );
 
     float currentUnderlinePosition = ZERO;
     float currentUnderlineThickness = underlineHeight;
@@ -190,7 +185,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
         }
 
         const Vector2& position = positions[ i ];
-        MeshData newMeshData;
+        AtlasManager::Mesh2D newMesh;
 
         if ( !mGlyphManager.Cached( glyph.fontId, glyph.index, slot ) )
         {
@@ -241,7 +236,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
         }
 
         // Generate mesh data for this quad, plugging in our supplied position
-        mGlyphManager.GenerateMeshData( slot.mImageId, position, newMeshData );
+        mGlyphManager.GenerateMeshData( slot.mImageId, position, newMesh );
         textCacheEntry.mFontId = glyph.fontId;
         textCacheEntry.mImageId = slot.mImageId;
         textCacheEntry.mIndex = glyph.index;
@@ -249,14 +244,14 @@ struct AtlasRenderer::Impl : public ConnectionTracker
 
         // Find an existing mesh data object to attach to ( or create a new one, if we can't find one using the same atlas)
         StitchTextMesh( meshContainer,
-                        newMeshData,
+                        newMesh,
                         extents,
                         textColor,
                         position.y + glyph.yBearing,
                         currentUnderlinePosition,
                         currentUnderlineThickness,
                         slot );
-        lastFontId = glyph.fontId;
+       lastFontId = glyph.fontId;
       }
     }
 
@@ -271,33 +266,12 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     {
       for ( std::vector< MeshRecord >::iterator mIt = meshContainer.begin(); mIt != meshContainer.end(); ++mIt )
       {
-        MeshActor actor = MeshActor::New( Mesh::New( mIt->mMeshData ) );
-        actor.SetColor( mIt->mColor );
+        Actor actor = CreateMeshActor( *mIt );
 
-        // Ensure that text rendering is unfiltered
-        actor.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
-        if ( mIt->mIsUnderline )
+        // Create an effect if necessary
+        if ( style == STYLE_DROP_SHADOW )
         {
-          actor.SetColorMode( USE_OWN_COLOR );
-        }
-        else
-        {
-          actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
-        }
-
-        // Check to see what pixel format the shader should be
-        if ( mGlyphManager.GetPixelFormat( mIt->mAtlasId ) == Pixel::L8 )
-        {
-          // Create an effect if necessary
-          if ( style == STYLE_DROP_SHADOW )
-          {
-            actor.Add( GenerateShadow( *mIt, shadowOffset, shadowColor ) );
-          }
-          actor.SetShaderEffect( mBasicShader );
-        }
-        else
-        {
-          actor.SetShaderEffect( mBgraShader );
+          actor.Add( GenerateShadow( *mIt, shadowOffset, shadowColor ) );
         }
 
         if ( mActor )
@@ -331,8 +305,38 @@ struct AtlasRenderer::Impl : public ConnectionTracker
 #endif
   }
 
+  Actor CreateMeshActor( const MeshRecord& meshRecord )
+  {
+    PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, meshRecord.mMesh.mVertices.Size() );
+    PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
+    quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ) );
+    quadIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
+
+    Geometry quadGeometry = Geometry::New();
+    quadGeometry.AddVertexBuffer( quadVertices );
+    quadGeometry.SetIndexBuffer( quadIndices );
+
+    Material material = mGlyphManager.GetMaterial( meshRecord.mAtlasId );
+    Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
+    renderer.SetDepthIndex( mDepth );
+    Actor actor = Actor::New();
+    actor.AddRenderer( renderer );
+    actor.SetSize( 1.0f, 1.0f );
+    actor.SetColor( meshRecord.mColor );
+
+    if ( meshRecord.mIsUnderline )
+    {
+      actor.SetColorMode( USE_OWN_COLOR );
+    }
+    else
+    {
+      actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
+    }
+    return actor;
+  }
+
   void StitchTextMesh( std::vector< MeshRecord >& meshContainer,
-                       MeshData& newMeshData,
+                       AtlasManager::Mesh2D& newMesh,
                        Vector< Extent >& extents,
                        const Vector4& color,
                        float baseLine,
@@ -342,9 +346,8 @@ struct AtlasRenderer::Impl : public ConnectionTracker
   {
     if ( slot.mImageId )
     {
-      MeshData::VertexContainer verts = newMeshData.GetVertices();
-      float left = verts[ 0 ].x;
-      float right = verts[ 1 ].x;
+      float left = newMesh.mVertices[ 0 ].mPosition.x;
+      float right = newMesh.mVertices[ 1 ].mPosition.x;
 
       // Check to see if there's a mesh data object that references the same atlas ?
       uint32_t index = 0;
@@ -353,7 +356,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
         if ( slot.mAtlasId == mIt->mAtlasId && color == mIt->mColor )
         {
           // Stitch the mesh to the existing mesh and adjust any extents
-          mGlyphManager.StitchMesh( mIt->mMeshData, newMeshData );
+          mGlyphManager.StitchMesh( mIt->mMesh, newMesh );
           AdjustExtents( extents,
                          meshContainer,
                          index,
@@ -369,7 +372,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
       // No mesh data object currently exists that references this atlas, so create a new one
       MeshRecord meshRecord;
       meshRecord.mAtlasId = slot.mAtlasId;
-      meshRecord.mMeshData = newMeshData;
+      meshRecord.mMesh = newMesh;
       meshRecord.mColor = color;
       meshRecord.mIsUnderline = false;
       meshContainer.push_back( meshRecord );
@@ -517,11 +520,11 @@ struct AtlasRenderer::Impl : public ConnectionTracker
                            const Vector4& underlineColor,
                            const Vector4& textColor )
   {
-    MeshData newMeshData;
+    AtlasManager::Mesh2D newMesh;
+    unsigned short faceIndex = 0;
     for ( Vector< Extent >::ConstIterator eIt = extents.Begin(); eIt != extents.End(); ++eIt )
     {
-      MeshData::VertexContainer newVerts;
-      newVerts.reserve( 4u );
+      AtlasManager::Vertex2D vert;
       uint32_t index = eIt->mMeshRecordIndex;
       Vector2 uv = mGlyphManager.GetAtlasSize( meshRecords[ index ].mAtlasId );
 
@@ -533,37 +536,45 @@ struct AtlasRenderer::Impl : public ConnectionTracker
       float tlx = eIt->mLeft;
       float brx = eIt->mRight;
 
-      newVerts.push_back( MeshData::Vertex( Vector3( tlx, baseLine, ZERO ),
-                                            Vector2::ZERO,
-                                            Vector3::ZERO ) );
-
-      newVerts.push_back( MeshData::Vertex( Vector3( brx, baseLine, ZERO ),
-                                            Vector2( u, ZERO ),
-                                            Vector3::ZERO ) );
-
-      newVerts.push_back( MeshData::Vertex( Vector3( tlx, baseLine + thickness, ZERO ),
-                                            Vector2( ZERO, v ),
-                                            Vector3::ZERO ) );
-
-      newVerts.push_back( MeshData::Vertex( Vector3( brx, baseLine + thickness, ZERO ),
-                                            Vector2( u, v ),
-                                            Vector3::ZERO ) );
-
-      newMeshData.SetVertices( newVerts );
-      newMeshData.SetFaceIndices( mFace );
+      vert.mPosition.x = tlx;
+      vert.mPosition.y = baseLine;
+      vert.mTexCoords.x = ZERO;
+      vert.mTexCoords.y = ZERO;
+      newMesh.mVertices.PushBack( vert );
+
+      vert.mPosition.x = brx;
+      vert.mPosition.y = baseLine;
+      vert.mTexCoords.x = u;
+      newMesh.mVertices.PushBack( vert );
+
+      vert.mPosition.x = tlx;
+      vert.mPosition.y = baseLine + thickness;
+      vert.mTexCoords.x = ZERO;
+      vert.mTexCoords.y = v;
+      newMesh.mVertices.PushBack( vert );
+
+      vert.mPosition.x = brx;
+      vert.mPosition.y = baseLine + thickness;
+      vert.mTexCoords.x = u;
+      newMesh.mVertices.PushBack( vert );
+
+      // Six indices in counter clockwise winding
+      newMesh.mIndices.PushBack( faceIndex + 1u );
+      newMesh.mIndices.PushBack( faceIndex );
+      newMesh.mIndices.PushBack( faceIndex + 2u );
+      newMesh.mIndices.PushBack( faceIndex + 2u );
+      newMesh.mIndices.PushBack( faceIndex + 3u );
+      newMesh.mIndices.PushBack( faceIndex + 1u );
+      faceIndex += 4;
 
       if ( underlineColor == textColor )
       {
-        mGlyphManager.StitchMesh( meshRecords[ index ].mMeshData, newMeshData );
+        mGlyphManager.StitchMesh( meshRecords[ index ].mMesh, newMesh );
       }
       else
       {
         MeshRecord record;
-        newMeshData.SetMaterial( meshRecords[ index ].mMeshData.GetMaterial() );
-        newMeshData.SetHasNormals( true );
-        newMeshData.SetHasColor( false );
-        newMeshData.SetHasTextureCoords( true );
-        record.mMeshData = newMeshData;
+        record.mMesh = newMesh;
         record.mAtlasId = meshRecords[ index ].mAtlasId;
         record.mColor = underlineColor;
         record.mIsUnderline = true;
@@ -572,34 +583,34 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     }
   }
 
-  MeshActor GenerateShadow( MeshRecord& meshRecord,
-                            const Vector2& shadowOffset,
-                            const Vector4& shadowColor )
+  Actor GenerateShadow( MeshRecord& meshRecord,
+                        const Vector2& shadowOffset,
+                        const Vector4& shadowColor )
   {
     // Scan vertex buffer to determine width and height of effect buffer needed
-    MeshData::VertexContainer verts = meshRecord.mMeshData.GetVertices();
-    float tlx = verts[ 0 ].x;
-    float tly = verts[ 0 ].y;
+    const Vector< AtlasManager::Vertex2D >& verts = meshRecord.mMesh.mVertices;
+    float tlx = verts[ 0 ].mPosition.x;
+    float tly = verts[ 0 ].mPosition.y;
     float brx = ZERO;
     float bry = ZERO;
 
-    for ( uint32_t i = 0; i < verts.size(); ++i )
+    for ( uint32_t i = 0; i < verts.Size(); ++i )
     {
-      if ( verts[ i ].x < tlx )
+      if ( verts[ i ].mPosition.x < tlx )
       {
-        tlx = verts[ i ].x;
+        tlx = verts[ i ].mPosition.x;
       }
-      if ( verts[ i ].y < tly )
+      if ( verts[ i ].mPosition.y < tly )
       {
-        tly = verts[ i ].y;
+        tly = verts[ i ].mPosition.y;
       }
-      if ( verts[ i ].x > brx )
+      if ( verts[ i ].mPosition.x > brx )
       {
-        brx = verts[ i ].x;
+        brx = verts[ i ].mPosition.x;
       }
-      if ( verts[ i ].y > bry )
+      if ( verts[ i ].mPosition.y > bry )
       {
-        bry = verts[ i ].y;
+        bry = verts[ i ].mPosition.y;
       }
     }
 
@@ -611,76 +622,64 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     // Create a buffer to render to
     meshRecord.mBuffer = FrameBufferImage::New( width, height );
 
-    // Create a mesh actor to contain the post-effect render
-    MeshData::VertexContainer vertices;
-    MeshData::FaceIndices face;
-
-    vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, tly + shadowOffset.y, ZERO ),
-                                          Vector2::ZERO,
-                                          Vector3::ZERO ) );
-
-    vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, tly + shadowOffset.y, ZERO ),
-                                          Vector2( ONE, ZERO ),
-                                          Vector3::ZERO ) );
-
-    vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, bry + shadowOffset.y, ZERO ),
-                                          Vector2( ZERO, ONE ),
-                                          Vector3::ZERO ) );
-
-    vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, bry + shadowOffset.y, ZERO ),
-                                          Vector2::ONE,
-                                          Vector3::ZERO ) );
-
-    MeshData meshData;
-    Material newMaterial = Material::New("effect buffer");
-    newMaterial.SetDiffuseTexture( meshRecord.mBuffer );
-    meshData.SetMaterial( newMaterial );
-    meshData.SetVertices( vertices );
-    meshData.SetFaceIndices( mFace );
-    meshData.SetHasNormals( true );
-    meshData.SetHasColor( false );
-    meshData.SetHasTextureCoords( true );
-    MeshActor actor = MeshActor::New( Mesh::New( meshData ) );
-    actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
-    actor.SetShaderEffect( mBgraShader );
-    actor.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR );
-    actor.SetSortModifier( 0.1f ); // force behind main text
-
-    // Create a sub actor to render once with normalized vertex positions
-    MeshData newMeshData;
-    MeshData::VertexContainer newVerts;
-    MeshData::FaceIndices newFaces;
-    MeshData::FaceIndices faces = meshRecord.mMeshData.GetFaces();
-    for ( uint32_t i = 0; i < verts.size(); ++i )
-    {
-      MeshData::Vertex vertex = verts[ i ];
-      vertex.x = ( ( vertex.x - tlx ) * divWidth ) - ONE;
-      vertex.y = ( ( vertex.y - tly ) * divHeight ) - ONE;
-      newVerts.push_back( vertex );
-    }
+    // We will render a quad into this buffer
+    unsigned int indices[ 6 ] = { 1, 0, 2, 2, 3, 1 };
+    PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, 4u );
+    PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, sizeof(indices)/sizeof(indices[0]) );
+
+    AtlasManager::Vertex2D vertices[ 4 ] = {
+    { Vector2( tlx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ZERO, ZERO ) },
+    { Vector2( brx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ONE, ZERO ) },
+    { Vector2( tlx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ZERO, ONE ) },
+    { Vector2( brx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ONE, ONE ) } };
+
+    quadVertices.SetData( vertices );
+    quadIndices.SetData( indices );
+
+    Geometry quadGeometry = Geometry::New();
+    quadGeometry.AddVertexBuffer( quadVertices );
+    quadGeometry.SetIndexBuffer( quadIndices );
+
+    Sampler sampler = Sampler::New( meshRecord.mBuffer, "sTexture" );
+    Material material = Material::New( mGlyphManager.GetEffectBufferShader() );
+    material.AddSampler( sampler );
 
-    // Reverse triangle winding order
-    uint32_t faceCount = faces.size() / 3;
-    for ( uint32_t i = 0; i < faceCount; ++i )
+    Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
+
+    // Ensure shadow is behind the text...
+    renderer.SetDepthIndex( mDepth + CONTENT_DEPTH_INDEX - 1 );
+    Actor actor = Actor::New();
+    actor.AddRenderer( renderer );
+    actor.SetSize( 1.0f, 1.0f );
+
+    // Create a sub actor to render the source with normalized vertex positions
+    Vector< AtlasManager::Vertex2D > normVertexList;
+    for ( uint32_t i = 0; i < verts.Size(); ++i )
     {
-      uint32_t index = i * 3;
-      newFaces.push_back( faces[ index + 2 ] );
-      newFaces.push_back( faces[ index + 1 ] );
-      newFaces.push_back( faces[ index ] );
+      AtlasManager::Vertex2D vertex = verts[ i ];
+      vertex.mPosition.x = ( ( vertex.mPosition.x - tlx ) * divWidth ) - ONE;
+      vertex.mPosition.y = ( ( vertex.mPosition.y - tly ) * divHeight ) - ONE;
+      normVertexList.PushBack( vertex );
     }
 
-    newMeshData.SetMaterial( meshRecord.mMeshData.GetMaterial() );
-    newMeshData.SetVertices( newVerts );
-    newMeshData.SetFaceIndices( newFaces );
-    newMeshData.SetHasNormals( true );
-    newMeshData.SetHasColor( false );
-    newMeshData.SetHasTextureCoords( true );
-
-    MeshActor subActor = MeshActor::New( Mesh::New( newMeshData ) );
+    PropertyBuffer normVertices = PropertyBuffer::New( mQuadVertexFormat, normVertexList.Size() );
+    PropertyBuffer normIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
+    normVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &normVertexList[ 0 ] ) );
+    normIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
+
+    Geometry normGeometry = Geometry::New();
+    normGeometry.AddVertexBuffer( normVertices );
+    normGeometry.SetIndexBuffer( normIndices );
+
+    Material normMaterial = Material::New( mGlyphManager.GetGlyphShadowShader() );
+    Sampler normSampler =  mGlyphManager.GetSampler( meshRecord.mAtlasId );
+    normMaterial.AddSampler( normSampler );
+    Dali::Renderer normRenderer = Dali::Renderer::New( normGeometry, normMaterial );
+    Actor subActor = Actor::New();
+    subActor.AddRenderer( normRenderer );
+    subActor.SetSize( 1.0f, 1.0f );
     subActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
     subActor.SetColor( shadowColor );
-    subActor.SetShaderEffect( mBasicShadowShader );
-    subActor.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
 
     // Create a render task to render the effect
     RenderTask task = Stage::GetCurrent().GetRenderTaskList().CreateTask();
@@ -692,6 +691,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     task.SetRefreshRate( RenderTask::REFRESH_ONCE );
     task.FinishedSignal().Connect( this, &AtlasRenderer::Impl::RenderComplete );
     actor.Add( subActor );
+
     return actor;
   }
 
@@ -713,15 +713,15 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     }
   }
 
-  RenderableActor mActor;                             ///< The actor parent which renders the text
+  Actor mActor;                                       ///< The actor parent which renders the text
   AtlasGlyphManager mGlyphManager;                    ///< Glyph Manager to handle upload and caching
   TextAbstraction::FontClient mFontClient;            ///> The font client used to supply glyph information
-  ShaderEffect mBasicShader;                          ///> Shader used to render L8 glyphs
-  ShaderEffect mBgraShader;                           ///> Shader used to render BGRA glyphs
-  ShaderEffect mBasicShadowShader;                    ///> Shader used to render drop shadow into buffer
   std::vector< MaxBlockSize > mBlockSizes;            ///> Maximum size needed to contain a glyph in a block within a new atlas
-  std::vector< MeshData::FaceIndex > mFace;           ///> Face indices for a quad
+  std::vector< uint32_t > mFace;                      ///> Face indices for a quad
   Vector< TextCacheEntry > mTextCache;
+  Property::Map mQuadVertexFormat;
+  Property::Map mQuadIndexFormat;
+  int mDepth;
 };
 
 Text::RendererPtr AtlasRenderer::New()
@@ -731,7 +731,7 @@ Text::RendererPtr AtlasRenderer::New()
   return Text::RendererPtr( new AtlasRenderer() );
 }
 
-RenderableActor AtlasRenderer::Render( Text::ViewInterface& view )
+Actor AtlasRenderer::Render( Text::ViewInterface& view, unsigned int depth )
 {
   UnparentAndReset( mImpl->mActor );
 
@@ -759,7 +759,8 @@ RenderableActor AtlasRenderer::Render( Text::ViewInterface& view )
                       view.GetShadowColor(),
                       view.IsUnderlineEnabled(),
                       view.GetUnderlineColor(),
-                      view.GetUnderlineHeight() );
+                      view.GetUnderlineHeight(),
+                      depth );
   }
 
   return mImpl->mActor;
index e259621..4107f82 100644 (file)
@@ -48,9 +48,10 @@ public:
    * @brief Render the glyphs from a ViewInterface.
    *
    * @param[in] view The interface to a view.
+   * @param[in] depth The depth in the tree of the parent.
    * @return The Renderable actor used to position the text.
    */
-  virtual RenderableActor Render( ViewInterface& view );
+  virtual Actor Render( ViewInterface& view, unsigned int depth );
 
 protected:
 
diff --git a/dali-toolkit/internal/text/rendering/basic/text-basic-renderer.cpp b/dali-toolkit/internal/text/rendering/basic/text-basic-renderer.cpp
deleted file mode 100644 (file)
index 5937c91..0000000
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/internal/text/rendering/basic/text-basic-renderer.h>
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/text-abstraction/font-client.h>
-#include <dali/public-api/actors/image-actor.h>
-#include <dali/devel-api/actors/mesh-actor.h>
-#include <dali/devel-api/images/atlas.h>
-#include <dali/devel-api/geometry/mesh.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/line-run.h>
-#include <dali-toolkit/internal/text/rendering/shaders/text-basic-shader.h>
-#include <dali-toolkit/internal/text/rendering/shaders/text-bgra-shader.h>
-
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-using namespace Dali::Toolkit::Text;
-
-namespace
-{
-
-#if defined(DEBUG_ENABLED)
-  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
-#endif
-
-const std::size_t PADDING = 2; //< To avoid GL filtering artefacts
-
-struct TextureCoordinates
-{
-  TextureCoordinates()
-  : topLeft( 0.0f, 0.0f ),
-    topRight( 1.0f, 0.0f ),
-    bottomLeft( 0.0f, 1.0f ),
-    bottomRight( 1.0f, 1.0f )
-  {
-  }
-
-  Vector2 topLeft;
-  Vector2 topRight;
-  Vector2 bottomLeft;
-  Vector2 bottomRight;
-};
-
-struct AtlasGlyph
-{
-  AtlasGlyph()
-  : fontId( 0 ),
-    index( 0 ),
-    xOffset( 0 ),
-    width( 0 ),
-    height( 0 )
-  {
-  }
-
-  AtlasGlyph( FontId id,
-              GlyphIndex glyphIndex,
-              std::size_t offset,
-              std::size_t widthPixels,
-              std::size_t heightPixels,
-              BufferImage bitmap )
-  : fontId( id ),
-    index( glyphIndex ),
-    xOffset( offset ),
-    width( widthPixels ),
-    height( heightPixels ),
-    mBitmap( bitmap )
-  {
-  }
-
-  FontId fontId;
-  GlyphIndex index;
-  std::size_t xOffset;
-  std::size_t width;
-  std::size_t height;
-  BufferImage mBitmap;
-  TextureCoordinates coords;
-};
-
-} // unnamed namespace
-
-struct BasicRenderer::Impl
-{
-  /**
-   * @brief Create the renderer implementation.
-   */
-  Impl()
-  : mWidthL8( 0.0f ),
-    mHeightL8( 0.0f ),
-    mWidthBGRA8888( 0.0f ),
-    mHeightBGRA8888( 0.0f )
-  {
-    mFontClient = TextAbstraction::FontClient::Get();
-  }
-
-  /**
-   * @brief Reset the previous glyph calculations.
-   *
-   * @param[in] size The glyph space to reserve.
-   */
-  void Reset( std::size_t size )
-  {
-    mWidthL8 = 0.0f;
-    mHeightL8 = 0.0f;
-    mWidthBGRA8888 = 0.0f;
-    mHeightBGRA8888 = 0.0f;
-    mGlyphs.clear();
-    mGlyphs.reserve( size );
-    mAtlasL8.Reset();
-    mAtlasBGRA8888.Reset();
-  }
-
-  /**
-   * @brief Ccreate an Atlas, uploading the necessary glyph bitmaps
-   *
-   * @param[in] glyphs The glyphs to upload.
-   */
-  void CreateAtlases( const Vector<GlyphInfo>& glyphs )
-  {
-    // Clear previous atlas
-    Reset( glyphs.Count() );
-
-    for( unsigned int i=0; i<glyphs.Count(); ++i )
-    {
-      float width  = glyphs[i].width;
-      float height = glyphs[i].height;
-
-      if( width > 0 &&
-          height > 0 ) // skip whitespace
-      {
-        if( !GlyphFound( glyphs[i].fontId, glyphs[i].index ) )
-        {
-          AddGlyph( glyphs[i] );
-        }
-      }
-    }
-
-    mAtlasL8 = CreateAtlas( mWidthL8, mHeightL8, Pixel::L8 );
-    mAtlasBGRA8888 = CreateAtlas( mWidthBGRA8888, mHeightBGRA8888, Pixel::BGRA8888 );
-  }
-
-  Atlas CreateAtlas( unsigned int width, unsigned int height, Pixel::Format format )
-  {
-    Atlas atlas;
-
-    if( width > 0 && height > 0 )
-    {
-      atlas = Atlas::New( width, height, format );
-
-      for( unsigned int i=0; i<mGlyphs.size(); ++i )
-      {
-        AtlasGlyph& glyph = mGlyphs[i];
-
-        const Pixel::Format glyphFormat = glyph.mBitmap.GetPixelFormat();
-
-        if( format == glyphFormat )
-        {
-          atlas.Upload( glyph.mBitmap, glyph.xOffset, 0 );
-
-          TextureCoordinates& coords = glyph.coords;
-          coords.topLeft.x     = static_cast<float>(glyph.xOffset) / static_cast<float>(width);
-          coords.topLeft.y     = 0.0f;
-          coords.topRight.x    = static_cast<float>(glyph.xOffset + glyph.width) / static_cast<float>(width);
-          coords.topRight.y    = 0.0f;
-          coords.bottomLeft.x  = static_cast<float>(glyph.xOffset) / static_cast<float>(width);
-          coords.bottomLeft.y  = static_cast<float>(glyph.height) / static_cast<float>(height);
-          coords.bottomRight.x = static_cast<float>(glyph.xOffset + glyph.width) / static_cast<float>(width);
-          coords.bottomRight.y = static_cast<float>(glyph.height) / static_cast<float>(height);
-        }
-      }
-    }
-
-    return atlas;
-  }
-
-  /**
-   * @brief Check whether we already have the glyph.
-   */
-  bool GlyphFound( FontId fontId, GlyphIndex index ) const
-  {
-    for( unsigned int i=0; i<mGlyphs.size(); ++i )
-    {
-      const AtlasGlyph& glyph = mGlyphs[i];
-
-      if( fontId == glyph.fontId &&
-          index  == glyph.index )
-      {
-        return true;
-      }
-    }
-
-    return false;
-  }
-
-  /**
-   * @brief Add the glyph.
-   */
-  void AddGlyph( const GlyphInfo& glyphInfo )
-  {
-    BufferImage bitmap = mFontClient.CreateBitmap( glyphInfo.fontId, glyphInfo.index );
-
-    const Pixel::Format format = bitmap.GetPixelFormat();
-
-    if( Pixel::L8 == format )
-    {
-      mGlyphs.push_back( AtlasGlyph( glyphInfo.fontId, glyphInfo.index, mWidthL8, glyphInfo.width, glyphInfo.height, bitmap ) );
-
-      // Increase the Atlas width/height
-      mWidthL8 += glyphInfo.width + PADDING;
-      if( mHeightL8 < glyphInfo.height + PADDING )
-      {
-        mHeightL8 = glyphInfo.height + PADDING;
-      }
-    }
-    else if ( Pixel::BGRA8888 == format )
-    {
-       mGlyphs.push_back( AtlasGlyph( glyphInfo.fontId, glyphInfo.index, mWidthBGRA8888, glyphInfo.width, glyphInfo.height, bitmap ) );
-
-      // A separate Atlas is used for color Emojis
-      mWidthBGRA8888 += glyphInfo.width + PADDING;
-      if( mHeightBGRA8888 < glyphInfo.height + PADDING )
-      {
-        mHeightBGRA8888 = glyphInfo.height + PADDING;
-      }
-    }
-  }
-
-  /**
-   * @brief Get the texture coordinates for a glyph.
-   */
-  bool GetTextureCoordinates( Pixel::Format format, FontId fontId, GlyphIndex index, TextureCoordinates& coords )
-  {
-    for( unsigned int i=0; i<mGlyphs.size(); ++i )
-    {
-      const AtlasGlyph& glyph = mGlyphs[i];
-
-      const Pixel::Format glyphFormat = glyph.mBitmap.GetPixelFormat();
-
-      if( format == glyphFormat &&
-          fontId == glyph.fontId &&
-          index  == glyph.index )
-      {
-        coords = glyph.coords;
-        return true;
-      }
-    }
-
-    return false;
-  }
-
-  /**
-   * @brief Helper method to create a mesh with one quad per glyph.
-   *
-   * @param[in] glyphs The glyphs to display.
-   * @param[in] positions The 2D positions of the glyphs.
-   * @param[in] image The material uses this as a diffuse texture.
-   */
-  Mesh CreateMesh( const Vector<GlyphInfo>& glyphs, const std::vector<Vector2>& positions, Pixel::Format format, Image image )
-  {
-    MeshData::VertexContainer vertices( 4 * glyphs.Count() ); // 1 quad per glyph
-
-    MeshData::FaceIndices faces;
-    faces.reserve( 6 * glyphs.Count() ); // 2 triangles per quad
-
-    for( unsigned int i=0; i<glyphs.Count(); ++i )
-    {
-      float width  = glyphs[i].width;
-      float height = glyphs[i].height;
-
-      if( width > 0 &&
-          height > 0 ) // skip whitespace
-      {
-        const Vector2& position = positions[i];
-
-        TextureCoordinates coords;
-        if( GetTextureCoordinates( format, glyphs[i].fontId, glyphs[i].index, coords ) )
-        {
-          vertices[ i*4 + 0 ] = MeshData::Vertex( Vector3( position.x + 0.0f*width, position.y + 0.0f*height, 0.0f ), coords.topLeft,     Vector3( 1.0f, 0.0f, 0.0f ) );
-          vertices[ i*4 + 1 ] = MeshData::Vertex( Vector3( position.x + 1.0f*width, position.y + 0.0f*height, 0.0f ), coords.topRight,    Vector3( 1.0f, 1.0f, 0.0f ) );
-          vertices[ i*4 + 2 ] = MeshData::Vertex( Vector3( position.x + 0.0f*width, position.y + 1.0f*height, 0.0f ), coords.bottomLeft,  Vector3( 0.0f, 1.0f, 0.0f ) );
-          vertices[ i*4 + 3 ] = MeshData::Vertex( Vector3( position.x + 1.0f*width, position.y + 1.0f*height, 0.0f ), coords.bottomRight, Vector3( 0.0f, 0.0f, 1.0f ) );
-
-          faces.push_back( i*4 + 0 ); faces.push_back( i*4 + 3 ); faces.push_back( i*4 + 1 );
-          faces.push_back( i*4 + 0 ); faces.push_back( i*4 + 2 ); faces.push_back( i*4 + 3 );
-        }
-      }
-    }
-
-    Material material = Material::New( "Material" );
-    material.SetDiffuseTexture( image );
-
-    // Create the mesh data from the vertices and faces
-    MeshData meshData;
-    meshData.SetHasColor( false );
-    meshData.SetMaterial( material );
-    meshData.SetVertices( vertices );
-    meshData.SetFaceIndices( faces );
-
-    // Create a mesh from the data
-    Dali::Mesh mesh = Mesh::New( meshData );
-    return mesh;
-  }
-
-  RenderableActor mActor; ///< The actor which renders the text
-
-  Atlas mAtlasL8;
-  unsigned int mWidthL8;
-  unsigned int mHeightL8;
-
-  // A separate Atlas is used for color Emojis
-  Atlas mAtlasBGRA8888;
-  unsigned int mWidthBGRA8888;
-  unsigned int mHeightBGRA8888;
-
-  std::vector<AtlasGlyph> mGlyphs;
-
-  TextAbstraction::FontClient mFontClient;
-};
-
-Text::RendererPtr BasicRenderer::New()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Text::BasicRenderer::New()\n" );
-
-  return Text::RendererPtr( new BasicRenderer() );
-}
-
-RenderableActor BasicRenderer::Render( Text::ViewInterface& view )
-{
-  // Remove the previous text
-  UnparentAndReset( mImpl->mActor );
-
-  Length numberOfGlyphs = view.GetNumberOfGlyphs();
-
-  if( numberOfGlyphs > 0u )
-  {
-    Vector<GlyphInfo> glyphs;
-    glyphs.Resize( numberOfGlyphs );
-
-    std::vector<Vector2> positions;
-    positions.resize( numberOfGlyphs );
-
-    numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
-                                     &positions[0],
-                                     0u,
-                                     numberOfGlyphs );
-
-    glyphs.Resize( numberOfGlyphs );
-    positions.resize( numberOfGlyphs );
-
-    mImpl->CreateAtlases( glyphs );
-
-    MeshActor actorL8;
-    if( mImpl->mAtlasL8 )
-    {
-      actorL8 = MeshActor::New( mImpl->CreateMesh( glyphs, positions, Pixel::L8, mImpl->mAtlasL8 ) );
-      actorL8.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
-
-      ShaderEffect shader = BasicShader::New();
-      actorL8.SetShaderEffect( shader );
-    }
-
-    MeshActor actorBGRA8888;
-    if( mImpl->mAtlasBGRA8888 )
-    {
-      actorBGRA8888 = MeshActor::New( mImpl->CreateMesh( glyphs, positions, Pixel::BGRA8888, mImpl->mAtlasBGRA8888 ) );
-      actorBGRA8888.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
-
-      ShaderEffect shader = BgraShader::New();
-      actorBGRA8888.SetShaderEffect( shader );
-    }
-
-    // If we have both monochrome & color glyphs, two mesh actors are returned in a container
-    if( actorL8 && actorBGRA8888 )
-    {
-      mImpl->mActor = ImageActor::New();
-      mImpl->mActor.Add( actorL8 );
-      mImpl->mActor.Add( actorBGRA8888 );
-    }
-    else
-    {
-      if( actorL8 )
-      {
-        mImpl->mActor = actorL8;
-      }
-      else if( actorBGRA8888 )
-      {
-        mImpl->mActor = actorBGRA8888;
-      }
-    }
-  }
-
-  return mImpl->mActor;
-}
-
-BasicRenderer::BasicRenderer()
-{
-  mImpl = new Impl();
-}
-
-BasicRenderer::~BasicRenderer()
-{
-  delete mImpl;
-}
diff --git a/dali-toolkit/internal/text/rendering/basic/text-basic-renderer.h b/dali-toolkit/internal/text/rendering/basic/text-basic-renderer.h
deleted file mode 100644 (file)
index 1cf8469..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef __DALI_TOOLKIT_TEXT_BASIC_RENDERER_H__
-#define __DALI_TOOLKIT_TEXT_BASIC_RENDERER_H__
-
-/*
- * Copyright (c) 2015 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/rendering/text-renderer.h>
-#include <dali-toolkit/internal/text/text-definitions.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Text
-{
-
-/**
- * @brief A reference implementation of Text::Renderer.
- *
- * This is intended for testing & performance comparisons with more complex solutions.
- * Each basic renderer creates its own texture atlas, and uses a simple packing algorithm,
- * in which glyphs are stored in a single row.
- */
-class BasicRenderer : public Renderer
-{
-public:
-
-  /**
-   * @brief Create the renderer.
-   */
-  static RendererPtr New();
-
-  /**
-   * @brief Render the glyphs from a ViewInterface.
-   *
-   * @param[in] view The interface to a view.
-   * @return The Renderable actor used to position the text.
-   */
-  virtual RenderableActor Render( ViewInterface& view );
-
-protected:
-
-  /**
-   * @brief Constructor.
-   */
-  BasicRenderer();
-
-  /**
-   * @brief A reference counted object may only be deleted by calling Unreference().
-   */
-  virtual ~BasicRenderer();
-
-private:
-
-  // Undefined
-  BasicRenderer( const BasicRenderer& handle );
-
-  // Undefined
-  BasicRenderer& operator=( const BasicRenderer& handle );
-
-private:
-
-  struct Impl;
-  Impl* mImpl;
-};
-
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_TEXT_BASIC_RENDERER_H__
index 0afddbb..447783f 100644 (file)
@@ -17,6 +17,7 @@
 
 // CLASS HEADER
 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
+#include <dali/public-api/shader-effects/shader-effect.h>
 
 namespace Dali
 {
@@ -50,7 +51,6 @@ Dali::ShaderEffect New()
   );
 
   Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, fragmentShader,
-                                                             Dali::GeometryType( Dali::GEOMETRY_TYPE_TEXTURED_MESH ),
                                                              Dali::ShaderEffect::GeometryHints( Dali::ShaderEffect::HINT_NONE ) );
   return shaderEffect;
 }
index f7789f1..5ff9ece 100644 (file)
@@ -29,7 +29,7 @@ namespace Text
 
 namespace BasicShadowShader
 {
-
+/*
 Dali::ShaderEffect New()
 {
   std::string vertexShader = DALI_COMPOSE_SHADER(
@@ -49,11 +49,10 @@ Dali::ShaderEffect New()
   );
 
   Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, fragmentShader,
-                                                             Dali::GeometryType( Dali::GEOMETRY_TYPE_TEXTURED_MESH ),
                                                              Dali::ShaderEffect::GeometryHints( Dali::ShaderEffect::HINT_NONE ) );
   return shaderEffect;
 }
-
+*/
 } // namespace BasicShadowShader
 
 } // namespace Text
diff --git a/dali-toolkit/internal/text/rendering/shaders/text-basic-shadow-shader.h b/dali-toolkit/internal/text/rendering/shaders/text-basic-shadow-shader.h
deleted file mode 100644 (file)
index 93bd0a3..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef __DALI_TOOLKIT_TEXT_BASIC_SHADOW_SHADER_H__
-#define __DALI_TOOLKIT_TEXT_BASIC_SHADOW_SHADER_H__
-
-/*
- * Copyright (c) 2015 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 <dali/public-api/shader-effects/shader-effect.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Text
-{
-
-/**
- * @brief A basic shader for rendering glyphs in Pixel::L8 format.
- */
-namespace BasicShadowShader
-{
-
-/**
- * Create a basic text shadow shader.
- * @return A handle to a newly allocated ShaderEffect
- */
-Dali::ShaderEffect New();
-
-} // namespace BasicShadowShader
-
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_TEXT_BASIC_SHADOW_SHADER_H__
index 7f2f2a5..5bf3707 100644 (file)
@@ -17,6 +17,7 @@
 
 // INTERNAL HEADERS
 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
+#include <dali/public-api/shader-effects/shader-effect.h>
 
 namespace Dali
 {
@@ -49,7 +50,6 @@ Dali::ShaderEffect New()
   );
 
   Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, fragmentShader,
-                                                             Dali::GeometryType( Dali::GEOMETRY_TYPE_TEXTURED_MESH ),
                                                              Dali::ShaderEffect::GeometryHints( Dali::ShaderEffect::HINT_NONE ) );
   return shaderEffect;
 }
index a438a3c..f9f15df 100644 (file)
@@ -25,7 +25,6 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.h>
-#include <dali-toolkit/internal/text/rendering/basic/text-basic-renderer.h>
 
 namespace Dali
 {
@@ -86,12 +85,6 @@ RendererPtr Backend::NewRenderer( unsigned int renderingType )
 
   switch( renderingType )
   {
-    case Dali::Toolkit::Text::RENDERING_BASIC:
-    {
-      renderer = Dali::Toolkit::Text::BasicRenderer::New();
-    }
-    break;
-
     case Dali::Toolkit::Text::RENDERING_SHARED_ATLAS:
     {
       renderer = Dali::Toolkit::Text::AtlasRenderer::New();
index 3485f16..1b272ea 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/renderable-actor.h>
+#include <dali/public-api/actors/actor.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/object/ref-object.h>
 
@@ -52,9 +52,10 @@ public:
    * @brief Render the glyphs from a ViewInterface.
    *
    * @param[in] view The interface to a view.
+   * @param[in] depth The depth in the tree of the parent.
    * @return The Renderable actor used to position the text.
    */
-  virtual RenderableActor Render( ViewInterface& view ) = 0;
+  virtual Actor Render( ViewInterface& view, unsigned int depth ) = 0;
 
 protected:
 
index f05ffda..08790c2 100644 (file)
@@ -136,7 +136,8 @@ EventData::EventData( DecoratorPtr decorator )
   mUpdateLeftSelectionPosition( false ),
   mUpdateRightSelectionPosition( false ),
   mScrollAfterUpdatePosition( false ),
-  mScrollAfterDelete( false )
+  mScrollAfterDelete( false ),
+  mAllTextSelected( false )
 {}
 
 EventData::~EventData()
@@ -237,6 +238,7 @@ bool Controller::Impl::ProcessInputEvents()
         leftScroll = true;
       }
 
+      SetPopupButtons();
       mEventData->mDecoratorUpdated = true;
       mEventData->mUpdateLeftSelectionPosition = false;
     }
@@ -253,6 +255,7 @@ bool Controller::Impl::ProcessInputEvents()
         rightScroll = true;
       }
 
+      SetPopupButtons();
       mEventData->mDecoratorUpdated = true;
       mEventData->mUpdateRightSelectionPosition = false;
     }
@@ -569,7 +572,8 @@ void Controller::Impl::OnHandleEvent( const Event& event )
     {
       ChangeState ( EventData::SELECTION_HANDLE_PANNING );
 
-      if( handleNewPosition != mEventData->mLeftSelectionPosition )
+      if( ( handleNewPosition != mEventData->mLeftSelectionPosition ) &&
+          ( handleNewPosition != mEventData->mRightSelectionPosition ) )
       {
         mEventData->mLeftSelectionPosition = handleNewPosition;
 
@@ -583,7 +587,8 @@ void Controller::Impl::OnHandleEvent( const Event& event )
     {
       ChangeState ( EventData::SELECTION_HANDLE_PANNING );
 
-      if( handleNewPosition != mEventData->mRightSelectionPosition )
+      if( ( handleNewPosition != mEventData->mRightSelectionPosition ) &&
+          ( handleNewPosition != mEventData->mLeftSelectionPosition ) )
       {
         mEventData->mRightSelectionPosition = handleNewPosition;
 
@@ -625,12 +630,13 @@ void Controller::Impl::OnHandleEvent( const Event& event )
 
       if( handleStopScrolling )
       {
-        mEventData->mUpdateLeftSelectionPosition = mEventData->mLeftSelectionPosition != handlePosition;
+        mEventData->mUpdateLeftSelectionPosition = ( mEventData->mLeftSelectionPosition != handlePosition ) && ( mEventData->mRightSelectionPosition != handlePosition);
         mEventData->mScrollAfterUpdatePosition = mEventData->mUpdateLeftSelectionPosition;
-        mEventData->mLeftSelectionPosition = handlePosition;
 
         if( mEventData->mUpdateLeftSelectionPosition )
         {
+          mEventData->mLeftSelectionPosition = handlePosition;
+
           RepositionSelectionHandles( mEventData->mLeftSelectionPosition,
                                       mEventData->mRightSelectionPosition );
         }
@@ -642,12 +648,12 @@ void Controller::Impl::OnHandleEvent( const Event& event )
 
       if( handleStopScrolling )
       {
-        mEventData->mUpdateRightSelectionPosition = mEventData->mRightSelectionPosition != handlePosition;
+        mEventData->mUpdateRightSelectionPosition = ( mEventData->mRightSelectionPosition != handlePosition ) && ( mEventData->mLeftSelectionPosition != handlePosition );
         mEventData->mScrollAfterUpdatePosition = mEventData->mUpdateRightSelectionPosition;
-        mEventData->mRightSelectionPosition = handlePosition;
 
         if( mEventData->mUpdateRightSelectionPosition )
         {
+          mEventData->mRightSelectionPosition = handlePosition;
           RepositionSelectionHandles( mEventData->mLeftSelectionPosition,
                                       mEventData->mRightSelectionPosition );
         }
@@ -660,50 +666,80 @@ void Controller::Impl::OnHandleEvent( const Event& event )
   {
     const float xSpeed = event.p2.mFloat;
     const Vector2& actualSize = mVisualModel->GetActualSize();
+    const Vector2 currentScrollPosition = mEventData->mScrollPosition;
 
     mEventData->mScrollPosition.x += xSpeed;
 
     ClampHorizontalScroll( actualSize );
 
-    const bool leftSelectionHandleEvent = Event::LEFT_SELECTION_HANDLE_EVENT == event.type;
-    const bool rightSelectionHandleEvent = Event::RIGHT_SELECTION_HANDLE_EVENT == event.type;
-
-    if( Event::GRAB_HANDLE_EVENT == event.type )
+    if( Vector2::ZERO == ( currentScrollPosition - mEventData->mScrollPosition ) )
     {
-      ChangeState( EventData::GRAB_HANDLE_PANNING );
+      // Notify the decorator there is no more text to scroll.
+      // The decorator won't send more scroll events.
+      mEventData->mDecorator->NotifyEndOfScroll();
     }
-    else if( leftSelectionHandleEvent || rightSelectionHandleEvent )
+    else
     {
-      // TODO: This is recalculating the selection box every time the text is scrolled with the selection handles.
-      //       Think if something can be done to save power.
+      const bool scrollRightDirection = xSpeed > 0.f;
+      const bool leftSelectionHandleEvent = Event::LEFT_SELECTION_HANDLE_EVENT == event.type;
+      const bool rightSelectionHandleEvent = Event::RIGHT_SELECTION_HANDLE_EVENT == event.type;
 
-      ChangeState( EventData::SELECTION_HANDLE_PANNING );
+      if( Event::GRAB_HANDLE_EVENT == event.type )
+      {
+        ChangeState( EventData::GRAB_HANDLE_PANNING );
 
-      const Vector2& position = mEventData->mDecorator->GetPosition( leftSelectionHandleEvent ? Text::LEFT_SELECTION_HANDLE : Text::RIGHT_SELECTION_HANDLE );
+        Vector2 position = mEventData->mDecorator->GetPosition( GRAB_HANDLE );
 
-      // Get the new handle position.
-      // The selection handle's position is in decorator coords. Need to transforms to text coords.
-      const CharacterIndex handlePosition = GetClosestCursorIndex( position.x - mEventData->mScrollPosition.x - mAlignmentOffset.x,
-                                                                   position.y - mEventData->mScrollPosition.y - mAlignmentOffset.y );
+        // Position the grag handle close to either the left or right edge.
+        position.x = scrollRightDirection ? 0.f : mControlSize.width;
 
-      if( leftSelectionHandleEvent )
-      {
-        mEventData->mUpdateLeftSelectionPosition = handlePosition != mEventData->mLeftSelectionPosition;
-        mEventData->mLeftSelectionPosition = handlePosition;
+        // Get the new handle position.
+        // The grab handle's position is in decorator coords. Need to transforms to text coords.
+        const CharacterIndex handlePosition = GetClosestCursorIndex( position.x - mEventData->mScrollPosition.x - mAlignmentOffset.x,
+                                                                     position.y - mEventData->mScrollPosition.y - mAlignmentOffset.y );
+
+        mEventData->mUpdateCursorPosition = mEventData->mPrimaryCursorPosition != handlePosition;
+        mEventData->mScrollAfterUpdatePosition = mEventData->mUpdateCursorPosition;
+        mEventData->mPrimaryCursorPosition = handlePosition;
       }
-      else
+      else if( leftSelectionHandleEvent || rightSelectionHandleEvent )
       {
-        mEventData->mUpdateRightSelectionPosition = handlePosition != mEventData->mRightSelectionPosition;
-        mEventData->mRightSelectionPosition = handlePosition;
-      }
+        // TODO: This is recalculating the selection box every time the text is scrolled with the selection handles.
+        //       Think if something can be done to save power.
 
-      if( mEventData->mUpdateLeftSelectionPosition || mEventData->mUpdateRightSelectionPosition )
-      {
-        RepositionSelectionHandles( mEventData->mLeftSelectionPosition,
-                                    mEventData->mRightSelectionPosition );
+        ChangeState( EventData::SELECTION_HANDLE_PANNING );
+
+        Vector2 position = mEventData->mDecorator->GetPosition( leftSelectionHandleEvent ? Text::LEFT_SELECTION_HANDLE : Text::RIGHT_SELECTION_HANDLE );
+
+        // Position the selection handle close to either the left or right edge.
+        position.x = scrollRightDirection ? 0.f : mControlSize.width;
+
+        // Get the new handle position.
+        // The selection handle's position is in decorator coords. Need to transforms to text coords.
+        const CharacterIndex handlePosition = GetClosestCursorIndex( position.x - mEventData->mScrollPosition.x - mAlignmentOffset.x,
+                                                                     position.y - mEventData->mScrollPosition.y - mAlignmentOffset.y );
+
+        if( leftSelectionHandleEvent )
+        {
+          mEventData->mUpdateLeftSelectionPosition = handlePosition != mEventData->mLeftSelectionPosition;
+          mEventData->mLeftSelectionPosition = handlePosition;
+        }
+        else
+        {
+          mEventData->mUpdateRightSelectionPosition = handlePosition != mEventData->mRightSelectionPosition;
+          mEventData->mRightSelectionPosition = handlePosition;
+        }
+
+        if( mEventData->mUpdateLeftSelectionPosition || mEventData->mUpdateRightSelectionPosition )
+        {
+          RepositionSelectionHandles( mEventData->mLeftSelectionPosition,
+                                      mEventData->mRightSelectionPosition );
+
+          mEventData->mScrollAfterUpdatePosition = true;
+        }
       }
+      mEventData->mDecoratorUpdated = true;
     }
-    mEventData->mDecoratorUpdated = true;
   } // end ( HANDLE_SCROLLING == state )
 }
 
@@ -721,12 +757,17 @@ void Controller::Impl::OnSelectEvent( const Event& event )
     const float xPosition = event.p2.mFloat - mEventData->mScrollPosition.x - mAlignmentOffset.x;
     const float yPosition = event.p3.mFloat - mEventData->mScrollPosition.y - mAlignmentOffset.y;
 
+    const CharacterIndex leftPosition = mEventData->mLeftSelectionPosition;
+    const CharacterIndex rightPosition = mEventData->mRightSelectionPosition;
+
     RepositionSelectionHandles( xPosition,
                                 yPosition );
 
-    mEventData->mScrollAfterUpdatePosition = true;
-    mEventData->mUpdateLeftSelectionPosition = true;
-    mEventData->mUpdateRightSelectionPosition = true;
+    mEventData->mUpdateLeftSelectionPosition = leftPosition != mEventData->mLeftSelectionPosition;
+    mEventData->mUpdateRightSelectionPosition = rightPosition != mEventData->mRightSelectionPosition;
+
+    mEventData->mScrollAfterUpdatePosition = ( ( mEventData->mUpdateLeftSelectionPosition || mEventData->mUpdateRightSelectionPosition ) &&
+                                               ( mEventData->mLeftSelectionPosition != mEventData->mRightSelectionPosition ) );
   }
 }
 
@@ -749,7 +790,7 @@ void Controller::Impl::OnSelectAllEvent()
   }
 }
 
-void Controller::Impl::RetreiveSelection( std::string& selectedText, bool deleteAfterRetreival )
+void Controller::Impl::RetrieveSelection( std::string& selectedText, bool deleteAfterRetreival )
 {
   if( mEventData->mLeftSelectionPosition ==  mEventData->mRightSelectionPosition )
   {
@@ -785,6 +826,22 @@ void Controller::Impl::RetreiveSelection( std::string& selectedText, bool delete
   }
 }
 
+void Controller::Impl::ShowClipboard()
+{
+  if ( mClipboard )
+  {
+    mClipboard.ShowClipboard();
+  }
+}
+
+void Controller::Impl::HideClipboard()
+{
+  if ( mClipboard )
+  {
+    mClipboard.HideClipboard();
+  }
+}
+
 bool Controller::Impl::CopyStringToClipboard( std::string& source )
 {
   //Send string to clipboard
@@ -794,7 +851,7 @@ bool Controller::Impl::CopyStringToClipboard( std::string& source )
 void Controller::Impl::SendSelectionToClipboard( bool deleteAfterSending )
 {
   std::string selectedText;
-  RetreiveSelection( selectedText, deleteAfterSending );
+  RetrieveSelection( selectedText, deleteAfterSending );
   CopyStringToClipboard( selectedText );
   ChangeState( EventData::EDITING );
 }
@@ -912,6 +969,47 @@ void Controller::Impl::RepositionSelectionHandles( float visualX, float visualY
   RepositionSelectionHandles( selectionStart, selectionEnd );
 }
 
+void Controller::Impl::SetPopupButtons()
+{
+  /**
+   *  Sets the Popup buttons to be shown depending on State.
+   *
+   *  If SELECTING :  CUT & COPY + ( PASTE & CLIPBOARD if content available to paste )
+   *
+   *  If EDITING_WITH_POPUP : SELECT & SELECT_ALL
+   */
+
+  TextSelectionPopup::Buttons buttonsToShow = TextSelectionPopup::NONE;
+
+  if ( ( EventData::SELECTING == mEventData->mState ) || ( EventData::SELECTION_CHANGED == mEventData->mState ) )
+  {
+    buttonsToShow = TextSelectionPopup::Buttons(  TextSelectionPopup::CUT | TextSelectionPopup::COPY );
+
+    if ( !IsClipboardEmpty() )
+    {
+      buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+      buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::CLIPBOARD ) );
+    }
+
+    if ( !mEventData->mAllTextSelected )
+    {
+      buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::SELECT_ALL ) );
+    }
+  }
+  else if  ( EventData::EDITING_WITH_POPUP == mEventData->mState )
+  {
+    buttonsToShow = TextSelectionPopup::Buttons( TextSelectionPopup::SELECT | TextSelectionPopup::SELECT_ALL );
+
+    if ( !IsClipboardEmpty() )
+    {
+      buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+      buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::CLIPBOARD ) );
+    }
+  }
+
+  mEventData->mDecorator->SetEnabledPopupButtons( buttonsToShow );
+}
+
 void Controller::Impl::ChangeState( EventData::State newState )
 {
   if( NULL == mEventData )
@@ -933,6 +1031,7 @@ void Controller::Impl::ChangeState( EventData::State newState )
       mEventData->mDecorator->SetHandleActive( RIGHT_SELECTION_HANDLE, false );
       mEventData->mDecorator->SetPopupActive( false );
       mEventData->mDecoratorUpdated = true;
+      HideClipboard();
     }
     else if ( EventData::SELECTING == mEventData->mState )
     {
@@ -943,13 +1042,7 @@ void Controller::Impl::ChangeState( EventData::State newState )
       mEventData->mDecorator->SetHandleActive( RIGHT_SELECTION_HANDLE, true );
       if( mEventData->mGrabHandlePopupEnabled )
       {
-        TextSelectionPopup::Buttons buttonsToShow = TextSelectionPopup::Buttons(  TextSelectionPopup::CUT | TextSelectionPopup::COPY );
-        if ( !IsClipboardEmpty() )
-        {
-          buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
-        }
-
-        mEventData->mDecorator->SetEnabledPopupButtons( buttonsToShow );
+        SetPopupButtons();
         mEventData->mDecorator->SetPopupActive( true );
       }
       mEventData->mDecoratorUpdated = true;
@@ -958,13 +1051,8 @@ void Controller::Impl::ChangeState( EventData::State newState )
     {
       if( mEventData->mGrabHandlePopupEnabled )
       {
-        TextSelectionPopup::Buttons buttonsToShow = TextSelectionPopup::Buttons(  TextSelectionPopup::CUT | TextSelectionPopup::COPY );
-        if (  !IsClipboardEmpty() )
-        {
-          buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
-        }
+        SetPopupButtons();
         mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_NONE );
-        mEventData->mDecorator->SetEnabledPopupButtons( buttonsToShow );
         mEventData->mDecorator->SetPopupActive( true );
       }
       mEventData->mDecoratorUpdated = true;
@@ -985,6 +1073,7 @@ void Controller::Impl::ChangeState( EventData::State newState )
         mEventData->mDecorator->SetPopupActive( false );
       }
       mEventData->mDecoratorUpdated = true;
+      HideClipboard();
     }
     else if( EventData::EDITING_WITH_POPUP == mEventData->mState )
     {
@@ -1004,16 +1093,10 @@ void Controller::Impl::ChangeState( EventData::State newState )
       }
       if( mEventData->mGrabHandlePopupEnabled )
       {
-        TextSelectionPopup::Buttons buttonsToShow = TextSelectionPopup::Buttons( TextSelectionPopup::SELECT | TextSelectionPopup::SELECT_ALL );
-
-        if ( !IsClipboardEmpty() )
-        {
-          buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
-        }
-
-        mEventData->mDecorator->SetEnabledPopupButtons( buttonsToShow );
+        SetPopupButtons();
         mEventData->mDecorator->SetPopupActive( true );
       }
+      HideClipboard();
       mEventData->mDecoratorUpdated = true;
     }
     else if ( EventData::SELECTION_HANDLE_PANNING == mEventData->mState )
@@ -1231,7 +1314,7 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical,
     cursorInfo.lineHeight = fontMetrics.ascender - fontMetrics.descender;
     cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
 
-    cursorInfo.primaryPosition.x = 0.f;
+    cursorInfo.primaryPosition.x = 1.f;
     cursorInfo.primaryPosition.y = 0.f;
 
     // Nothing else to do.
@@ -1580,6 +1663,11 @@ void Controller::Impl::UpdateSelectionHandle( HandleType handleType )
                                        cursorPosition.x,
                                        cursorPosition.y,
                                        cursorInfo.lineHeight );
+
+  // If selection handle at start of the text and other at end of the text then all text is selected.
+  const CharacterIndex startOfSelection = std::min( mEventData->mLeftSelectionPosition, mEventData->mRightSelectionPosition );
+  const CharacterIndex endOfSelection = std::max ( mEventData->mLeftSelectionPosition, mEventData->mRightSelectionPosition );
+  mEventData->mAllTextSelected = ( startOfSelection == 0 ) && ( endOfSelection == mLogicalModel->mText.Count() );
 }
 
 void Controller::Impl::ClampHorizontalScroll( const Vector2& actualSize )
@@ -1655,40 +1743,36 @@ void Controller::Impl::ScrollTextToMatchCursor()
   mEventData->mScrollPosition.x = currentCursorPosition.x - cursorInfo.primaryPosition.x - mAlignmentOffset.x;
 
   ClampHorizontalScroll( mVisualModel->GetActualSize() );
-  bool updateCursorPosition = true;
 
   const Vector2 offset = mEventData->mScrollPosition + mAlignmentOffset;
   const Vector2 cursorPosition = cursorInfo.primaryPosition + offset;
 
-  if( updateCursorPosition )
-  {
-    // Sets the cursor position.
-    mEventData->mDecorator->SetPosition( PRIMARY_CURSOR,
-                                         cursorPosition.x,
-                                         cursorPosition.y,
-                                         cursorInfo.primaryCursorHeight,
-                                         cursorInfo.lineHeight );
+  // Sets the cursor position.
+  mEventData->mDecorator->SetPosition( PRIMARY_CURSOR,
+                                       cursorPosition.x,
+                                       cursorPosition.y,
+                                       cursorInfo.primaryCursorHeight,
+                                       cursorInfo.lineHeight );
 
-    // Sets the grab handle position.
-    mEventData->mDecorator->SetPosition( GRAB_HANDLE,
-                                         cursorPosition.x,
-                                         cursorPosition.y,
-                                         cursorInfo.lineHeight );
+  // Sets the grab handle position.
+  mEventData->mDecorator->SetPosition( GRAB_HANDLE,
+                                       cursorPosition.x,
+                                       cursorPosition.y,
+                                       cursorInfo.lineHeight );
 
-    if( cursorInfo.isSecondaryCursor )
-    {
-      mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_BOTH );
-      mEventData->mDecorator->SetPosition( SECONDARY_CURSOR,
-                                           cursorInfo.secondaryPosition.x + offset.x,
-                                           cursorInfo.secondaryPosition.y + offset.y,
-                                           cursorInfo.secondaryCursorHeight,
-                                           cursorInfo.lineHeight );
-      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Secondary cursor position: %f,%f\n", cursorInfo.secondaryPosition.x + offset.x, cursorInfo.secondaryPosition.y + offset.y );
-    }
-    else
-    {
-      mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY );
-    }
+  if( cursorInfo.isSecondaryCursor )
+  {
+    mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_BOTH );
+    mEventData->mDecorator->SetPosition( SECONDARY_CURSOR,
+                                         cursorInfo.secondaryPosition.x + offset.x,
+                                         cursorInfo.secondaryPosition.y + offset.y,
+                                         cursorInfo.secondaryCursorHeight,
+                                         cursorInfo.lineHeight );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Secondary cursor position: %f,%f\n", cursorInfo.secondaryPosition.x + offset.x, cursorInfo.secondaryPosition.y + offset.y );
+  }
+  else
+  {
+    mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY );
   }
 }
 
index 8e84d3c..24b10e8 100644 (file)
@@ -153,6 +153,7 @@ struct EventData
   bool mUpdateRightSelectionPosition    : 1;   ///< True if the visual position of the right selection handle must be recalculated.
   bool mScrollAfterUpdatePosition       : 1;   ///< Whether to scroll after the cursor position is updated.
   bool mScrollAfterDelete               : 1;   ///< Whether to scroll after delete characters.
+  bool mAllTextSelected                 : 1;   ///< True if the selection handles are selecting all the text
 };
 
 struct ModifyEvent
@@ -339,7 +340,11 @@ struct Controller::Impl
 
   void OnSelectAllEvent();
 
-  void RetreiveSelection( std::string& selectedText, bool deleteAfterRetreival );
+  void RetrieveSelection( std::string& selectedText, bool deleteAfterRetreival );
+
+  void ShowClipboard();
+
+  void HideClipboard();
 
   bool CopyStringToClipboard( std::string& source );
 
@@ -350,8 +355,9 @@ struct Controller::Impl
   void RepositionSelectionHandles( CharacterIndex selectionStart, CharacterIndex selectionEnd );
   void RepositionSelectionHandles( float visualX, float visualY );
 
-  void ChangeState( EventData::State newState );
+  void SetPopupButtons();
 
+  void ChangeState( EventData::State newState );
   LineIndex GetClosestLine( float y ) const;
 
   void FindSelectionIndices( float visualX, float visualY, CharacterIndex& startIndex, CharacterIndex& endIndex );
index f1ee352..814c4fe 100644 (file)
@@ -23,6 +23,7 @@
 #include <iostream>
 #include <dali/public-api/adaptor-framework/key.h>
 #include <dali/integration-api/debug.h>
+#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bidirectional-support.h>
@@ -84,6 +85,17 @@ void Controller::SetText( const std::string& text )
 
   CharacterIndex lastCursorIndex = 0u;
 
+  if( mImpl->mEventData )
+  {
+    // If popup shown then hide it by switching to Editing state
+    if ( EventData::SELECTING == mImpl->mEventData->mState ||
+         EventData::SELECTION_CHANGED == mImpl->mEventData->mState ||
+         EventData::EDITING_WITH_POPUP == mImpl->mEventData->mState )
+    {
+      mImpl->ChangeState( EventData::EDITING );
+    }
+  }
+
   if( !text.empty() )
   {
     //  Convert text into UTF-32
@@ -1121,9 +1133,6 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
     int keyCode = keyEvent.keyCode;
     const std::string& keyString = keyEvent.keyPressed;
 
-    // Hide the grab handle.
-    mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, false );
-
     // Pre-process to separate modifying events from non-modifying input events.
     if( Dali::DALI_KEY_ESCAPE == keyCode )
     {
@@ -1141,29 +1150,12 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
     }
     else if( Dali::DALI_KEY_BACKSPACE == keyCode )
     {
-      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p DALI_KEY_BACKSPACE\n", this );
-
-      // IMF manager is no longer handling key-events
-      mImpl->ClearPreEditFlag();
-
-      // Remove the character before the current cursor position
-      bool removed = RemoveText( -1, 1 );
-
-      if( removed )
-      {
-        if( 0u != mImpl->mLogicalModel->mText.Count() ||
-            !mImpl->IsPlaceholderAvailable() )
-        {
-          mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
-        }
-        else
-        {
-          ShowPlaceholderText();
-          mImpl->mEventData->mUpdateCursorPosition = true;
-        }
-
-        textChanged = true;
-      }
+      textChanged = BackspaceKeyEvent();
+    }
+    else if ( IsKey( keyEvent,  Dali::DALI_KEY_POWER ) || IsKey( keyEvent, Dali::DALI_KEY_MENU ) )
+    {
+      // Do nothing when the Power or Menu Key is pressed.
+      // It avoids call the InsertText() method and delete the selected text.
     }
     else
     {
@@ -1173,7 +1165,6 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
       mImpl->ClearPreEditFlag();
 
       InsertText( keyString, COMMIT );
-
       textChanged = true;
     }
 
@@ -1193,7 +1184,7 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
 
 void Controller::InsertText( const std::string& text, Controller::InsertType type )
 {
-  bool removedPreEdit( false );
+  bool removedPrevious( false );
   bool maxLengthReached( false );
 
   DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected InsertText" )
@@ -1210,11 +1201,16 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
       0 != mImpl->mEventData->mPreEditLength )
   {
     CharacterIndex offset = mImpl->mEventData->mPrimaryCursorPosition - mImpl->mEventData->mPreEditStartPosition;
-    removedPreEdit = RemoveText( -static_cast<int>(offset), mImpl->mEventData->mPreEditLength );
+    removedPrevious = RemoveText( -static_cast<int>(offset), mImpl->mEventData->mPreEditLength );
 
     mImpl->mEventData->mPrimaryCursorPosition = mImpl->mEventData->mPreEditStartPosition;
     mImpl->mEventData->mPreEditLength = 0;
   }
+  else
+  {
+    // Remove the previous Selection
+    removedPrevious = RemoveSelectedText();
+  }
 
   if( ! text.empty() )
   {
@@ -1241,6 +1237,8 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
       ResetText();
     }
 
+    mImpl->ChangeState( EventData::EDITING );
+
     // Handle the IMF (predicitive text) state changes
     if( mImpl->mEventData )
     {
@@ -1299,7 +1297,7 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
     mImpl->mEventData->mUpdateCursorPosition = true;
     mImpl->ClearPreEditFlag();
   }
-  else if( removedPreEdit ||
+  else if( removedPrevious ||
            0 != utf32Characters.Count() )
   {
     // Queue an inserted event
@@ -1317,6 +1315,26 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
   }
 }
 
+bool Controller::RemoveSelectedText()
+{
+  bool textRemoved( false );
+
+  if ( EventData::SELECTING         == mImpl->mEventData->mState ||
+       EventData::SELECTION_CHANGED == mImpl->mEventData->mState )
+  {
+    std::string removedString;
+    mImpl->RetrieveSelection( removedString, true );
+
+    if( !removedString.empty() )
+    {
+      textRemoved = true;
+      mImpl->ChangeState( EventData::EDITING );
+    }
+  }
+
+  return textRemoved;
+}
+
 void Controller::TapEvent( unsigned int tapCount, float x, float y )
 {
   DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected TapEvent" );
@@ -1326,9 +1344,8 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y )
     const bool isShowingPlaceholderText = mImpl->IsShowingPlaceholderText();
     if( 1u == tapCount )
     {
-      bool tapDuringEditMode( EventData::EDITING == mImpl->mEventData->mState );
-
-      if( !isShowingPlaceholderText && tapDuringEditMode )
+      if( !isShowingPlaceholderText &&
+          ( EventData::EDITING == mImpl->mEventData->mState ) )
       {
         mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, true );
         mImpl->mEventData->mDecorator->SetPopupActive( false );
@@ -1464,6 +1481,20 @@ void Controller::DecorationEvent( HandleType handleType, HandleState state, floa
   }
 }
 
+void Controller::PasteText( const std::string& stringToPaste )
+{
+  InsertText( stringToPaste, Text::Controller::COMMIT );
+  mImpl->ChangeState( EventData::EDITING );
+  mImpl->RequestRelayout();
+}
+
+void Controller::PasteClipboardItemEvent()
+{
+  ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+  std::string stringToPaste( notifier.GetContent() );
+  PasteText( stringToPaste );
+}
+
 void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button )
 {
   if( NULL == mImpl->mEventData )
@@ -1501,9 +1532,7 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
     {
       std::string stringToPaste("");
       mImpl->GetTextFromClipboard( 0, stringToPaste ); // Paste latest item from system clipboard
-      InsertText( stringToPaste, Text::Controller::CLIPBOARD );
-      mImpl->ChangeState( EventData::EDITING );
-      mImpl->RequestRelayout();
+      PasteText( stringToPaste );
       break;
     }
     case Toolkit::TextSelectionPopup::SELECT:
@@ -1525,6 +1554,7 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
     }
     case Toolkit::TextSelectionPopup::CLIPBOARD:
     {
+      mImpl->ShowClipboard();
       break;
     }
     case Toolkit::TextSelectionPopup::NONE:
@@ -1600,12 +1630,48 @@ ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, cons
   return callbackData;
 }
 
-
 Controller::~Controller()
 {
   delete mImpl;
 }
 
+bool Controller::BackspaceKeyEvent()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p DALI_KEY_BACKSPACE\n", this );
+
+  // IMF manager is no longer handling key-events
+  mImpl->ClearPreEditFlag();
+
+  bool removed( false );
+
+  if ( EventData::SELECTING         == mImpl->mEventData->mState ||
+       EventData::SELECTION_CHANGED == mImpl->mEventData->mState )
+  {
+    removed = RemoveSelectedText();
+  }
+  else if( mImpl->mEventData->mPrimaryCursorPosition > 0 )
+  {
+    // Remove the character before the current cursor position
+    removed = RemoveText( -1, 1 );
+  }
+
+  if( removed )
+  {
+    if( 0u != mImpl->mLogicalModel->mText.Count() ||
+        !mImpl->IsPlaceholderAvailable() )
+    {
+      mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
+    }
+    else
+    {
+      ShowPlaceholderText();
+      mImpl->mEventData->mUpdateCursorPosition = true;
+    }
+  }
+
+  return removed;
+}
+
 void Controller::ShowPlaceholderText()
 {
   if( mImpl->IsPlaceholderAvailable() )
index f1e1d28..dfeffdc 100644 (file)
@@ -103,8 +103,7 @@ public:
   enum InsertType
   {
     COMMIT,
-    PRE_EDIT,
-    CLIPBOARD
+    PRE_EDIT
   };
 
   /**
@@ -504,6 +503,12 @@ public:
   void InsertText( const std::string& text, InsertType type );
 
   /**
+   * @brief Checks if text is selected and if so removes it.
+   * @return true if text was removed
+   */
+  bool RemoveSelectedText();
+
+  /**
    * @brief Called by editable UI controls when a tap gesture occurs.
    * @param[in] tapCount The number of taps.
    * @param[in] x The x position relative to the top-left of the parent control.
@@ -540,6 +545,17 @@ public:
   ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
 
   /**
+   * @brief Paste given string into Text model
+   * @param[in] stringToPaste this string will be inserted into the text model
+   */
+  void PasteText( const std::string& stringToPaste );
+
+  /**
+   * @brief Event from Clipboard notifying an Item has been selected for pasting
+   */
+  void PasteClipboardItemEvent();
+
+  /**
    * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
    */
   virtual void GetTargetSize( Vector2& targetSize );
@@ -569,6 +585,13 @@ protected:
 private:
 
   /**
+   * @brief Helper to KeyEvent() to handle the backspace case.
+   *
+   * @return True if a character was deleted.
+   */
+  bool BackspaceKeyEvent();
+
+  /**
    * @brief Helper to clear font-specific data.
    */
   void ShowPlaceholderText();
diff --git a/dali-toolkit/public-api/accessibility-manager/accessibility-manager.cpp b/dali-toolkit/public-api/accessibility-manager/accessibility-manager.cpp
new file mode 100644 (file)
index 0000000..0110ef7
--- /dev/null
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2015 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 <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/singleton-service.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+AccessibilityManager::AccessibilityManager()
+{
+}
+
+AccessibilityManager::~AccessibilityManager()
+{
+}
+
+AccessibilityManager AccessibilityManager::Get()
+{
+  AccessibilityManager manager;
+
+  // Check whether the accessibility manager is already created
+  SingletonService singletonService( SingletonService::Get() );
+  if ( singletonService )
+  {
+    Dali::BaseHandle handle = singletonService.GetSingleton(typeid(AccessibilityManager));
+    if(handle)
+    {
+      // If so, downcast the handle of singleton to focus manager
+      manager = AccessibilityManager(dynamic_cast<Internal::AccessibilityManager*>(handle.GetObjectPtr()));
+    }
+
+    if(!manager)
+    {
+      // If not, create the accessibility manager and register it as a singleton
+      Internal::AccessibilityManager* internalManager = new Internal::AccessibilityManager();
+      manager = AccessibilityManager( internalManager );
+      internalManager->Initialise();
+      singletonService.Register( typeid(manager), manager );
+    }
+  }
+
+  return manager;
+}
+
+AccessibilityManager::AccessibilityManager(Internal::AccessibilityManager *impl)
+  : BaseHandle(impl)
+{
+}
+
+void AccessibilityManager::SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text)
+{
+  GetImpl(*this).SetAccessibilityAttribute(actor, type, text);
+}
+
+std::string AccessibilityManager::GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const
+{
+  return GetImpl(*this).GetAccessibilityAttribute(actor, type);
+}
+
+void AccessibilityManager::SetFocusOrder(Actor actor, const unsigned int order)
+{
+  GetImpl(*this).SetFocusOrder(actor, order);
+}
+
+unsigned int AccessibilityManager::GetFocusOrder(Actor actor) const
+{
+  return GetImpl(*this).GetFocusOrder(actor);
+}
+
+unsigned int AccessibilityManager::GenerateNewFocusOrder() const
+{
+  return GetImpl(*this).GenerateNewFocusOrder();
+}
+
+Actor AccessibilityManager::GetActorByFocusOrder(const unsigned int order)
+{
+  return GetImpl(*this).GetActorByFocusOrder(order);
+}
+
+bool AccessibilityManager::SetCurrentFocusActor(Actor actor)
+{
+  return GetImpl(*this).SetCurrentFocusActor(actor);
+}
+
+Actor AccessibilityManager::GetCurrentFocusActor()
+{
+  return GetImpl(*this).GetCurrentFocusActor();
+}
+
+Actor AccessibilityManager::GetCurrentFocusGroup()
+{
+  return GetImpl(*this).GetCurrentFocusGroup();
+}
+
+unsigned int AccessibilityManager::GetCurrentFocusOrder()
+{
+  return GetImpl(*this).GetCurrentFocusOrder();
+}
+
+bool AccessibilityManager::MoveFocusForward()
+{
+  return GetImpl(*this).MoveFocusForward();
+}
+
+bool AccessibilityManager::MoveFocusBackward()
+{
+  return GetImpl(*this).MoveFocusBackward();
+}
+
+void AccessibilityManager::ClearFocus()
+{
+  GetImpl(*this).ClearFocus();
+}
+
+void AccessibilityManager::Reset()
+{
+  GetImpl(*this).Reset();
+}
+
+void AccessibilityManager::SetFocusGroup(Actor actor, bool isFocusGroup)
+{
+  GetImpl(*this).SetFocusGroup(actor, isFocusGroup);
+}
+
+bool AccessibilityManager::IsFocusGroup(Actor actor) const
+{
+  return GetImpl(*this).IsFocusGroup(actor);
+}
+
+void AccessibilityManager::SetGroupMode(bool enabled)
+{
+  GetImpl(*this).SetGroupMode(enabled);
+}
+
+bool AccessibilityManager::GetGroupMode() const
+{
+  return GetImpl(*this).GetGroupMode();
+}
+
+void AccessibilityManager::SetWrapMode(bool wrapped)
+{
+  GetImpl(*this).SetWrapMode(wrapped);
+}
+
+bool AccessibilityManager::GetWrapMode() const
+{
+  return GetImpl(*this).GetWrapMode();
+}
+
+void AccessibilityManager::SetFocusIndicatorActor(Actor indicator)
+{
+  GetImpl(*this).SetFocusIndicatorActor(indicator);
+}
+
+Actor AccessibilityManager::GetFocusIndicatorActor()
+{
+  return GetImpl(*this).GetFocusIndicatorActor();
+}
+
+Actor AccessibilityManager::GetFocusGroup(Actor actor)
+{
+  return GetImpl(*this).GetFocusGroup(actor);
+}
+
+AccessibilityManager::FocusChangedSignalType& AccessibilityManager::FocusChangedSignal()
+{
+  return GetImpl(*this).FocusChangedSignal();
+}
+
+AccessibilityManager::FocusOvershotSignalType& AccessibilityManager::FocusOvershotSignal()
+{
+  return GetImpl(*this).FocusOvershotSignal();
+}
+
+AccessibilityManager::FocusedActorActivatedSignalType& AccessibilityManager::FocusedActorActivatedSignal()
+{
+  return GetImpl(*this).FocusedActorActivatedSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::StatusChangedSignal()
+{
+  return GetImpl(*this).StatusChangedSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionNextSignal()
+{
+  return GetImpl(*this).ActionNextSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPreviousSignal()
+{
+  return GetImpl(*this).ActionPreviousSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionActivateSignal()
+{
+  return GetImpl(*this).ActionActivateSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionOverSignal()
+{
+  return GetImpl(*this).ActionOverSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadSignal()
+{
+  return GetImpl(*this).ActionReadSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadNextSignal()
+{
+  return GetImpl(*this).ActionReadNextSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPreviousSignal()
+{
+  return GetImpl(*this).ActionReadPreviousSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionUpSignal()
+{
+  return GetImpl(*this).ActionUpSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionDownSignal()
+{
+  return GetImpl(*this).ActionDownSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionClearFocusSignal()
+{
+  return GetImpl(*this).ActionClearFocusSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionBackSignal()
+{
+  return GetImpl(*this).ActionBackSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionScrollUpSignal()
+{
+  return GetImpl(*this).ActionScrollUpSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionScrollDownSignal()
+{
+  return GetImpl(*this).ActionScrollDownSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageLeftSignal()
+{
+  return GetImpl(*this).ActionPageLeftSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageRightSignal()
+{
+  return GetImpl(*this).ActionPageRightSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageUpSignal()
+{
+  return GetImpl(*this).ActionPageUpSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageDownSignal()
+{
+  return GetImpl(*this).ActionPageDownSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionMoveToFirstSignal()
+{
+  return GetImpl(*this).ActionMoveToFirstSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionMoveToLastSignal()
+{
+  return GetImpl(*this).ActionMoveToLastSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadFromTopSignal()
+{
+  return GetImpl(*this).ActionReadFromTopSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadFromNextSignal()
+{
+  return GetImpl(*this).ActionReadFromNextSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionZoomSignal()
+{
+  return GetImpl(*this).ActionZoomSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadIndicatorInformationSignal()
+{
+  return GetImpl(*this).ActionReadIndicatorInformationSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPauseResumeSignal()
+{
+  return GetImpl(*this).ActionReadPauseResumeSignal();
+}
+
+AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionStartStopSignal()
+{
+  return GetImpl(*this).ActionStartStopSignal();
+}
+
+AccessibilityManager::AccessibilityActionScrollSignalType& AccessibilityManager::ActionScrollSignal()
+{
+  return GetImpl(*this).ActionScrollSignal();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/public-api/accessibility-manager/accessibility-manager.h b/dali-toolkit/public-api/accessibility-manager/accessibility-manager.h
new file mode 100644 (file)
index 0000000..703d414
--- /dev/null
@@ -0,0 +1,751 @@
+#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
+
+/*
+ * Copyright (c) 2015 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 <dali/public-api/actors/actor.h>
+#include <dali/public-api/actors/image-actor.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal DALI_INTERNAL
+{
+class AccessibilityManager;
+}
+
+/**
+ * @brief Manages registration of actors in a accessibility focus chain and changing the
+ * focused actor within that chain.
+ *
+ * This class provides the functionality of registering the focus order and description
+ * of actors and maintaining the focus chain.
+ *
+ * It provides functionality of setting the
+ * focus and moving the focus forward and backward. It also draws a highlight for the
+ * focused actor and emits a signal when the focus is changed.
+ *
+ * Signals
+ * | %Signal Name            | Method                             |
+ * |-------------------------|------------------------------------|
+ * | focus-changed           | @ref FocusChangedSignal()          |
+ * | focus-overshot          | @ref FocusOvershotSignal()         |
+ * | focused-actor-activated | @ref FocusedActorActivatedSignal() |
+ */
+class DALI_IMPORT_API AccessibilityManager : public BaseHandle
+{
+public:
+
+  // Typedefs
+
+  /**
+   * @brief Accessibility Action Signal.
+   *
+   * The connected signal callback should return true if handled.
+   */
+  typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType; ///< Generic signal type
+  typedef Signal< bool ( AccessibilityManager&, const Dali::TouchEvent& )> AccessibilityActionScrollSignalType; ///< Scroll signal type
+
+  /**
+   * @brief Accessibility needs four information which will be read by screen-reader.
+   *
+   * Reading order : Label -> Trait -> Optional (Value and Hint)
+   */
+  enum AccessibilityAttribute
+  {
+    ACCESSIBILITY_LABEL = 0, ///< Simple text which contained in ui-control
+    ACCESSIBILITY_TRAIT,     ///< Description of ui-control trait
+    ACCESSIBILITY_VALUE,     ///< Current value of ui-control (Optional)
+    ACCESSIBILITY_HINT,      ///< Hint for action (Optional)
+    ACCESSIBILITY_ATTRIBUTE_NUM ///< Number of attributes
+  };
+
+   /**
+    * @brief Overshoot direction.
+    */
+  enum FocusOvershotDirection
+  {
+    OVERSHOT_PREVIOUS = -1, ///< Try to move previous of the first actor
+    OVERSHOT_NEXT = 1,      ///< Try to move next of the last actor
+  };
+
+ public:
+
+  /// @brief Focus changed signal
+  typedef Signal< void ( Actor, Actor ) > FocusChangedSignalType;
+
+  /// @brief Focus overshooted signal
+  typedef Signal< void ( Actor, FocusOvershotDirection ) > FocusOvershotSignalType;
+
+  /// @brief Focused actor activated signal
+  typedef Signal< void ( Actor ) > FocusedActorActivatedSignalType;
+
+  /**
+   * @brief Create a AccessibilityManager handle; this can be initialised with AccessibilityManager::New().
+   *
+   * Calling member functions with an uninitialised handle is not allowed.
+   */
+  AccessibilityManager();
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~AccessibilityManager();
+
+  /**
+   * @brief Get the singleton of AccessibilityManager object.
+   *
+   * @return A handle to the AccessibilityManager control.
+   */
+  static AccessibilityManager Get();
+
+  /**
+   * @brief Set the information of the specified actor's accessibility attribute.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The Actor has been initialized.
+   * @param actor The actor the text to be set with
+   * @param type The attribute type the text to be set with
+   * @param text The text for the actor's accessibility information
+   */
+  void SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text);
+
+  /**
+   * @brief Get the text of the specified actor's accessibility attribute.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The Actor has been initialized.
+   * @param actor The actor to be queried
+   * @param type The attribute type to be queried
+   * @return The text of the actor's accessibility information
+   */
+  std::string GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const;
+
+  /**
+   * @brief Set the focus order of the actor.
+   *
+   * The focus order of each actor in the focus chain is unique. If
+   * there is another actor assigned with the same focus order
+   * already, the new actor will be inserted to the focus chain with
+   * that focus order, and the focus order of the original actor and
+   * all the actors followed in the focus chain will be increased
+   * accordingly. If the focus order assigned to the actor is 0, it
+   * means that actor's focus order is undefined (e.g. the actor has a
+   * description but with no focus order being set yet) and therefore
+   * that actor is not focusable.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The Actor has been initialized.
+   * @param actor The actor the focus order to be set with
+   * @param order The focus order of the actor
+   */
+  void SetFocusOrder(Actor actor, const unsigned int order);
+
+  /**
+   * @brief Get the focus order of the actor.
+   *
+   * When the focus order is 0, it means the focus order of the actor
+   * is undefined.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The Actor has been initialized.
+   * @param actor The actor to be queried
+   * @return The focus order of the actor
+   */
+  unsigned int GetFocusOrder(Actor actor) const;
+
+  /**
+   * @brief Generates a new focus order number which can be used to
+   * assign to actors which need to be appended to the end of the
+   * current focus order chain.
+   *
+   * The new number will be an increment over the very last focus
+   * order number in the focus chain. If the focus chain is empty then
+   * the function returns 1, else the number returned will be FOLast +
+   * 1 where FOLast is the focus order of the very last control in the
+   * focus chain.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @return The focus order of the actor
+   */
+  unsigned int GenerateNewFocusOrder() const;
+
+  /**
+   * @brief Get the actor that has the specified focus order.
+   *
+   * It will return an empty handle if the actor is not in the stage
+   * or has a focus order of 0.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @param order The focus order of the actor
+   *
+   * @return The actor that has the specified focus order or an empty
+   * handle if no actor in the stage has the specified focus order.
+   */
+  Actor GetActorByFocusOrder(const unsigned int order);
+
+  /**
+   * @brief Move the focus to the specified actor.
+   *
+   * Only one actor can be focused at the same time.  The actor must
+   * have a defined focus order and must be focusable, visible and in
+   * the stage.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The Actor has been initialized.
+   * @param actor The actor to be focused
+   * @return Whether the focus is successful or not
+   */
+  bool SetCurrentFocusActor(Actor actor);
+
+  /**
+   * @brief Get the current focused actor.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @return A handle to the current focused actor or an empty handle if no actor is focused.
+   */
+  Actor GetCurrentFocusActor();
+
+  /**
+   * @brief Get the focus group of current focused actor.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   *
+   * @return A handle to the immediate parent of the current focused
+   * actor which is also a focus group, or an empty handle if no actor
+   * is focused.
+   */
+  Actor GetCurrentFocusGroup();
+
+  /**
+   * @brief Get the focus order of currently focused actor.
+   * @pre The AccessibilityManager has been initialized.
+   *
+   * @return The focus order of the currently focused actor or 0 if no
+   * actor is in focus.
+   */
+  unsigned int GetCurrentFocusOrder();
+
+  /**
+   * @brief Move the focus to the next focusable actor in the focus
+   * chain (according to the focus traversal order).
+   *
+   * When the focus movement is wrapped around, the focus will be moved
+   * to the first focusable actor when it reaches the end of the focus chain.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @return true if the moving was successful
+   */
+  bool MoveFocusForward();
+
+  /**
+   * @brief Move the focus to the previous focusable actor in the
+   * focus chain (according to the focus traversal order).
+   *
+   * When the focus movement is wrapped around, the focus will be
+   * moved to the last focusable actor when it reaches the beginning
+   * of the focus chain.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @return true if the moving was successful
+   */
+  bool MoveFocusBackward();
+
+  /**
+   * @brief Clear the focus from the current focused actor if any, so
+   * that no actor is focused in the focus chain.
+   *
+   * It will emit focus changed signal without current focused actor
+   * @pre The AccessibilityManager has been initialized.
+   */
+  void ClearFocus();
+
+  /**
+   * @brief Clear the every registered focusable actor from focus-manager.
+   * @pre The AccessibilityManager has been initialized.
+   */
+  void Reset();
+
+  /**
+   * @brief Set whether an actor is a focus group that can limit the
+   * scope of focus movement to its child actors in the focus chain.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The Actor has been initialized.
+   * @param actor The actor to be set as a focus group.
+   * @param isFocusGroup Whether to set the actor to be a focus group or not.
+   */
+  void SetFocusGroup(Actor actor, bool isFocusGroup);
+
+  /**
+   * @brief Check whether the actor is set as a focus group or not.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The Actor has been initialized.
+   * @param actor The actor to be checked.
+   * @return Whether the actor is set as a focus group.
+   */
+  bool IsFocusGroup(Actor actor) const;
+
+  /**
+   * @brief Set whether the group mode is enabled or not.
+   *
+   * When the group mode is enabled, the focus movement will be limited to the child actors
+   * of the current focus group including the current focus group itself. The current focus
+   * group is the closest ancestor of the current focused actor that set as a focus group.
+   * @pre The AccessibilityManager has been initialized.
+   * @param enabled Whether the group mode is enabled or not
+   */
+  void SetGroupMode(bool enabled);
+
+  /**
+   * @brief Get whether the group mode is enabled or not.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @return Whether the group mode is enabled or not.
+   */
+  bool GetGroupMode() const;
+
+  /**
+   * @brief Set whether focus will be moved to the beginning of the
+   * focus chain when it reaches the end or vice versa.
+   *
+   * When both the wrap mode and the group mode are enabled, focus will be
+   * wrapped within the current focus group. Focus will not be wrapped in default.
+   * @pre The AccessibilityManager has been initialized.
+   * @param wrapped Whether the focus movement is wrapped around or not
+   */
+  void SetWrapMode(bool wrapped);
+
+  /**
+   * @brief Get whether the wrap mode is enabled or not.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @return Whether the wrap mode is enabled or not.
+   */
+  bool GetWrapMode() const;
+
+  /**
+   * @brief Set the focus indicator actor.
+   *
+   * This will replace the default focus indicator actor in
+   * AccessibilityManager and will be added to the focused actor as a
+   * highlight.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @pre The indicator actor has been initialized.
+   * @param indicator The indicator actor to be added
+   */
+  void SetFocusIndicatorActor(Actor indicator);
+
+  /**
+   * @brief Get the focus indicator actor.
+   *
+   * @pre The AccessibilityManager has been initialized.
+   * @return A handle to the focus indicator actor
+   */
+  Actor GetFocusIndicatorActor();
+
+  /**
+   * @brief Returns the closest ancestor of the given actor that is a focus group.
+   *
+   * @param actor The actor to be checked for its focus group
+   * @return The focus group the given actor belongs to or an empty handle if the given actor doesn't belong to any focus group
+   */
+  Actor GetFocusGroup(Actor actor);
+
+ public: // Signals
+
+  /**
+   * @brief This signal is emitted when the current focused actor is changed.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(Actor originalFocusedActor, Actor currentFocusedActor);
+   * @endcode
+   * @pre The Object has been initialized.
+   * @return The signal to connect to.
+   */
+  FocusChangedSignalType& FocusChangedSignal();
+
+  /**
+   * @brief This signal is emitted when there is no way to move focus further.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(Actor currentFocusedActor, FocusOvershotDirection direction);
+   * @endcode
+   * @pre The Object has been initialized.
+   * @return The signal to connect to.
+   */
+  FocusOvershotSignalType& FocusOvershotSignal();
+
+  /**
+   * @brief This signal is emitted when the current focused actor is activated.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(Actor activatedActor);
+   * @endcode
+   * @pre The Object has been initialized.
+   * @return The signal to connect to.
+   */
+  FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+
+ public: // Accessibility action signals.
+
+  /**
+   * @brief This is emitted when accessibility(screen-reader) feature turned on or off.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& StatusChangedSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to move focus to the next
+   * focusable actor (by one finger flick down).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionNextSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to move focus to the previous
+   * focusable actor (by one finger flick up).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionPreviousSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to activate the current focused
+   * actor (by one finger double tap).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionActivateSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to focus and read the actor
+   * (by one finger tap).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionReadSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to focus and read the actor
+   * (by one finger move).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionOverSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to move focus to the next
+   * focusable actor (by one finger flick right).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionReadNextSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to move focus to the previous
+   * focusable actor (by one finger flick left).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionReadPreviousSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to change the value when the
+   * current focused actor is a slider (by double finger down and move up and right).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionUpSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to change the value when the
+   * current focused actor is a slider (by double finger down and move down and left).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionDownSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to clear the focus from the
+   * current focused actor if any, so that no actor is focused in the focus chain.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionClearFocusSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to navigate back (by two
+   * fingers circle draw).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionBackSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to scroll up the list
+   * (by two finger swipe up).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionScrollUpSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to scroll down the list
+   * (by two finger swipe down).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionScrollDownSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to scroll left to the
+   * previous page (by two finger swipe left)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionPageLeftSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to scroll right to the
+   * next page (by two finger swipe right)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionPageRightSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to scroll up to the
+   * previous page (by one finger swipe left and right)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionPageUpSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to scroll down to the
+   * next page (by one finger swipe right and left)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionPageDownSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to move the focus to
+   * the first item on the screen (by one finger swipe up and down)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionMoveToFirstSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to move the focus to
+   * the last item on the screen (by one finger swipe down and up)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionMoveToLastSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to focus and read from the
+   * first item on the top continously (by three fingers single tap)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionReadFromTopSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to move the focus to and
+   * read from the next item continously (by three fingers double tap)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionReadFromNextSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to zoom (by one finger
+   * triple tap)
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionZoomSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to read the information
+   * in the indicator (by two fingers triple tap).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionReadIndicatorInformationSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to pause/resume the
+   * current speech (by two fingers single tap).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionReadPauseResumeSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to start/stop the
+   * current action (by two fingers double tap).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionSignalType& ActionStartStopSignal();
+
+  /**
+   * @brief This is emitted when accessibility action is received to handle scroll event (by two
+   * fingers drag).
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallback( AccessibilityManager& manager, const TouchEvent& event );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  AccessibilityActionScrollSignalType& ActionScrollSignal();
+
+public:
+
+  explicit DALI_INTERNAL AccessibilityManager( Internal::AccessibilityManager *impl );
+
+}; // class AccessibilityManager
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
@@ -1,5 +1,5 @@
-#ifndef __DALI_V8PLUGIN_MESH_ACTOR_API_H__
-#define __DALI_V8PLUGIN_MESH_ACTOR_API_H__
+#ifndef __DALI_TOOLKIT_CONTROL_DEPTH_INDEX_RANGES_H__
+#define __DALI_TOOLKIT_CONTROL_DEPTH_INDEX_RANGES_H__
 
 /*
  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  *
  */
 
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/devel-api/actors/mesh-actor.h>
-
 namespace Dali
 {
-
-namespace V8Plugin
+namespace Toolkit
 {
-
-namespace MeshActorApi
+enum ControlDepthIndexRanges
 {
-  /**
-   * constructor
-   */
-  Actor New( const v8::FunctionCallbackInfo< v8::Value >& args );
-}; // namespace MeshActorApi
+    BACKGROUND_DEPTH_INDEX    = -10000000,
+    CONTENT_DEPTH_INDEX       =  0,
+    DECORATION_DEPTH_INDEX    =  10000000
+};
+
+}
 
-} // namespace V8Plugin
+}
 
-} // namespace Dali
 
-#endif // header __DALI_V8PLUGIN_MESH_ACTOR_API_H__
+#endif
index ee5d0fd..271a5ce 100644 (file)
 #include <limits>
 #include <stack>
 #include <dali/public-api/actors/image-actor.h>
-#include <dali/devel-api/actors/mesh-actor.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
-#include <dali/devel-api/geometry/mesh.h>
 #include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/size-negotiation/relayout-container.h>
 #include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/devel-api/rendering/renderer.h>
 #include <dali/devel-api/scripting/scripting.h>
-#include <dali/public-api/size-negotiation/relayout-container.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 #include <dali-toolkit/public-api/controls/control.h>
@@ -64,12 +64,12 @@ BaseHandle Create()
  * @param[in] attributes The attributes with which to perfrom this action.
  * @return true if action has been accepted by this control
  */
-const char* ACTION_CONTROL_ACTIVATED = "control-activated";
+const char* ACTION_ACCESSIBILITY_ACTIVATED = "accessibility-activated";
 static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
 {
   bool ret = false;
 
-  if( object && ( 0 == strcmp( actionName.c_str(), ACTION_CONTROL_ACTIVATED ) ) )
+  if( object && ( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_ACTIVATED ) ) )
   {
     Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
     if( control )
@@ -158,7 +158,7 @@ SignalConnectorType registerSignal5( typeRegistration, SIGNAL_PANNED, &DoConnect
 SignalConnectorType registerSignal6( typeRegistration, SIGNAL_PINCHED, &DoConnectSignal );
 SignalConnectorType registerSignal7( typeRegistration, SIGNAL_LONG_PRESSED, &DoConnectSignal );
 
-TypeAction registerAction( typeRegistration, ACTION_CONTROL_ACTIVATED, &DoAction );
+TypeAction registerAction( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &DoAction );
 
 DALI_TYPE_REGISTRATION_END()
 
@@ -167,7 +167,7 @@ DALI_TYPE_REGISTRATION_END()
  */
 struct Background
 {
-  Actor actor;   ///< Either a MeshActor or an ImageActor
+  Actor actor;   ///< Background actor
   Vector4 color; ///< The color of the actor.
 
   /**
@@ -180,69 +180,108 @@ struct Background
   }
 };
 
-/**
- * Creates a white coloured Mesh.
- */
-Mesh CreateMesh()
-{
-  Vector3 white( Color::WHITE );
+unsigned int gQuadIndex[6] = { 0, 2, 1, 1, 2, 3 };
 
-  MeshData meshData;
+Vector2 gQuad[] = {
+                   Vector2( -0.5f, -0.5f ),
+                   Vector2(  0.5f, -0.5f ),
+                   Vector2( -0.5f,  0.5f ),
+                   Vector2(  0.5f,  0.5f )
+};
 
-  // Create vertices with a white color (actual color is set by actor color)
-  MeshData::VertexContainer vertices(4);
-  vertices[ 0 ] = MeshData::Vertex( Vector3( -0.5f, -0.5f, 0.0f ), Vector2::ZERO, white );
-  vertices[ 1 ] = MeshData::Vertex( Vector3(  0.5f, -0.5f, 0.0f ), Vector2::ZERO, white );
-  vertices[ 2 ] = MeshData::Vertex( Vector3( -0.5f,  0.5f, 0.0f ), Vector2::ZERO, white );
-  vertices[ 3 ] = MeshData::Vertex( Vector3(  0.5f,  0.5f, 0.0f ), Vector2::ZERO, white );
 
-  // Specify all the faces
-  MeshData::FaceIndices faces;
-  faces.reserve( 6 ); // 2 triangles in Quad
-  faces.push_back( 0 ); faces.push_back( 3 ); faces.push_back( 1 );
-  faces.push_back( 0 ); faces.push_back( 2 ); faces.push_back( 3 );
+const char* VERTEX_SHADER_COLOR = DALI_COMPOSE_SHADER(
+    attribute mediump vec2 aPosition;\n
+    uniform mediump mat4 uMvpMatrix;\n
+    void main()\n
+    {\n
+      gl_Position = uMvpMatrix * vec4( aPosition, 0.0, 1.0 );\n
+    }\n
+);
 
-  // Create the mesh data from the vertices and faces
-  meshData.SetMaterial( Material::New( "ControlMaterial" ) );
-  meshData.SetVertices( vertices );
-  meshData.SetFaceIndices( faces );
-  meshData.SetHasColor( true );
+const char* FRAGMENT_SHADER_COLOR = DALI_COMPOSE_SHADER(
+    uniform lowp vec4 uBackgroundColor;\n
+    uniform lowp vec4 uColor;\n
+    void main()\n
+    {\n
+      gl_FragColor = uBackgroundColor * uColor;\n
+    }\n
+);
 
-  return Mesh::New( meshData );
-}
 
 /**
- * Sets all the required properties for the background actor.
+ * @brief Create the background actor for the control.
  *
- * @param[in]  actor              The actor to set the properties on.
- * @param[in]  color              The required color of the actor.
- */
-void SetupBackgroundActor( Actor actor, const Vector4& color )
-{
-  actor.SetColor( color );
-  actor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
-  actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
-  actor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-}
-
-/**
- * Sets all the required properties for the background actor.
+ * @param[in] actor The parent actor of the background
+ * @param[in] color The background color
+ * @param[in] image If a valid image is supplied this will be the texture used by the background
+ *
+ * @return An actor which will render the background
  *
- * @param[in]  actor              The actor to set the properties on.
- * @param[in]  constrainingIndex  The property index to constrain the parent's size on.
- * @param[in]  color              The required color of the actor.
  */
-void SetupBackgroundActorConstrained( Actor actor, Property::Index constrainingIndex, const Vector4& color )
+Actor CreateBackground( Actor parent, const Vector4& color, Image image = Image() )
 {
-  actor.SetColor( color );
-  actor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
-  actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
+  if( !image )
+  {
+    PropertyBuffer vertexBuffer;
+    Shader shader;
+    Material material;
+
+    Property::Map vertexFormat;
+    vertexFormat["aPosition"] = Property::VECTOR2;
+
+    //Create a vertex buffer for vertex positions
+    vertexBuffer = PropertyBuffer::New( vertexFormat, 4u );
+    vertexBuffer.SetData( gQuad );
+
+    shader = Shader::New( VERTEX_SHADER_COLOR, FRAGMENT_SHADER_COLOR );
+    material = Material::New( shader );
+
+    //Create the index buffer
+    Property::Map indexFormat;
+    indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+    PropertyBuffer indexBuffer = PropertyBuffer::New( indexFormat, 6u );
+    indexBuffer.SetData(gQuadIndex);
+
+    //Create the geometry
+    Geometry mesh = Geometry::New();
+    mesh.AddVertexBuffer( vertexBuffer );
+    mesh.SetIndexBuffer( indexBuffer );
+
+    //Add uniforms to the shader
+    shader.RegisterProperty( "uBackgroundColor", color );
+
+    //Create the renderer
+    Renderer renderer = Renderer::New( mesh, material );
+    renderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX );
+
+    //Create the actor
+    Actor meshActor = Actor::New();
+    meshActor.SetSize( Vector3::ONE );
+    meshActor.AddRenderer( renderer );
+    meshActor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
+    meshActor.SetColorMode( USE_PARENT_COLOR );
+
+    //Constraint scale of the mesh actor to the size of the control
+    Constraint constraint = Constraint::New<Vector3>( meshActor,
+                                                      Actor::Property::SCALE,
+                                                      EqualToConstraint() );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.Apply();
+
+    return meshActor;
+  }
+  else
+  {
+    ImageActor imageActor = ImageActor::New( image );
+    imageActor.SetColor( color );
+    imageActor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
+    imageActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
+    imageActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+    return imageActor;
+  }
 
-  Constraint constraint = Constraint::New<Vector3>( actor,
-                                                    constrainingIndex,
-                                                    EqualToConstraint() );
-  constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
-  constraint.Apply();
 }
 
 } // unnamed namespace
@@ -256,21 +295,21 @@ public:
 
   // Construction & Destruction
   Impl(Control& controlImpl)
-  : mControlImpl( controlImpl ),
-    mStyleName(""),
-    mBackground( NULL ),
-    mStartingPinchScale( NULL ),
-    mKeyEventSignal(),
-    mPinchGestureDetector(),
-    mPanGestureDetector(),
-    mTapGestureDetector(),
-    mLongPressGestureDetector(),
-    mFlags( Control::ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
-    mIsKeyboardNavigationSupported( false ),
-    mIsKeyboardFocusGroup( false ),
-    mAddRemoveBackgroundChild( false )
-  {
-  }
+: mControlImpl( controlImpl ),
+  mStyleName(""),
+  mBackground( NULL ),
+  mStartingPinchScale( NULL ),
+  mKeyEventSignal(),
+  mPinchGestureDetector(),
+  mPanGestureDetector(),
+  mTapGestureDetector(),
+  mLongPressGestureDetector(),
+  mFlags( Control::ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
+  mIsKeyboardNavigationSupported( false ),
+  mIsKeyboardFocusGroup( false ),
+  mAddRemoveBackgroundChild( false )
+{
+}
 
   ~Impl()
   {
@@ -412,13 +451,24 @@ public:
           Property::Map map;
 
           Background* back = controlImpl.mImpl->mBackground;
-          if( back )
+          if ( back && back->actor )
           {
-            ImageActor imageActor = ImageActor::DownCast( back->actor );
-            if ( imageActor )
+            if( back->actor.GetRendererCount() > 0 && back->actor.GetRendererAt(0).GetMaterial().GetNumberOfSamplers() > 0 )
+            {
+              Image image = back->actor.GetRendererAt(0).GetMaterial().GetSamplerAt(0).GetImage();
+              if ( image )
+              {
+                Scripting::CreatePropertyMap( image, map );
+              }
+            }
+            else
             {
-              Image image = imageActor.GetImage();
-              Scripting::CreatePropertyMap( image, map );
+              ImageActor imageActor = ImageActor::DownCast( back->actor );
+              if ( imageActor )
+              {
+                Image image = imageActor.GetImage();
+                Scripting::CreatePropertyMap( image, map );
+              }
             }
           }
 
@@ -514,21 +564,24 @@ void Control::SetBackgroundColor( const Vector4& color )
 
   if ( background.actor )
   {
-    // Just set the actor color
-    background.actor.SetColor( color );
+    if( background.actor.GetRendererCount() > 0 )
+    {
+      Shader shader = background.actor.GetRendererAt(0).GetMaterial().GetShader();
+      shader.SetProperty( shader.GetPropertyIndex("uBackgroundColor"), color );
+    }
+    else
+    {
+      background.actor.SetColor( color );
+    }
   }
   else
   {
     // Create Mesh Actor
-    MeshActor meshActor = MeshActor::New( CreateMesh() );
-
-    SetupBackgroundActorConstrained( meshActor, Actor::Property::SCALE, color );
-
-    background.actor = meshActor;
-    // Set the flag to avoid notifying children
+    Actor actor = CreateBackground(Self(), color );
+    background.actor = actor;
     mImpl->mAddRemoveBackgroundChild = true;
     // use insert to guarantee its the first child (so that OVERLAY mode works)
-    Self().Insert( 0, meshActor );
+    Self().Insert( 0, actor );
     mImpl->mAddRemoveBackgroundChild = false;
   }
 
@@ -548,24 +601,23 @@ void Control::SetBackgroundImage( Image image )
 {
   Background& background( mImpl->GetBackground() );
 
-  if ( background.actor )
-  {
-    // Remove Current actor, unset AFTER removal
-    mImpl->mAddRemoveBackgroundChild = true;
-    Self().Remove( background.actor );
-    mImpl->mAddRemoveBackgroundChild = false;
-    background.actor.Reset();
-  }
+   if ( background.actor )
+   {
+     // Remove Current actor, unset AFTER removal
+     mImpl->mAddRemoveBackgroundChild = true;
+     Self().Remove( background.actor );
+     mImpl->mAddRemoveBackgroundChild = false;
+     background.actor.Reset();
+   }
 
-  ImageActor imageActor = ImageActor::New( image );
-  SetupBackgroundActor( imageActor, background.color );
+   Actor actor = CreateBackground(Self(), background.color, image);
 
-  // Set the background actor before adding so that we do not inform derived classes
-  background.actor = imageActor;
-  mImpl->mAddRemoveBackgroundChild = true;
-  // use insert to guarantee its the first child (so that OVERLAY mode works)
-  Self().Insert( 0, imageActor );
-  mImpl->mAddRemoveBackgroundChild = false;
+   // Set the background actor before adding so that we do not inform derived classes
+   background.actor = actor;
+   mImpl->mAddRemoveBackgroundChild = true;
+   // use insert to guarantee its the first child (so that OVERLAY mode works)
+   Self().Insert( 0, actor );
+   mImpl->mAddRemoveBackgroundChild = false;
 }
 
 void Control::ClearBackground()
@@ -715,11 +767,22 @@ void Control::AccessibilityActivate()
   OnAccessibilityActivated();
 }
 
+void Control::KeyboardEnter()
+{
+  // Inform deriving classes
+  OnKeyboardEnter();
+}
+
 bool Control::OnAccessibilityActivated()
 {
   return false; // Accessibility activation is not handled by default
 }
 
+bool Control::OnKeyboardEnter()
+{
+  return false; // Keyboard enter is not handled by default
+}
+
 bool Control::OnAccessibilityPan(PanGesture gesture)
 {
   return false; // Accessibility pan gesture is not handled by default
@@ -735,6 +798,11 @@ bool Control::OnAccessibilityValueChange(bool isIncrease)
   return false; // Accessibility value change action is not handled by default
 }
 
+bool Control::OnAccessibilityZoom()
+{
+  return false; // Accessibility zoom action is not handled by default
+}
+
 Actor Control::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled)
 {
   return Actor();
@@ -865,11 +933,11 @@ void Control::EmitKeyInputFocusSignal( bool focusGained )
 
   if ( focusGained )
   {
-     // signals are allocated dynamically when someone connects
-     if ( !mImpl->mKeyInputFocusGainedSignal.Empty() )
-     {
+    // signals are allocated dynamically when someone connects
+    if ( !mImpl->mKeyInputFocusGainedSignal.Empty() )
+    {
       mImpl->mKeyInputFocusGainedSignal.Emit( handle );
-     }
+    }
   }
   else
   {
@@ -881,8 +949,38 @@ void Control::EmitKeyInputFocusSignal( bool focusGained )
   }
 }
 
-void Control::OnStageConnection()
+void Control::OnStageConnection( unsigned int depth )
 {
+  unsigned int controlRendererCount = Self().GetRendererCount();
+  for( unsigned int i(0); i<controlRendererCount; ++i )
+  {
+    Renderer controlRenderer = Self().GetRendererAt(i);
+    if( controlRenderer )
+    {
+      controlRenderer.SetDepthIndex( CONTENT_DEPTH_INDEX+depth );
+    }
+  }
+
+  if( mImpl->mBackground )
+  {
+    if(mImpl->mBackground->actor.GetRendererCount() > 0 )
+    {
+      Renderer backgroundRenderer = mImpl->mBackground->actor.GetRendererAt( 0 );
+      if(backgroundRenderer)
+      {
+        backgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX+depth );
+      }
+    }
+    else
+    {
+
+      ImageActor imageActor = ImageActor::DownCast( mImpl->mBackground->actor );
+      if ( imageActor )
+      {
+        imageActor.SetSortModifier( BACKGROUND_DEPTH_INDEX+depth );
+      }
+    }
+  }
 }
 
 void Control::OnStageDisconnection()
@@ -967,15 +1065,30 @@ void Control::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dime
 
 Vector3 Control::GetNaturalSize()
 {
+  //Control's natural size is the size of its background image if it has been set, or ZERO otherwise
+  Vector3 naturalSize = Vector3::ZERO;
   if( mImpl->mBackground )
   {
-    Actor actor = mImpl->mBackground->actor;
-    if( actor )
+    if( mImpl->mBackground->actor.GetRendererCount() > 0 )
     {
-      return actor.GetNaturalSize();
+      Material backgroundMaterial = mImpl->mBackground->actor.GetRendererAt(0).GetMaterial();
+      if( backgroundMaterial.GetNumberOfSamplers() > 0 )
+      {
+        Image backgroundImage =  backgroundMaterial.GetSamplerAt(0).GetImage();
+        if( backgroundImage )
+        {
+          naturalSize.x = backgroundImage.GetWidth();
+          naturalSize.y = backgroundImage.GetHeight();
+        }
+      }
+    }
+    else
+    {
+      return mImpl->mBackground->actor.GetNaturalSize();
     }
   }
-  return Vector3();
+
+  return naturalSize;
 }
 
 float Control::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
index 63ea4e9..1c3c35d 100644 (file)
@@ -222,13 +222,16 @@ public:
    */
   bool IsKeyboardFocusGroup();
 
-  // Called by Focus Manager
-
   /**
-   * @brief Called by the accessibility focus manager and keyboard focus manager to activate the Control
+   * @brief Called by the AccessibilityManager to activate the Control.
    */
   DALI_INTERNAL void AccessibilityActivate();
 
+  /**
+   * @brief Called by the KeyboardFocusManager.
+   */
+  DALI_INTERNAL void KeyboardEnter();
+
   // Signals
 
   /**
@@ -270,7 +273,7 @@ protected: // From CustomActorImpl, not to be used by application developers
   /**
    * @copydoc CustomActorImpl::OnStageConnection()
    */
-  virtual void OnStageConnection();
+  virtual void OnStageConnection( unsigned int depth );
 
   /**
    * @copydoc CustomActorImpl::OnStageDisconnection()
@@ -465,6 +468,14 @@ public: // API for derived classes to override
    */
   virtual bool OnAccessibilityValueChange( bool isIncrease );
 
+  /**
+   * @brief This method should be overridden by deriving classes when they wish to respond
+   * the accessibility zoom action
+   *
+   * @return true if the zoom action has been consumed by this control
+   */
+  virtual bool OnAccessibilityZoom();
+
   // Keyboard focus
 
   /**
@@ -502,6 +513,14 @@ public: // API for derived classes to override
    */
   virtual void OnKeyboardFocusChangeCommitted( Actor commitedFocusableActor );
 
+  /**
+   * @brief This method is called when the control has enter pressed on it.
+   *
+   * Derived classes should override this to perform custom actions.
+   * @return true if this control supported this action.
+   */
+  virtual bool OnKeyboardEnter();
+
   // Gestures
 
   /**
index e7511a1..1e4d74d 100644 (file)
@@ -59,9 +59,9 @@ class Control;
  * | long-pressed           | @ref GetLongPressGestureDetector().DetectedSignal() |
  *
  * Actions
- * | %Action Name      | %Control method called                              |
- * |-------------------|-----------------------------------------------------|
- * | control-activated | %OnActivated()                                      |
+ * | %Action Name            | %Control method called                             |
+ * |-------------------------|----------------------------------------------------|
+ * | accessibility-activated | %OnAccessibilityActivated()                        |
  */
 class DALI_IMPORT_API Control : public CustomActor
 {
index 2ed5f1e..cc1a2ae 100644 (file)
@@ -244,17 +244,6 @@ public:
   virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const = 0;
 
   /**
-   * @brief Retrieve the resize animation in the layout.
-   *
-   * @note This allows the layout to provide its own resize animation.
-   * @param[in] animation The resize animation, not owned by the layout
-   * @param[in] actor The actor to animate
-   * @param [in] size The target size.
-   * @param [in] durationSeconds The duration of the resizing.
-   */
-  virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const = 0;
-
-  /**
    * @brief Query the scroll direction of the layout.
    *
    * When an input gesture follows this direction, the layout-position of items will be increased.
index c92f36e..126c254 100644 (file)
@@ -29,10 +29,6 @@ namespace Dali
 namespace Toolkit
 {
 
-const std::string TableView::CELL_INDICES_PROPERTY_NAME("cell-indices");
-const std::string TableView::ROW_SPAN_PROPERTY_NAME("row-span");
-const std::string TableView::COLUMN_SPAN_PROPERTY_NAME("column-span");
-
 TableView::TableView()
 {
 }
@@ -137,22 +133,22 @@ Size TableView::GetCellPadding()
 
 void TableView::SetFitHeight( unsigned int rowIndex )
 {
-  GetImpl(*this).SetRowPolicy( rowIndex, Internal::TableView::FIT );
+  GetImpl(*this).SetFitHeight( rowIndex );
 }
 
 bool TableView::IsFitHeight( unsigned int rowIndex ) const
 {
-  return ( GetImpl(*this).GetRowPolicy( rowIndex ) == Internal::TableView::FIT );
+  return GetImpl(*this).IsFitHeight( rowIndex );
 }
 
 void TableView::SetFitWidth( unsigned int columnIndex )
 {
-  GetImpl(*this).SetColumnPolicy( columnIndex, Internal::TableView::FIT );
+  GetImpl(*this).SetFitWidth( columnIndex );
 }
 
 bool TableView::IsFitWidth( unsigned int columnIndex ) const
 {
-  return ( GetImpl(*this).GetColumnPolicy( columnIndex ) == Internal::TableView::FIT );
+  return GetImpl(*this).IsFitWidth( columnIndex );
 }
 
 void TableView::SetFixedHeight( unsigned int rowIndex, float height )
index 46e3437..c3f0545 100644 (file)
@@ -37,10 +37,46 @@ class TableView;
 }
 
 /**
- * TableView is a layout container for aligning child actors in a grid like layout.
+ * @brief TableView is a layout container for aligning child actors in a grid like layout.
+ *
  * TableView constrains the x and y position and width and height of the child actors.
  * z position and depth are left intact so that 3D model actors can also be laid out
  * in a grid without loosing their depth scaling.
+ *
+ * @nosubgrouping
+ * <h3>Per-child Custom properties for script supporting:</h3>
+ *
+ * When an actor is add to the tableView through Actor::Add() instead of TableView::AddChild,
+ * the following custom properties of the actor are checked to decide the actor position inside the table.
+ *
+ * These properties are registered dynamically to the child and is non-animatable.
+ *
+ * | %Property Name            | Type        |
+ * |---------------------------|-------------|
+ * | cell-index                | Vector2     |
+ * | row-span                  | float       |
+ * | column-span               | float       |
+ * | cell-horizontal-alignment | string      |
+ * | cell-vertical-alignment   | string      |
+ *
+ * The row-span or column span has integer value, but its type is float here due to the limitation of the builder's ability to differentiate integer and float from Json string.
+ * The available values for cell-horizontal-alignment are: left, center, right.
+ * The available values for cell-vertical-alignment are: top, center, bottom.
+ *
+ * @code
+ * "name":"gallery-1",
+ * "type":"ImageActor",
+ * "image": {
+ *    "filename": "{DALI_IMAGE_DIR}gallery-small-1.jpg"
+ *  },
+ *  "custom-properties": {
+ *     "cell-index":[1,1],  // property to specify the top-left cell this child occupies, if not set, the first available cell is used
+ *     "row-span":3,        // property to specify how many rows this child occupies, if not set, default value is 1
+ *     "column-span": 2,    // property to specify how many columns this child occupies, if nor set, default value is 1
+ *     "cell-horizontal-alignment": "left", // property to specify how to align horizontally inside the cells, if not set, default value is 'left'
+ *     "cell-vertical-alignment": "center"  // property to specify how to align vertically inside the cells, if not set, default value is 'top'
+ *   }
+ * @endcode
  */
 class DALI_IMPORT_API TableView : public Control
 {
@@ -64,7 +100,8 @@ public:
    * "layout-rows":
       {
         "0": { "policy": "fixed", "value": 40 },       //@see SetFixedHight
-        "2": { "policy": "relative", "value": 0.33 }   //@see SetRelativeHeight
+        "2": { "policy": "relative", "value": 0.33 },  //@see SetRelativeHeight
+        "3": { "policy": "fit", "value":0.0 }          //@see SetFitHeight, the value is not used, its height is decided by the children in this row
       }
    * @endcode
    *
@@ -74,6 +111,7 @@ public:
    * "layout-columns":
       {
         "0": { "policy": "fixed", "value": 40 },       //@see SetFixedWidth
+        "1": { "policy": "fit", "value":0.0 }          //@see SetFitHeight, the value is not used, its width is decided by the children in this column
         "2": { "policy": "relative", "value": 0.33 }   //@see SetRelativeWidth
       }
    * @endcode
@@ -90,11 +128,6 @@ public:
     };
   };
 
-  // Custom properties for where to put the actor, these properties should be registered to the child which would be added to the table
-  static const std::string CELL_INDICES_PROPERTY_NAME;           ///< Property, name "cell-indices", type Vector2
-  static const std::string ROW_SPAN_PROPERTY_NAME;               ///< Property, name "row-span",     type float (Currently builder is unable to differentiate integer and float from Json string)
-  static const std::string COLUMN_SPAN_PROPERTY_NAME;            ///< Property, name "column-span",  type float (Currently builder is unable to differentiate integer and float from Json string)
-
   /**
    * @brief Describes how the size of a row / column been set
    */
@@ -102,7 +135,8 @@ public:
   {
     FIXED,      ///< Fixed with the given value.
     RELATIVE,   ///< Calculated as percentage of the remainder after subtracting Padding and Fixed height/width
-    FILL        ///< Get the remainder of the 100% (after subtracting Padding, Fixed and Relative height/ width) divided evenly between 'fill' rows/columns
+    FILL,       ///< Default policy, get the remainder of the 100% (after subtracting Fixed, Fit and Relative height/ width) divided evenly between 'fill' rows/columns
+    FIT         ///< Fit around its children.
   };
 
   /**
@@ -382,11 +416,13 @@ public:
   unsigned int GetColumns();
 
   /**
-   * @brief Set the alignment on a cell
+   * @brief Set the alignment on a cell.
+   *
+   * Cells without calling this function have the default values of LEFT and TOP respectively.
    *
-   * @param[in] position The cell to set alignment on
-   * @param[in] horizontal The horizontal alignment
-   * @param[in] vertical The vertical alignment
+   * @param[in] position The cell to set alignment on.
+   * @param[in] horizontal The horizontal alignment.
+   * @param[in] vertical The vertical alignment.
    */
   void SetCellAlignment( CellPosition position, HorizontalAlignment::Type horizontal, VerticalAlignment::Type vertical );
 
index aed0470..172aa12 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 46;
+const unsigned int TOOLKIT_MICRO_VERSION = 47;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 76c306d..0109380 100755 (executable)
@@ -22,7 +22,7 @@ public_api_src_files = \
   $(public_api_src_dir)/controls/text-controls/text-label.cpp \
   $(public_api_src_dir)/controls/text-controls/text-field.cpp \
   $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \
-  $(public_api_src_dir)/focus-manager/accessibility-focus-manager.cpp \
+  $(public_api_src_dir)/accessibility-manager/accessibility-manager.cpp \
   $(public_api_src_dir)/focus-manager/keyboard-focus-manager.cpp \
   $(public_api_src_dir)/dali-toolkit-version.cpp \
   $(public_api_src_dir)/enums.cpp
@@ -78,8 +78,10 @@ public_api_text_controls_header_files = \
   $(public_api_src_dir)/controls/text-controls/text-label.h \
   $(public_api_src_dir)/controls/text-controls/text-field.h
 
+public_api_accessibility_manager_header_files = \
+  $(public_api_src_dir)/accessibility-manager/accessibility-manager.h
+
 public_api_focus_manager_header_files = \
-  $(public_api_src_dir)/focus-manager/accessibility-focus-manager.h \
   $(public_api_src_dir)/focus-manager/keyboard-focus-manager.h
 
 public_api_rendering_backend_header_files = \
diff --git a/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.cpp b/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.cpp
deleted file mode 100644 (file)
index 83af89d..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2015 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 <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/singleton-service.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-AccessibilityFocusManager::AccessibilityFocusManager()
-{
-}
-
-AccessibilityFocusManager::~AccessibilityFocusManager()
-{
-}
-
-AccessibilityFocusManager AccessibilityFocusManager::Get()
-{
-  AccessibilityFocusManager manager;
-
-  // Check whether the accessibility focus manager is already created
-  SingletonService singletonService( SingletonService::Get() );
-  if ( singletonService )
-  {
-    Dali::BaseHandle handle = singletonService.GetSingleton(typeid(AccessibilityFocusManager));
-    if(handle)
-    {
-      // If so, downcast the handle of singleton to focus manager
-      manager = AccessibilityFocusManager(dynamic_cast<Internal::AccessibilityFocusManager*>(handle.GetObjectPtr()));
-    }
-
-    if(!manager)
-    {
-      // If not, create the accessibility focus manager and register it as a singleton
-      manager = AccessibilityFocusManager(new Internal::AccessibilityFocusManager());
-      singletonService.Register(typeid(manager), manager);
-    }
-  }
-
-  return manager;
-}
-
-AccessibilityFocusManager::AccessibilityFocusManager(Internal::AccessibilityFocusManager *impl)
-  : BaseHandle(impl)
-{
-}
-
-void AccessibilityFocusManager::SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text)
-{
-  GetImpl(*this).SetAccessibilityAttribute(actor, type, text);
-}
-
-std::string AccessibilityFocusManager::GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const
-{
-  return GetImpl(*this).GetAccessibilityAttribute(actor, type);
-}
-
-void AccessibilityFocusManager::SetFocusOrder(Actor actor, const unsigned int order)
-{
-  GetImpl(*this).SetFocusOrder(actor, order);
-}
-
-unsigned int AccessibilityFocusManager::GetFocusOrder(Actor actor) const
-{
-  return GetImpl(*this).GetFocusOrder(actor);
-}
-
-unsigned int AccessibilityFocusManager::GenerateNewFocusOrder() const
-{
-  return GetImpl(*this).GenerateNewFocusOrder();
-}
-
-Actor AccessibilityFocusManager::GetActorByFocusOrder(const unsigned int order)
-{
-  return GetImpl(*this).GetActorByFocusOrder(order);
-}
-
-bool AccessibilityFocusManager::SetCurrentFocusActor(Actor actor)
-{
-  return GetImpl(*this).SetCurrentFocusActor(actor);
-}
-
-Actor AccessibilityFocusManager::GetCurrentFocusActor()
-{
-  return GetImpl(*this).GetCurrentFocusActor();
-}
-
-Actor AccessibilityFocusManager::GetCurrentFocusGroup()
-{
-  return GetImpl(*this).GetCurrentFocusGroup();
-}
-
-unsigned int AccessibilityFocusManager::GetCurrentFocusOrder()
-{
-  return GetImpl(*this).GetCurrentFocusOrder();
-}
-
-bool AccessibilityFocusManager::MoveFocusForward()
-{
-  return GetImpl(*this).MoveFocusForward();
-}
-
-bool AccessibilityFocusManager::MoveFocusBackward()
-{
-  return GetImpl(*this).MoveFocusBackward();
-}
-
-void AccessibilityFocusManager::ClearFocus()
-{
-  GetImpl(*this).ClearFocus();
-}
-
-void AccessibilityFocusManager::Reset()
-{
-  GetImpl(*this).Reset();
-}
-
-void AccessibilityFocusManager::SetFocusGroup(Actor actor, bool isFocusGroup)
-{
-  GetImpl(*this).SetFocusGroup(actor, isFocusGroup);
-}
-
-bool AccessibilityFocusManager::IsFocusGroup(Actor actor) const
-{
-  return GetImpl(*this).IsFocusGroup(actor);
-}
-
-void AccessibilityFocusManager::SetGroupMode(bool enabled)
-{
-  GetImpl(*this).SetGroupMode(enabled);
-}
-
-bool AccessibilityFocusManager::GetGroupMode() const
-{
-  return GetImpl(*this).GetGroupMode();
-}
-
-void AccessibilityFocusManager::SetWrapMode(bool wrapped)
-{
-  GetImpl(*this).SetWrapMode(wrapped);
-}
-
-bool AccessibilityFocusManager::GetWrapMode() const
-{
-  return GetImpl(*this).GetWrapMode();
-}
-
-void AccessibilityFocusManager::SetFocusIndicatorActor(Actor indicator)
-{
-  GetImpl(*this).SetFocusIndicatorActor(indicator);
-}
-
-Actor AccessibilityFocusManager::GetFocusIndicatorActor()
-{
-  return GetImpl(*this).GetFocusIndicatorActor();
-}
-
-Actor AccessibilityFocusManager::GetFocusGroup(Actor actor)
-{
-  return GetImpl(*this).GetFocusGroup(actor);
-}
-
-AccessibilityFocusManager::FocusChangedSignalType& AccessibilityFocusManager::FocusChangedSignal()
-{
-  return GetImpl(*this).FocusChangedSignal();
-}
-
-AccessibilityFocusManager::FocusOvershotSignalType& AccessibilityFocusManager::FocusOvershotSignal()
-{
-  return GetImpl(*this).FocusOvershotSignal();
-}
-
-AccessibilityFocusManager::FocusedActorActivatedSignalType& AccessibilityFocusManager::FocusedActorActivatedSignal()
-{
-  return GetImpl(*this).FocusedActorActivatedSignal();
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h b/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h
deleted file mode 100644 (file)
index 25e054e..0000000
+++ /dev/null
@@ -1,416 +0,0 @@
-#ifndef __DALI_TOOLKIT_ACCESSIBILITY_FOCUS_MANAGER_H__
-#define __DALI_TOOLKIT_ACCESSIBILITY_FOCUS_MANAGER_H__
-
-/*
- * Copyright (c) 2015 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 <dali/public-api/actors/actor.h>
-#include <dali/public-api/actors/image-actor.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal DALI_INTERNAL
-{
-class AccessibilityFocusManager;
-}
-
-/**
- * @brief Manages registration of actors in a accessibility focus chain and changing the
- * focused actor within that chain.
- *
- * This class provides the functionality of registering the focus order and description
- * of actors and maintaining the focus chain.
- *
- * It provides functionality of setting the
- * focus and moving the focus forward and backward. It also draws a highlight for the
- * focused actor and emits a signal when the focus is changed.
- *
- * Signals
- * | %Signal Name            | Method                             |
- * |-------------------------|------------------------------------|
- * | focus-changed           | @ref FocusChangedSignal()          |
- * | focus-overshot          | @ref FocusOvershotSignal()         |
- * | focused-actor-activated | @ref FocusedActorActivatedSignal() |
- */
-class DALI_IMPORT_API AccessibilityFocusManager : public BaseHandle
-{
-public:
-
-  /**
-   * @brief Accessibility needs four information which will be read by screen-reader.
-   *
-   * Reading order : Label -> Trait -> Optional (Value and Hint)
-   */
-  enum AccessibilityAttribute
-  {
-    ACCESSIBILITY_LABEL = 0, ///< Simple text which contained in ui-control
-    ACCESSIBILITY_TRAIT,     ///< Description of ui-control trait
-    ACCESSIBILITY_VALUE,     ///< Current value of ui-control (Optional)
-    ACCESSIBILITY_HINT,      ///< Hint for action (Optional)
-    ACCESSIBILITY_ATTRIBUTE_NUM ///< Number of attributes
-  };
-
-   /**
-    * @brief Overshoot direction.
-    */
-  enum FocusOvershotDirection
-  {
-    OVERSHOT_PREVIOUS = -1, ///< Try to move previous of the first actor
-    OVERSHOT_NEXT = 1,      ///< Try to move next of the last actor
-  };
-
- public:
-
-  /// @brief Focus changed signal
-  typedef Signal< void ( Actor, Actor ) > FocusChangedSignalType;
-
-  /// @brief Focus overshooted signal
-  typedef Signal< void ( Actor, FocusOvershotDirection ) > FocusOvershotSignalType;
-
-  /// @brief Focused actor activated signal
-  typedef Signal< void ( Actor ) > FocusedActorActivatedSignalType;
-
-  /**
-   * @brief Create a AccessibilityFocusManager handle; this can be initialised with AccessibilityFocusManager::New().
-   *
-   * Calling member functions with an uninitialised handle is not allowed.
-   */
-  AccessibilityFocusManager();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~AccessibilityFocusManager();
-
-  /**
-   * @brief Get the singleton of AccessibilityFocusManager object.
-   *
-   * @return A handle to the AccessibilityFocusManager control.
-   */
-  static AccessibilityFocusManager Get();
-
-  /**
-   * @brief Set the information of the specified actor's accessibility attribute.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The Actor has been initialized.
-   * @param actor The actor the text to be set with
-   * @param type The attribute type the text to be set with
-   * @param text The text for the actor's accessibility information
-   */
-  void SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text);
-
-  /**
-   * @brief Get the text of the specified actor's accessibility attribute.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The Actor has been initialized.
-   * @param actor The actor to be queried
-   * @param type The attribute type to be queried
-   * @return The text of the actor's accessibility information
-   */
-  std::string GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const;
-
-  /**
-   * @brief Set the focus order of the actor.
-   *
-   * The focus order of each actor in the focus chain is unique. If
-   * there is another actor assigned with the same focus order
-   * already, the new actor will be inserted to the focus chain with
-   * that focus order, and the focus order of the original actor and
-   * all the actors followed in the focus chain will be increased
-   * accordingly. If the focus order assigned to the actor is 0, it
-   * means that actor's focus order is undefined (e.g. the actor has a
-   * description but with no focus order being set yet) and therefore
-   * that actor is not focusable.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The Actor has been initialized.
-   * @param actor The actor the focus order to be set with
-   * @param order The focus order of the actor
-   */
-  void SetFocusOrder(Actor actor, const unsigned int order);
-
-  /**
-   * @brief Get the focus order of the actor.
-   *
-   * When the focus order is 0, it means the focus order of the actor
-   * is undefined.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The Actor has been initialized.
-   * @param actor The actor to be queried
-   * @return The focus order of the actor
-   */
-  unsigned int GetFocusOrder(Actor actor) const;
-
-  /**
-   * @brief Generates a new focus order number which can be used to
-   * assign to actors which need to be appended to the end of the
-   * current focus order chain.
-   *
-   * The new number will be an increment over the very last focus
-   * order number in the focus chain. If the focus chain is empty then
-   * the function returns 1, else the number returned will be FOLast +
-   * 1 where FOLast is the focus order of the very last control in the
-   * focus chain.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @return The focus order of the actor
-   */
-  unsigned int GenerateNewFocusOrder() const;
-
-  /**
-   * @brief Get the actor that has the specified focus order.
-   *
-   * It will return an empty handle if the actor is not in the stage
-   * or has a focus order of 0.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @param order The focus order of the actor
-   *
-   * @return The actor that has the specified focus order or an empty
-   * handle if no actor in the stage has the specified focus order.
-   */
-  Actor GetActorByFocusOrder(const unsigned int order);
-
-  /**
-   * @brief Move the focus to the specified actor.
-   *
-   * Only one actor can be focused at the same time.  The actor must
-   * have a defined focus order and must be focusable, visible and in
-   * the stage.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The Actor has been initialized.
-   * @param actor The actor to be focused
-   * @return Whether the focus is successful or not
-   */
-  bool SetCurrentFocusActor(Actor actor);
-
-  /**
-   * @brief Get the current focused actor.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @return A handle to the current focused actor or an empty handle if no actor is focused.
-   */
-  Actor GetCurrentFocusActor();
-
-  /**
-   * @brief Get the focus group of current focused actor.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   *
-   * @return A handle to the immediate parent of the current focused
-   * actor which is also a focus group, or an empty handle if no actor
-   * is focused.
-   */
-  Actor GetCurrentFocusGroup();
-
-  /**
-   * @brief Get the focus order of currently focused actor.
-   * @pre The AccessibilityFocusManager has been initialized.
-   *
-   * @return The focus order of the currently focused actor or 0 if no
-   * actor is in focus.
-   */
-  unsigned int GetCurrentFocusOrder();
-
-  /**
-   * @brief Move the focus to the next focusable actor in the focus
-   * chain (according to the focus traversal order).
-   *
-   * When the focus movement is wrapped around, the focus will be moved
-   * to the first focusable actor when it reaches the end of the focus chain.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @return true if the moving was successful
-   */
-  bool MoveFocusForward();
-
-  /**
-   * @brief Move the focus to the previous focusable actor in the
-   * focus chain (according to the focus traversal order).
-   *
-   * When the focus movement is wrapped around, the focus will be
-   * moved to the last focusable actor when it reaches the beginning
-   * of the focus chain.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @return true if the moving was successful
-   */
-  bool MoveFocusBackward();
-
-  /**
-   * @brief Clear the focus from the current focused actor if any, so
-   * that no actor is focused in the focus chain.
-   *
-   * It will emit focus changed signal without current focused actor
-   * @pre The AccessibilityFocusManager has been initialized.
-   */
-  void ClearFocus();
-
-  /**
-   * @brief Clear the every registered focusable actor from focus-manager.
-   * @pre The AccessibilityFocusManager has been initialized.
-   */
-  void Reset();
-
-  /**
-   * @brief Set whether an actor is a focus group that can limit the
-   * scope of focus movement to its child actors in the focus chain.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The Actor has been initialized.
-   * @param actor The actor to be set as a focus group.
-   * @param isFocusGroup Whether to set the actor to be a focus group or not.
-   */
-  void SetFocusGroup(Actor actor, bool isFocusGroup);
-
-  /**
-   * @brief Check whether the actor is set as a focus group or not.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The Actor has been initialized.
-   * @param actor The actor to be checked.
-   * @return Whether the actor is set as a focus group.
-   */
-  bool IsFocusGroup(Actor actor) const;
-
-  /**
-   * @brief Set whether the group mode is enabled or not.
-   *
-   * When the group mode is enabled, the focus movement will be limited to the child actors
-   * of the current focus group including the current focus group itself. The current focus
-   * group is the closest ancestor of the current focused actor that set as a focus group.
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @param enabled Whether the group mode is enabled or not
-   */
-  void SetGroupMode(bool enabled);
-
-  /**
-   * @brief Get whether the group mode is enabled or not.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @return Whether the group mode is enabled or not.
-   */
-  bool GetGroupMode() const;
-
-  /**
-   * @brief Set whether focus will be moved to the beginning of the
-   * focus chain when it reaches the end or vice versa.
-   *
-   * When both the wrap mode and the group mode are enabled, focus will be
-   * wrapped within the current focus group. Focus will not be wrapped in default.
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @param wrapped Whether the focus movement is wrapped around or not
-   */
-  void SetWrapMode(bool wrapped);
-
-  /**
-   * @brief Get whether the wrap mode is enabled or not.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @return Whether the wrap mode is enabled or not.
-   */
-  bool GetWrapMode() const;
-
-  /**
-   * @brief Set the focus indicator actor.
-   *
-   * This will replace the default focus indicator actor in
-   * AccessibilityFocusManager and will be added to the focused actor as a
-   * highlight.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @pre The indicator actor has been initialized.
-   * @param indicator The indicator actor to be added
-   */
-  void SetFocusIndicatorActor(Actor indicator);
-
-  /**
-   * @brief Get the focus indicator actor.
-   *
-   * @pre The AccessibilityFocusManager has been initialized.
-   * @return A handle to the focus indicator actor
-   */
-  Actor GetFocusIndicatorActor();
-
-  /**
-   * @brief Returns the closest ancestor of the given actor that is a focus group.
-   *
-   * @param actor The actor to be checked for its focus group
-   * @return The focus group the given actor belongs to or an empty handle if the given actor doesn't belong to any focus group
-   */
-  Actor GetFocusGroup(Actor actor);
-
- public: // Signals
-
-  /**
-   * @brief This signal is emitted when the current focused actor is changed.
-   *
-   * A callback of the following type may be connected:
-   * @code
-   *   void YourCallbackName(Actor originalFocusedActor, Actor currentFocusedActor);
-   * @endcode
-   * @pre The Object has been initialized.
-   * @return The signal to connect to.
-   */
-  FocusChangedSignalType& FocusChangedSignal();
-
-  /**
-   * @brief This signal is emitted when there is no way to move focus further.
-   *
-   * A callback of the following type may be connected:
-   * @code
-   *   void YourCallbackName(Actor currentFocusedActor, FocusOvershotDirection direction);
-   * @endcode
-   * @pre The Object has been initialized.
-   * @return The signal to connect to.
-   */
-  FocusOvershotSignalType& FocusOvershotSignal();
-
-  /**
-   * @brief This signal is emitted when the current focused actor is activated.
-   *
-   * A callback of the following type may be connected:
-   * @code
-   *   void YourCallbackName(Actor activatedActor);
-   * @endcode
-   * @pre The Object has been initialized.
-   * @return The signal to connect to.
-   */
-  FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
-
-private:
-
-  explicit DALI_INTERNAL AccessibilityFocusManager(Internal::AccessibilityFocusManager *impl);
-
-}; // class AccessibilityFocusManager
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_FOCUS_MANAGER_H__
index 2e0ffbe..a816ca2 100644 (file)
@@ -122,9 +122,9 @@ KeyboardFocusManager::FocusGroupChangedSignalType& KeyboardFocusManager::FocusGr
   return GetImpl(*this).FocusGroupChangedSignal();
 }
 
-KeyboardFocusManager::FocusedActorActivatedSignalType& KeyboardFocusManager::FocusedActorActivatedSignal()
+KeyboardFocusManager::FocusedActorEnterKeySignalType& KeyboardFocusManager::FocusedActorEnterKeySignal()
 {
-  return GetImpl(*this).FocusedActorActivatedSignal();
+  return GetImpl(*this).FocusedActorEnterKeySignal();
 }
 
 } // namespace Toolkit
index 6afcd6b..3383a47 100644 (file)
@@ -47,7 +47,7 @@ class KeyboardFocusManager;
  * | keyboard-pre-focus-change        | @ref PreFocusChangeSignal()        |
  * | keyboard-focus-changed           | @ref FocusChangedSignal()          |
  * | keyboard-focus-group-changed     | @ref FocusGroupChangedSignal()     |
- * | keyboard-focused-actor-activated | @ref FocusedActorActivatedSignal() |
+ * | keyboard-focused-actor-enter-key | @ref FocusedActorEnterKeySignal()  |
  */
 class DALI_IMPORT_API KeyboardFocusManager : public BaseHandle
 {
@@ -63,8 +63,8 @@ public:
   /// @brief Focus group changed signal
   typedef Signal< void ( Actor, bool ) > FocusGroupChangedSignalType;
 
-  /// @brief Focused actor activated signal
-  typedef Signal< void ( Actor ) > FocusedActorActivatedSignalType;
+  /// @brief Focused actor has the enter key pressed signal
+  typedef Signal< void ( Actor ) > FocusedActorEnterKeySignalType;
 
   /**
    * @brief Create a KeyboardFocusManager handle; this can be initialised with KeyboardFocusManager::New().
@@ -251,16 +251,16 @@ public: // Signals
   FocusGroupChangedSignalType& FocusGroupChangedSignal();
 
   /**
-   * @brief This signal is emitted when the current focused actor is activated.
+   * @brief This signal is emitted when the current focused actor has the enter key pressed on it.
    *
    * A callback of the following type may be connected:
    * @code
-   *   void YourCallbackName(Actor activatedActor);
+   *   void YourCallbackName(Actor enterPressedActor);
    * @endcode
    * @pre The Object has been initialized.
    * @return The signal to connect to.
    */
-  FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+  FocusedActorEnterKeySignalType& FocusedActorEnterKeySignal();
 
   // Not intended for application developers
 
index 522a307..1ffa35e 100644 (file)
@@ -30,7 +30,6 @@ namespace Text
 // The type of text renderer required
 enum RenderingType
 {
-  RENDERING_BASIC,       ///< A bitmap-based reference implementation
   RENDERING_SHARED_ATLAS ///< A bitmap-based solution where renderers can share a texture atlas
 };
 
index 92beacd..334c709 100644 (file)
@@ -244,7 +244,7 @@ PushButton, OKAY_BUTTON - Pos: [185, 0, 0.1] Size: [165, 76, 76], Dirty: (FALSE,
 
 The format is as follows:
 
-[Actor type], [Actor name] â€“ Pos:[X, Y, Z] Size[Dimension::WIDTH, Dimension::HEIGHT, DEPTH], Dirty:(Dimension::WIDTH, Dimension::HEIGHT), Negotiated: (Dimension::WIDTH, Dimension::HEIGHT), Enabled: BOOLEAN, (Object address)
+[Actor type], [Actor name] ? Pos:[X, Y, Z] Size[Dimension::WIDTH, Dimension::HEIGHT, DEPTH], Dirty:(Dimension::WIDTH, Dimension::HEIGHT), Negotiated: (Dimension::WIDTH, Dimension::HEIGHT), Enabled: BOOLEAN, (Object address)
 - <i>Actor type</i>: The type name of the actor E.g. PushButton
 - <i>Actor name</i>: The name set on the actor with SetName(). Useful for debugging.
 - <i>Pos</i>: The position of the actor
index c804f61..7c1fa67 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.46
+Version:    1.0.47
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
index e4d433b..4938c01 100644 (file)
@@ -11,7 +11,6 @@
 var actor = new dali.Actor();
 var imageActor = new dali.ImageActor();
 var textActor = new dali.TextActor("hello world");
-var meshActor = new dali.MeshActor();
 var camera = new dali.CameraActor();
 var layer = new dali.Layer();
 ```
@@ -645,4 +644,4 @@ POSTITION_INHERITANCE
  * @type Vector3
  * @property sizeModeFactor
  */
-SIZE_MODE_FACTOR
\ No newline at end of file
+SIZE_MODE_FACTOR
diff --git a/plugins/dali-script-v8/docs/content/renderable-actor.js b/plugins/dali-script-v8/docs/content/renderable-actor.js
deleted file mode 100644 (file)
index b2509bf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- *
-# Renderable Actor ( Extends Actor API )
-
-Renderable actors are actors that can be drawn.
-These currently are:
-
-- {{#crossLink "ImageActor"}}{{/crossLink}}
-- {{#crossLink "TextActor"}}{{/crossLink}}
-- {{#crossLink "MeshActor"}}{{/crossLink}}
-
- @class RenderableActor
- @extends Actor
-*/
-
-
-
-
-
index 9914d3a..d995aa1 100644 (file)
@@ -14,8 +14,6 @@ script_v8_plugin_src_files = \
    $(v8_plugin_dir)/actors/layer-api.cpp \
    $(v8_plugin_dir)/actors/image-actor-api.cpp \
    $(v8_plugin_dir)/actors/camera-actor-api.cpp \
-   $(v8_plugin_dir)/actors/mesh-actor-api.cpp \
-   $(v8_plugin_dir)/actors/renderable-actor-api.cpp \
    $(v8_plugin_dir)/constants/constants-wrapper.cpp \
    $(v8_plugin_dir)/animation/animation-api.cpp \
    $(v8_plugin_dir)/animation/animation-wrapper.cpp \
index 1686958..704c2d1 100644 (file)
@@ -25,9 +25,7 @@
 #include <actors/layer-api.h>
 #include <actors/actor-api.h>
 #include <actors/image-actor-api.h>
-#include <actors/mesh-actor-api.h>
 #include <actors/camera-actor-api.h>
-#include <actors/renderable-actor-api.h>
 #include <v8-utils.h>
 #include <dali-wrapper.h>
 
@@ -39,7 +37,6 @@ namespace V8Plugin
 
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mImageActorTemplate;
-v8::Persistent<v8::ObjectTemplate> ActorWrapper::mMeshActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mCameraActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mLayerActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextLabelTemplate;
@@ -63,7 +60,6 @@ const ActorTemplate ActorTemplateLookup[]=
 {
     { &ActorWrapper::mActorTemplate },        // ACTOR
     { &ActorWrapper::mImageActorTemplate },   // IMAGE_ACTOR
-    { &ActorWrapper::mMeshActorTemplate  },   // MESH_ACTOR
     { &ActorWrapper::mLayerActorTemplate },   // LAYER_ACTOR
     { &ActorWrapper::mCameraActorTemplate},   // CAMERA_ACTOR
     { &ActorWrapper::mTextLabelTemplate }
@@ -75,11 +71,9 @@ const ActorTemplate ActorTemplateLookup[]=
 enum ActorApiBitMask
 {
   ACTOR_API              = 1 << 0,
-  RENDERABLE_ACTOR_API   = 1 << 1,
-  IMAGE_ACTOR_API        = 1 << 2,
-  MESH_ACTOR_API         = 1 << 3,
-  LAYER_API              = 1 << 4,
-  CAMERA_ACTOR_API       = 1 << 5,
+  IMAGE_ACTOR_API        = 1 << 1,
+  LAYER_API              = 1 << 2,
+  CAMERA_ACTOR_API       = 1 << 3,
 };
 
 /**
@@ -99,8 +93,7 @@ struct ActorApiStruct
 const ActorApiStruct ActorApiLookup[]=
 {
   {"Actor",      ActorWrapper::ACTOR,        ActorApi::New,       ACTOR_API },
-  {"ImageActor", ActorWrapper::IMAGE_ACTOR,  ImageActorApi::New,  ACTOR_API | RENDERABLE_ACTOR_API | IMAGE_ACTOR_API   },
-  {"MeshActor",  ActorWrapper::MESH_ACTOR,   MeshActorApi::New,   ACTOR_API | RENDERABLE_ACTOR_API | MESH_ACTOR_API    },
+  {"ImageActor", ActorWrapper::IMAGE_ACTOR,  ImageActorApi::New,  ACTOR_API | IMAGE_ACTOR_API   },
   {"Layer",      ActorWrapper::LAYER_ACTOR,  LayerApi::New,       ACTOR_API | LAYER_API                                },
   {"CameraActor",ActorWrapper::CAMERA_ACTOR, CameraActorApi::New, ACTOR_API | CAMERA_ACTOR_API                         },
   {"TextLabel",  ActorWrapper::TEXT_LABEL,   TextLabelApi::New,   ACTOR_API },
@@ -172,7 +165,7 @@ struct ActorFunctions
 
 /**
  * Contains a list of all functions that can be called an
- * actor / image-actor / mesh-actor/ layer / camera-actor
+ * actor / image-actor / layer / camera-actor
  */
 const ActorFunctions ActorFunctionTable[]=
 {
@@ -246,24 +239,6 @@ const ActorFunctions ActorFunctionTable[]=
     { "IsKeyboardFocusable" , ActorApi::IsKeyboardFocusable,   ACTOR_API }, //-- should this be a property???
 
     /**************************************
-     * Renderable Actor API (in order of renderable-actor.h)
-     **************************************/
-    { "SetSortModifier",    RenderableActorApi::SetSortModifier,   RENDERABLE_ACTOR_API  },
-    { "GetSortModifier",    RenderableActorApi::GetSortModifier,   RENDERABLE_ACTOR_API  },
-    { "SetCullFace",        RenderableActorApi::SetCullFace,       RENDERABLE_ACTOR_API  },
-    { "GetCullFace",        RenderableActorApi::GetCullFace,       RENDERABLE_ACTOR_API  },
-    { "SetBlendMode",       RenderableActorApi::SetBlendMode,      RENDERABLE_ACTOR_API  },
-    { "GetBlendMode",       RenderableActorApi::GetBlendMode,      RENDERABLE_ACTOR_API  },
-    { "SetBlendFunc",       RenderableActorApi::SetBlendFunc,      RENDERABLE_ACTOR_API  },
-    { "GetBlendFunc",       RenderableActorApi::GetBlendFunc,      RENDERABLE_ACTOR_API  },
-    { "SetShaderEffect",    RenderableActorApi::SetShaderEffect,   RENDERABLE_ACTOR_API  },
-    { "GetShaderEffect",    RenderableActorApi::GetShaderEffect,   RENDERABLE_ACTOR_API  },
-    { "RemoveShaderEffect", RenderableActorApi::RemoveShaderEffect,RENDERABLE_ACTOR_API  },
-
-
-
-
-    /**************************************
      * Layer  API (in order of layer.h)
      **************************************/
     { "GetDepth",           LayerApi::GetDepth,                 LAYER_API  },
@@ -294,6 +269,17 @@ const ActorFunctions ActorFunctionTable[]=
     // ignore GetStyle, use imageActor.style
     // ignore SetNinePatchBorder use imageActor.border
     // ignore GetNinePatchBorder use imageActor.border
+    { "SetSortModifier",    ImageActorApi::SetSortModifier,   IMAGE_ACTOR_API  },
+    { "GetSortModifier",    ImageActorApi::GetSortModifier,   IMAGE_ACTOR_API  },
+    { "SetCullFace",        ImageActorApi::SetCullFace,       IMAGE_ACTOR_API  },
+    { "GetCullFace",        ImageActorApi::GetCullFace,       IMAGE_ACTOR_API  },
+    { "SetBlendMode",       ImageActorApi::SetBlendMode,      IMAGE_ACTOR_API  },
+    { "GetBlendMode",       ImageActorApi::GetBlendMode,      IMAGE_ACTOR_API  },
+    { "SetBlendFunc",       ImageActorApi::SetBlendFunc,      IMAGE_ACTOR_API  },
+    { "GetBlendFunc",       ImageActorApi::GetBlendFunc,      IMAGE_ACTOR_API  },
+    { "SetShaderEffect",    ImageActorApi::SetShaderEffect,   IMAGE_ACTOR_API  },
+    { "GetShaderEffect",    ImageActorApi::GetShaderEffect,   IMAGE_ACTOR_API  },
+    { "RemoveShaderEffect", ImageActorApi::RemoveShaderEffect,IMAGE_ACTOR_API  },
     // ignore SetFadeIn use imageActor.fadeIn
     // ignore GetFadeIn use imageActor.fadeIn
     // ignore SetFadeInDuration use imageActor.fadeInDuration
index d8644a5..7394fa0 100644 (file)
@@ -24,7 +24,8 @@
 #include <object/property-value-wrapper.h>
 #include <image/image-api.h>
 #include <image/image-wrapper.h>
-
+#include <shader-effects/shader-effect-api.h>
+#include <shader-effects/shader-effect-wrapper.h>
 
 namespace Dali
 {
@@ -150,6 +151,313 @@ void ImageActorApi::GetImage( const v8::FunctionCallbackInfo<v8::Value>& args )
   args.GetReturnValue().Set( localObject );
 }
 
+/**
+ * Allows modification of an actors position in the depth sort algorithm.
+ *
+ * The offset can be altered for each coplanar actor hence allowing an order of painting.
+ * @param { Number }  depthOffset the offset to be given to the actor. Positive values pushing it further back.
+ * @for ImageActor
+ * @method setSortModifier
+ */
+void ImageActorApi::SetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  float value = V8Utils::GetFloatParameter( PARAMETER_0, found, isolate, args, 0.f );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
+    return;
+  }
+  imageActor.SetSortModifier( value );
+}
+
+/**
+ * Retrieves the offset used to modify an actors position in the depth sort algorithm.
+ * @for ImageActor
+ * @method getSortModifier .
+ * @return { Number} the offset that has been given to the actor. Positive values pushing it further back
+ */
+void ImageActorApi::GetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  args.GetReturnValue().Set( v8::Number::New( isolate, imageActor.GetSortModifier() ) );
+
+}
+
+/**
+ * Set the face-culling mode for this actor.
+ * @for ImageActor
+ * @method setCullFace
+ * @param {Number} cullMode
+ * @example
+ *      // cull mode should be one of the following constants
+ *      dali.CULL_FACE_DISABLE        // Face culling disabled
+ *      dali.CULL_FRONT_FACE          // Cull front facing polygons
+ *      dali.CULL_BACK_FACE           // Cull back facing polygons
+ *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygons
+ *      actor.SetCullFace( dali.CULL_FRONT_FACE );
+ */
+void ImageActorApi::SetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  int cullMode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
+    return;
+  }
+
+  imageActor.SetCullFace(  static_cast<Dali::CullFaceMode>( cullMode ) );
+
+}
+
+/**
+ * Retrieve the face-culling mode for this actor.
+ * @for ImageActor
+ * @method getCullFace
+ * @return {Number} cullMode
+ * @example
+ *      // cull mode is one of the following
+ *      dali.CULL_FACE_DISABLE        // Face culling disabled
+ *      dali.CULL_FRONT_FACE          // Cull front facing polygons
+ *      dali.CULL_BACK_FACE           // Cull back facing polygons
+ *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygon
+ */
+void ImageActorApi::GetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  args.GetReturnValue().Set( v8::Integer::New( isolate, imageActor.GetCullFace() ) );
+
+}
+
+/**
+ * Sets the blending mode.
+ *
+ * If blending is disabled (BLENDING_OFF) fade in and fade out animations do not work.
+ *
+ * @example
+ *      // blend mode is one of the following
+ *      dali.BLENDING_OFF       // Blending is disabled.
+ *      dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
+ *      dali.BLENDING_ON        // Blending is enabled.
+ *      actor.SetBlendMode( dali.BLENDING_AUTO );
+ *
+ * @for ImageActor
+ * @method setBlendMode
+ * @param { Number } blendMode
+ */
+void ImageActorApi::SetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  int mode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter" );
+    return;
+  }
+  imageActor.SetBlendMode( static_cast<Dali::BlendingMode::Type>( mode ) );
+
+}
+
+/**
+ * @for ImageActor
+ * @method getBlendMode
+ * @return { Number } blendMode
+ * @example returns one of the following:
+ *
+ *        dali.BLENDING_OFF       // Blending is disabled.
+ *        dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
+ *        dali.BLENDING_ON        // Blending is enabled.
+ *
+ */
+void ImageActorApi::GetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  args.GetReturnValue().Set( v8::Integer::New( isolate, imageActor.GetBlendMode() ) );
+
+}
+
+/**
+ * @for ImageActor
+ * @method setBlendFunc
+ * @param {Number} SourceBlending RGB
+ * @param {Number} DestinationBlending RGB
+ * @param {Number} SourceBlending Alpha
+ * @param {Number} DestinatinoBlending Alpha
+ * @example
+ *      //blending constants
+      dali.BLEND_FACTOR_ZERO
+      dali.BLEND_FACTOR_ONE
+      dali.BLEND_FACTOR_SRC_COLOR
+      dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR
+      dali.BLEND_FACTOR_SRC_ALPHA
+      dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
+      dali.BLEND_FACTOR_DST_ALPHA
+      dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
+      dali.BLEND_FACTOR_DST_COLOR
+      dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR
+      dali.BLEND_FACTOR_SRC_ALPHA_SATURATE
+      dali.BLEND_FACTOR_CONSTANT_COLOR
+      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
+      dali.BLEND_FACTOR_CONSTANT_ALPHA
+      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
+
+      actor.setBlendFunc(  dali.BLEND_FACTOR_CONSTANT_COLOR, BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
+                                dali.BLEND_FACTOR_CONSTANT_ALPHA, BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA);
+
+      );
+ */
+void ImageActorApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  int params[4];
+  bool foundAllParams(false);
+  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 4, args,0 );
+  if( foundAllParams )
+  {
+    imageActor.SetBlendFunc(  static_cast< Dali::BlendingFactor::Type>(params[0]),
+                         static_cast< Dali::BlendingFactor::Type>(params[1]),
+                         static_cast< Dali::BlendingFactor::Type>(params[2]),
+                         static_cast< Dali::BlendingFactor::Type>(params[3]));
+  }
+  else
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter");
+    return;
+  }
+}
+
+/**
+ * @for ImageActor
+ * @method GetBlendFunc
+ * @return {Object} BlendProperties
+ * @example Blend properties object has 4 fields
+ *
+ *      blendProperties.sourceRgb // source rgb enum
+ *      blendProperties.destinationRgb  // destination rgb enum
+ *      blendProperties.sourceAlpha source // alpha enum
+ *      blendProperties.destinationAlpha // destination alpha enum
+ */
+void ImageActorApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  // @todo pass by reference doesn't work in Javascript so need to decide what to return
+  // for now just return a vector 4...
+
+  BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  imageActor.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+
+  v8::Local<v8::Object> blendInfo = v8::Object::New( isolate );
+
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceRgb" ),        v8::Integer::New( isolate, srcFactorRgb) );
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationRgb" ),   v8::Integer::New( isolate, destFactorRgb ) );
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceAlpha" ),      v8::Integer::New( isolate, srcFactorAlpha  ) );
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationAlpha" ), v8::Integer::New( isolate, destFactorAlpha ) );
+
+  args.GetReturnValue().Set( blendInfo );
+
+}
+
+/**
+ * @for ImageActor
+ * @method getShaderEffect
+ * @return {Object} ShaderEffect object
+ *
+ * Retrieve the shader effect for the Actor.
+ *
+ * @example
+ *    var shaderEffect = actor.getShaderEffect();
+ *
+ */
+void ImageActorApi::GetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  v8::Local < v8::Object > object = ShaderEffectWrapper::WrapShaderEffect( isolate, imageActor.GetShaderEffect() );
+  args.GetReturnValue().Set( object );
+
+}
+
+/**
+ * @for ImageActor
+ * @method setShaderEffect
+ * @param {Object} shaderEffect The shader effect.
+ *
+ * Sets the shader effect for the Actor.
+ *
+ * Shader effects provide special effects like rippling and bending.
+ * Setting a shader effect removes any shader effect previously set by SetShaderEffect.
+ * @example
+ *      // first create the shaderOptions, then the shaderEffect
+ *      var shader = new dali.ShaderEffect( shaderOptions );
+ *      actor.setShaderEffect( shader );
+ *
+ */
+void ImageActorApi::SetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  ShaderEffect effect = ShaderEffectApi::GetShaderEffectFromParams( 0, found, isolate, args );
+  if( found )
+  {
+    imageActor.SetShaderEffect( effect );
+  }
+  else
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "shader effect parameter missing" );
+  }
+}
+
+/**
+ *
+ * Removes the current shader effect
+ *
+ * @example
+ *    actor.removeShaderEffect();
+ *
+ * @for ImageActor
+ * @method removeShaderEffect
+ */
+void ImageActorApi::RemoveShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+  imageActor.RemoveShaderEffect();
+}
+
 } // namespace V8Plugin
 
 } // namespace Dali
index 4bdbe76..2d00599 100644 (file)
@@ -42,6 +42,17 @@ namespace ImageActorApi
    */
   void SetImage( const v8::FunctionCallbackInfo< v8::Value >& args );
   void GetImage( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void RemoveShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
 }; // namespace ImageActorApi
 
 } // namespace V8Plugin
diff --git a/plugins/dali-script-v8/src/actors/mesh-actor-api.cpp b/plugins/dali-script-v8/src/actors/mesh-actor-api.cpp
deleted file mode 100644 (file)
index a22ccae..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2015 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 "mesh-actor-api.h"
-
-// INTERNAL INCLUDES
-#include <object/handle-wrapper.h>
-#include <v8-utils.h>
-
-
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace //unnamed name space
-{
-
-MeshActor GetMeshActor( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
-  return MeshActor::DownCast( handleWrapper->mHandle );
-}
-
-} //unnamed name space
-
-/***************************************
- * MESH ACTOR FUNCTIONS
- ****************************************/
-/**
- * @constructor
- * @for MeshActor
- * @method MeshActor
- * @return {Object} MeshActor
- */
-Actor MeshActorApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  return MeshActor::New();
-}
-
-} // namespace V8Plugin
-
-} // namespace Dali
diff --git a/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp b/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp
deleted file mode 100644 (file)
index 14b2baf..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 2015 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 "renderable-actor-api.h"
-
-// INTERNAL INCLUDES
-#include <object/handle-wrapper.h>
-#include <v8-utils.h>
-#include <object/property-value-wrapper.h>
-#include <shader-effects/shader-effect-api.h>
-#include <shader-effects/shader-effect-wrapper.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace //unnamed name space
-{
-RenderableActor GetRenderableActor( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
-  return RenderableActor::DownCast( handleWrapper->mHandle );
-}
-}
-/***************************************
- * RENDERABLE ACTOR FUNCTIONS
- *
- ****************************************/
-/**
- * Allows modification of an actors position in the depth sort algorithm.
- *
- * The offset can be altered for each coplanar actor hence allowing an order of painting.
- * @param { Number }  depthOffset the offset to be given to the actor. Positive values pushing it further back.
- * @for RenderableActor
- * @method setSortModifier
- */
-void RenderableActorApi::SetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  float value = V8Utils::GetFloatParameter( PARAMETER_0, found, isolate, args, 0.f );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
-    return;
-  }
-  actor.SetSortModifier( value );
-}
-
-/**
- * Retrieves the offset used to modify an actors position in the depth sort algorithm.
- * @for RenderableActor
- * @method getSortModifier .
- * @return { Number} the offset that has been given to the actor. Positive values pushing it further back
- */
-void RenderableActorApi::GetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  args.GetReturnValue().Set( v8::Number::New( isolate, actor.GetSortModifier() ) );
-
-}
-
-/**
- * Set the face-culling mode for this actor.
- * @for RenderableActor
- * @method setCullFace
- * @param {Number} cullMode
- * @example
- *      // cull mode should be one of the following constants
- *      dali.CULL_FACE_DISABLE        // Face culling disabled
- *      dali.CULL_FRONT_FACE          // Cull front facing polygons
- *      dali.CULL_BACK_FACE           // Cull back facing polygons
- *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygons
- *      actor.SetCullFace( dali.CULL_FRONT_FACE );
- */
-void RenderableActorApi::SetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  int cullMode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
-    return;
-  }
-
-  actor.SetCullFace(  static_cast<Dali::CullFaceMode>( cullMode ) );
-
-}
-
-/**
- * Retrieve the face-culling mode for this actor.
- * @for RenderableActor
- * @method getCullFace
- * @return {Number} cullMode
- * @example
- *      // cull mode is one of the following
- *      dali.CULL_FACE_DISABLE        // Face culling disabled
- *      dali.CULL_FRONT_FACE          // Cull front facing polygons
- *      dali.CULL_BACK_FACE           // Cull back facing polygons
- *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygon
- */
-void RenderableActorApi::GetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  args.GetReturnValue().Set( v8::Integer::New( isolate, actor.GetCullFace() ) );
-
-}
-
-/**
- * Sets the blending mode.
- *
- * If blending is disabled (BLENDING_OFF) fade in and fade out animations do not work.
- *
- * @example
- *      // blend mode is one of the following
- *      dali.BLENDING_OFF       // Blending is disabled.
- *      dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
- *      dali.BLENDING_ON        // Blending is enabled.
- *      actor.SetBlendMode( dali.BLENDING_AUTO );
- *
- * @for RenderableActor
- * @method setBlendMode
- * @param { Number } blendMode
- */
-void RenderableActorApi::SetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  int mode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter" );
-    return;
-  }
-  actor.SetBlendMode( static_cast<Dali::BlendingMode::Type>( mode ) );
-
-}
-
-/**
- * @for RenderableActor
- * @method getBlendMode
- * @return { Number } blendMode
- * @example returns one of the following:
- *
- *        dali.BLENDING_OFF       // Blending is disabled.
- *        dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
- *        dali.BLENDING_ON        // Blending is enabled.
- *
- */
-void RenderableActorApi::GetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  args.GetReturnValue().Set( v8::Integer::New( isolate, actor.GetBlendMode() ) );
-
-}
-
-/**
- * @for RenderableActor
- * @method setBlendFunc
- * @param {Number} SourceBlending RGB
- * @param {Number} DestinationBlending RGB
- * @param {Number} SourceBlending Alpha
- * @param {Number} DestinatinoBlending Alpha
- * @example
- *      //blending constants
-      dali.BLEND_FACTOR_ZERO
-      dali.BLEND_FACTOR_ONE
-      dali.BLEND_FACTOR_SRC_COLOR
-      dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR
-      dali.BLEND_FACTOR_SRC_ALPHA
-      dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
-      dali.BLEND_FACTOR_DST_ALPHA
-      dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
-      dali.BLEND_FACTOR_DST_COLOR
-      dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR
-      dali.BLEND_FACTOR_SRC_ALPHA_SATURATE
-      dali.BLEND_FACTOR_CONSTANT_COLOR
-      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
-      dali.BLEND_FACTOR_CONSTANT_ALPHA
-      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
-
-      actor.setBlendFunc(  dali.BLEND_FACTOR_CONSTANT_COLOR, BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
-                                dali.BLEND_FACTOR_CONSTANT_ALPHA, BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA);
-
-      );
- */
-void RenderableActorApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor =  GetRenderableActor( isolate, args );
-
-  int params[4];
-  bool foundAllParams(false);
-  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 4, args,0 );
-  if( foundAllParams )
-  {
-    actor.SetBlendFunc(  static_cast< Dali::BlendingFactor::Type>(params[0]),
-                         static_cast< Dali::BlendingFactor::Type>(params[1]),
-                         static_cast< Dali::BlendingFactor::Type>(params[2]),
-                         static_cast< Dali::BlendingFactor::Type>(params[3]));
-  }
-  else
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter");
-    return;
-  }
-}
-
-/**
- * @for RenderableActor
- * @method GetBlendFunc
- * @return {Object} BlendProperties
- * @example Blend properties object has 4 fields
- *
- *      blendProperties.sourceRgb // source rgb enum
- *      blendProperties.destinationRgb  // destination rgb enum
- *      blendProperties.sourceAlpha source // alpha enum
- *      blendProperties.destinationAlpha // destination alpha enum
- */
-void RenderableActorApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  // @todo pass by reference doesn't work in Javascript so need to decide what to return
-  // for now just return a vector 4...
-
-  BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  actor.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-
-  v8::Local<v8::Object> blendInfo = v8::Object::New( isolate );
-
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceRgb" ),        v8::Integer::New( isolate, srcFactorRgb) );
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationRgb" ),   v8::Integer::New( isolate, destFactorRgb ) );
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceAlpha" ),      v8::Integer::New( isolate, srcFactorAlpha  ) );
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationAlpha" ), v8::Integer::New( isolate, destFactorAlpha ) );
-
-  args.GetReturnValue().Set( blendInfo );
-
-}
-
-/**
- * @for RenderableActor
- * @method getShaderEffect
- * @return {Object} ShaderEffect object
- *
- * Retrieve the shader effect for the Actor.
- *
- * @example
- *    var shaderEffect = actor.getShaderEffect();
- *
- */
-void RenderableActorApi::GetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  v8::Local < v8::Object > object = ShaderEffectWrapper::WrapShaderEffect( isolate, actor.GetShaderEffect() );
-  args.GetReturnValue().Set( object );
-
-}
-
-/**
- * @for RenderableActor
- * @method setShaderEffect
- * @param {Object} shaderEffect The shader effect.
- *
- * Sets the shader effect for the Actor.
- *
- * Shader effects provide special effects like rippling and bending.
- * Setting a shader effect removes any shader effect previously set by SetShaderEffect.
- * @example
- *      // first create the shaderOptions, then the shaderEffect
- *      var shader = new dali.ShaderEffect( shaderOptions );
- *      actor.setShaderEffect( shader );
- *
- */
-void RenderableActorApi::SetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  ShaderEffect effect = ShaderEffectApi::GetShaderEffectFromParams( 0, found, isolate, args );
-  if( found )
-  {
-    actor.SetShaderEffect( effect );
-  }
-  else
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "shader effect parameter missing" );
-  }
-}
-
-/**
- *
- * Removes the current shader effect
- *
- * @example
- *    actor.removeShaderEffect();
- *
- * @for RenderableActor
- * @method removeShaderEffect
- */
-void RenderableActorApi::RemoveShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-  actor.RemoveShaderEffect();
-}
-
-
-
-} // namespace V8Plugin
-
-} // namespace Dali
diff --git a/plugins/dali-script-v8/src/actors/renderable-actor-api.h b/plugins/dali-script-v8/src/actors/renderable-actor-api.h
deleted file mode 100644 (file)
index 79716a1..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef __DALI_V8PLUGIN_RENDERABLE_ACTOR_API_H__
-#define __DALI_V8PLUGIN_RENDERABLE_ACTOR_API_H__
-
-/*
- * Copyright (c) 2015 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 <v8.h>
-#include <dali/public-api/actors/renderable-actor.h>
-
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace RenderableActorApi
-{
-   /**
-   * RenderableActor API see renderable-actor.h for a description
-   * Unfortunately none of the functions are covered by the property system
-   */
-  void SetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void RemoveShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
-
-
-}; // namespace RenderableActorApi
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // header __DALI_V8PLUGIN_RENDERABLE_ACTOR_API_H__
index 4217d98..c3b2043 100644 (file)
@@ -29,7 +29,6 @@
 #include <dali/public-api/actors/draw-mode.h>
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/actors/blending.h>
-#include <dali/public-api/actors/renderable-actor.h>
 #include <dali/public-api/actors/camera-actor.h>
 #include <dali/public-api/render-tasks/render-task.h>
 #include <dali/public-api/common/loading-state.h>
index 4467b0a..dc7641b 100644 (file)
@@ -56,16 +56,14 @@ void DaliScriptV8::SetFlags(const std::string& s)
   DaliWrapper::Get().SetFlagsFromString(s);
 }
 
-void DaliScriptV8::ExecuteBuffer(const std::string& buffer, const std::string& filename)
+bool DaliScriptV8::ExecuteBuffer(const std::string& buffer, const std::string& filename)
 {
-  DaliWrapper::Get().ExecuteBuffer(buffer, filename);
+  return DaliWrapper::Get().ExecuteBuffer(buffer, filename);
 }
 
-void DaliScriptV8::ExecuteFile(const std::string& filename)
+bool DaliScriptV8::ExecuteFile(const std::string& filename)
 {
-
-
-  DaliWrapper::Get().ExecuteFile( filename );
+  return DaliWrapper::Get().ExecuteFile( filename );
 }
 
 }  // namespace V8Plugin
index 5389612..61d265b 100644 (file)
@@ -55,12 +55,12 @@ public: // ScriptV8Plugin overrides
   /**
    * @copydoc Dali::Toolkit::ScriptPlugin::ExecuteBuffer()
    */
-  virtual void ExecuteBuffer(const std::string& buffer, const std::string& filename);
+  virtual bool ExecuteBuffer(const std::string& buffer, const std::string& filename);
 
   /**
    * @copydoc Dali::Toolkit::ScriptPlugin::ExecuteFile()
    */
-  virtual void ExecuteFile(const std::string& fileName);
+  virtual bool ExecuteFile(const std::string& fileName);
 
 
 };
index 09205d7..93c85fc 100644 (file)
@@ -143,16 +143,16 @@ void DaliWrapper::Shutdown()
   }
 }
 
-void DaliWrapper::ExecuteBuffer(const std::string &sourceCode, const std::string &sourceFileName)
+bool DaliWrapper::ExecuteBuffer(const std::string &sourceCode, const std::string &sourceFileName)
 {
-  mModuleLoader.ExecuteScript( mIsolate,  sourceCode, sourceFileName );
+  return mModuleLoader.ExecuteScript( mIsolate,  sourceCode, sourceFileName );
 }
 
-void DaliWrapper::ExecuteFile( const std::string& sourceFileName )
+bool DaliWrapper::ExecuteFile( const std::string& sourceFileName )
 {
   DALI_LOG_INFO( gLogExecuteFilter, Debug::Verbose, "Executing source file %s \n",sourceFileName.c_str() );
 
-  mModuleLoader.ExecuteScriptFromFile( mIsolate,  sourceFileName );
+  return mModuleLoader.ExecuteScriptFromFile( mIsolate,  sourceFileName );
 }
 
 GarbageCollectorInterface& DaliWrapper::GetDaliGarbageCollector()
index 27d4fd3..e576f4b 100644 (file)
@@ -101,16 +101,18 @@ public:
    *
    * @param[in] sourceCode The buffer containing javascript to execute
    * @param[in] sourceFileName Filename associated with the buffer (for error tracing)
+   * @return true on success, false on failure
    */
-  void ExecuteBuffer(const std::string &sourceCode, const std::string &sourceFileName);
+  bool ExecuteBuffer(const std::string &sourceCode, const std::string &sourceFileName);
 
 
   /**
    * Excute the buffer in the v8 context
    *
    * @param[in] sourceFileName Filename associated with the buffer (for error tracing)
+   * @return true on success, false on failure
    */
-  void ExecuteFile( const std::string& sourceFileName);
+  bool ExecuteFile( const std::string& sourceFileName);
 
 
   /**
index 39b23d2..d475c90 100644 (file)
@@ -97,6 +97,11 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate,
 
   V8Utils::GetFileContents( fileName, contents );
 
+  if( contents.empty() )
+  {
+    return false;
+  }
+
   return ExecuteScript( isolate, contents, fileName );
 }
 
index 00f3625..085f33f 100644 (file)
@@ -77,6 +77,8 @@ public:
   /**
    * Execute a script from a file
    * @param[in] fileName file name
+   * @return true on success, false on failure
+   *
    */
   bool ExecuteScriptFromFile( v8::Isolate* isolate, const std::string& fileName );
 
@@ -85,6 +87,7 @@ public:
    * Execute a script
    * @param[in] sourceCode source code to run
    * @param[in] sourceFileName source file name
+   * @return true on success, false on failure
    */
   bool ExecuteScript( v8::Isolate* isolate,
                       const std::string& sourceCode,
index 4d65e64..5143d49 100644 (file)
@@ -37,22 +37,6 @@ namespace // un named namespace
 
 typedef  std::vector< std::string > HintsArray;
 
-
-struct GeometryTypePair
-{
-  const char* name;
-  GeometryType type;
-};
-
-const GeometryTypePair GeometryTypeTable[]=
-{
-    {"image",         GEOMETRY_TYPE_IMAGE },
-    {"mesh",          GEOMETRY_TYPE_UNTEXTURED_MESH  },
-    {"textured-mesh", GEOMETRY_TYPE_TEXTURED_MESH },
-};
-
-const unsigned int GeometryTypeTableCount = sizeof(GeometryTypeTable)/sizeof(GeometryTypeTable[0]);
-
 struct GeometryHintPair
 {
   const char* name;
@@ -77,24 +61,10 @@ const unsigned int GeometryHintTableCount = sizeof(GeometryHintTable)/sizeof(Geo
 struct ShaderParameters
 {
   ShaderParameters()
-      : mType( GEOMETRY_TYPE_IMAGE),
-        mHints( ShaderEffect::HINT_NONE )
+      : mHints( ShaderEffect::HINT_NONE )
   {
   }
 
-  void SetGeometryType( v8::Isolate* isolate, const std::string& typeName )
-  {
-     for( unsigned int i = 0; i < GeometryTypeTableCount; ++i )
-     {
-       if( typeName == GeometryTypeTable[i].name )
-       {
-         mType = GeometryTypeTable[i].type;
-         return;
-       }
-     }
-     DALI_SCRIPT_EXCEPTION( isolate, "Geometry type not found\n");
-  }
-
   ShaderEffect::GeometryHints GetGeometryHint( const std::string& hint )
   {
     for( unsigned int i = 0 ; i < GeometryHintTableCount; ++i )
@@ -115,22 +85,18 @@ struct ShaderParameters
     }
   }
 
-
-
   ShaderEffect NewShader()
   {
     return ShaderEffect::NewWithPrefix( mVertexPrefix ,
                               mVertex,
                               mFragmentPrefix,
                               mFragment,
-                              mType,
                               mHints);
   }
   std::string mVertexPrefix;
   std::string mVertex;
   std::string mFragmentPrefix;
   std::string mFragment;
-  GeometryType mType;
   ShaderEffect::GeometryHints mHints;
 };
 
@@ -197,14 +163,6 @@ ShaderEffect ShaderEffectApi::New(  v8::Isolate* isolate, const v8::FunctionCall
 
     v8::Local<v8::Object > obj = args[0]->ToObject();
 
-    v8::Local<v8::Value> geometryTypeValue = obj->Get(v8::String::NewFromUtf8( isolate, "geometryType"));
-    if( geometryTypeValue->IsString() )
-    {
-      std::string geometryTypeName = V8Utils::v8StringToStdString( geometryTypeValue );
-     // printf(" geometry type found %s \n", geometryTypeName.c_str() );
-      shaderParams.SetGeometryType( isolate, geometryTypeName );
-    }
-
     v8::Local<v8::Value> vertexPrefixValue = obj->Get(v8::String::NewFromUtf8( isolate, "vertexShaderPrefix"));
     if( vertexPrefixValue->IsString() )
     {
index e5cfb67..b4ce8fc 100644 (file)
@@ -70,7 +70,7 @@ const char* const SIGNAL_IMAGE_UPLOADED = "uploaded";
 const char* const KEYBOARD_FOCUS_MANAGER_SIGNAL_PRE_FOCUS_CHANGE = "keyboard-pre-focus-change";
 const char* const KEYBOARD_FOCUS_MANAGER_SIGNAL_FOCUS_CHANGED = "keyboard-focus-changed";
 const char* const KEYBOARD_FOCUS_MANAGER_SIGNAL_FOCUS_GROUP_CHANGED = "keyboard-focus-group-changed";
-const char* const KEYBOARD_FOCUS_MANAGER_SIGNAL_FOCUSED_ACTOR_ACTIVATED = "keyboard-focused-actor-activated";
+const char* const KEYBOARD_FOCUS_MANAGER_SIGNAL_FOCUSED_ACTOR_ENTER_KEY = "keyboard-focused-actor-enter-key";
 const unsigned int MAX_SIGNAL_NAME_LENGTH = 64;
 
 } // un-named name space
@@ -345,11 +345,11 @@ public:
     arguments.push_back( forward );
     CallJavaScript( returnValue, arguments );
   }
-  void FocusedActorSignal( Actor activatedActor )
+  void EnterKeyPressedActorSignal( Actor enterKeyPressedActor )
   {
     std::vector< Dali::Any > arguments;
     Dali::Any returnValue;   //no return
-    arguments.push_back( activatedActor );
+    arguments.push_back( enterKeyPressedActor );
     CallJavaScript( returnValue, arguments );
   }
 };
@@ -517,9 +517,9 @@ void KeyboardFocusManagerConnection( v8::Isolate* isolate,
   {
     keyboardFocusManager.FocusGroupChangedSignal().Connect( callback, &KeyboardFocusCallback::FocusGroupSignal );
   }
-  else if ( strcmp( signalName.c_str(), KEYBOARD_FOCUS_MANAGER_SIGNAL_FOCUSED_ACTOR_ACTIVATED ) == 0 )
+  else if ( strcmp( signalName.c_str(), KEYBOARD_FOCUS_MANAGER_SIGNAL_FOCUSED_ACTOR_ENTER_KEY ) == 0 )
   {
-    keyboardFocusManager.FocusedActorActivatedSignal().Connect( callback, &KeyboardFocusCallback::FocusedActorSignal );
+    keyboardFocusManager.FocusedActorEnterKeySignal().Connect( callback, &KeyboardFocusCallback::EnterKeyPressedActorSignal );
   }
   else
   {