[dali_1.4.15] Merge branch 'devel/master' 24/203424/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 12 Apr 2019 10:49:48 +0000 (11:49 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 12 Apr 2019 10:49:48 +0000 (11:49 +0100)
Change-Id: I0a8b6fd3425265194191aed274f8ef10cde25822

35 files changed:
com.samsung.dali-demo.xml
examples-reel/dali-examples-reel.cpp
examples/gestures/gesture-example.cpp [new file with mode: 0644]
examples/simple-bitmap-font-text-label/simple-text-label-example.cpp [new file with mode: 0644]
examples/simple-text-field/simple-text-field.cpp [new file with mode: 0644]
examples/simple-text-label/simple-text-label-example.cpp [new file with mode: 0644]
examples/simple-text-renderer/simple-text-renderer-example.cpp [new file with mode: 0644]
examples/simple-text-visual/simple-text-visual-example.cpp [new file with mode: 0644]
packaging/com.samsung.dali-demo.spec
resources/images/u0030.png [new file with mode: 0644]
resources/images/u0030_color.png [new file with mode: 0644]
resources/images/u0031.png [new file with mode: 0644]
resources/images/u0031_color.png [new file with mode: 0644]
resources/images/u0032.png [new file with mode: 0644]
resources/images/u0032_color.png [new file with mode: 0644]
resources/images/u0033.png [new file with mode: 0644]
resources/images/u0033_color.png [new file with mode: 0644]
resources/images/u0034.png [new file with mode: 0644]
resources/images/u0034_color.png [new file with mode: 0644]
resources/images/u0035.png [new file with mode: 0644]
resources/images/u0035_color.png [new file with mode: 0644]
resources/images/u0036.png [new file with mode: 0644]
resources/images/u0036_color.png [new file with mode: 0644]
resources/images/u0037.png [new file with mode: 0644]
resources/images/u0037_color.png [new file with mode: 0644]
resources/images/u0038.png [new file with mode: 0644]
resources/images/u0038_color.png [new file with mode: 0644]
resources/images/u0039.png [new file with mode: 0644]
resources/images/u0039_color.png [new file with mode: 0644]
resources/images/u003a.png [new file with mode: 0644]
resources/images/u003a_color.png [new file with mode: 0644]
resources/po/en_GB.po
resources/po/en_US.po
shared/dali-demo-strings.h
tests-reel/dali-tests-reel.cpp

index 9b759cf..85fcc28 100644 (file)
        <ui-application appid="drag-and-drop.example" exec="/usr/apps/com.samsung.dali-demo/bin/drag-and-drop.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
                <label>Drag And Drop</label>
        </ui-application>
+       <ui-application appid="simple-text-label.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-label.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Simple Text Label</label>
+       </ui-application>
+       <ui-application appid="simple-bitmap-font-text-label.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-bitmap-font-text-label.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Simple Bitmap Font Text Label</label>
+       </ui-application>
+       <ui-application appid="simple-text-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Simple Text Field</label>
+       </ui-application>
+       <ui-application appid="simple-text-visual.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-visual.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Text Visual</label>
+       </ui-application>
+       <ui-application appid="simple-text-renderer.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-text-renderer.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Simple Text Renderer</label>
+       </ui-application>
+  <ui-application appid="gestures.example" exec="/usr/apps/com.samsung.dali-demo/bin/gestures.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Gestures</label>
+       </ui-application>
 
        <privileges>
                <privilege>http://tizen.org/privilege/mediastorage</privilege>
index dd149fc..8d54c9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -50,6 +50,7 @@ int DALI_EXPORT_API main(int argc, char **argv)
   demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND));
   demo.AddExample(Example("frame-callback.example", DALI_DEMO_STR_TITLE_FRAME_CALLBACK));
   demo.AddExample(Example("focus-integration.example", DALI_DEMO_STR_TITLE_FOCUS_INTEGRATION));
+  demo.AddExample(Example("gestures.example", DALI_DEMO_STR_TITLE_GESTURES));
   demo.AddExample(Example("gradients.example", DALI_DEMO_STR_TITLE_COLOR_GRADIENT));
   demo.AddExample(Example("hello-world.example", DALI_DEMO_STR_TITLE_HELLO_WORLD));
   demo.AddExample(Example("image-policies.example", DALI_DEMO_STR_TITLE_IMAGE_POLICIES));
diff --git a/examples/gestures/gesture-example.cpp b/examples/gestures/gesture-example.cpp
new file mode 100644 (file)
index 0000000..bbae267
--- /dev/null
@@ -0,0 +1,482 @@
+/*
+ * Copyright (c) 2019 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-toolkit/dali-toolkit.h>
+#include <string>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const Vector4 BACKGROUND_GRADIENT_1 = Vector4( 167.0f, 207.0f, 223.0f, 255.0f ) / 255.0f;
+const Vector4 BACKGROUND_GRADIENT_2 = Vector4(   0.0f,  64.0f, 137.0f, 255.0f ) / 255.0f;
+const Vector2 BACKGROUND_GRADIENT_START_POSITION( 0.0f, -0.5f );
+const Vector2 BACKGROUND_GRADIENT_END_POSITION( 0.0f,  0.5f );
+
+const Vector4 CONTROL_GRADIENT_1 = Vector4( 234.0f, 185.0f,  45.0f, 255.0f ) / 255.0f;
+const Vector4 CONTROL_GRADIENT_2 = Vector4( 199.0f, 152.0f,  16.0f, 255.0f ) / 255.0f;
+const Vector2 CONTROL_GRADIENT_CENTER( Vector2::ZERO );
+const float CONTROL_GRADIENT_RADIUS( 0.5f );
+
+const float HELP_ANIMATION_DURATION( 25.0f );
+const float HELP_ANIMATION_SEGMENT_TIME( 5.0f );
+const float HELP_ANIMATION_TRANSITION_DURATION( 0.75f );
+const Vector2 HELP_TEXT_POSITION_MULTIPLIER( 0.25f, 0.13f );
+
+const float SHAKY_ANIMATION_DURATION( 0.1f );
+const float SHAKY_ANIMATION_SEGMENT_TIME( 0.05f );
+const float SHAKY_ANIMATION_ANGLE( 1.0f );
+
+const float TOUCH_MODE_ANIMATION_DURATION( 0.1f );
+const Vector4 TOUCH_MODE_COLOR( 1.0f, 0.7f, 0.7f, 1.0f );
+
+const float PAN_MODE_CHANGE_ANIMATION_DURATION( 0.25f );
+const Vector3 PAN_MODE_START_ANIMATION_SCALE( 1.2f, 1.2f, 1.0f );
+const Vector3 PAN_MODE_END_ANIMATION_SCALE( 0.8f, 0.8f, 1.0f );
+
+const float TAP_ANIMATION_DURATON( 0.5f );
+const Vector4 TAP_ANIMATION_COLOR( 0.8f, 0.5, 0.2f, 0.6f );
+
+const Vector3 MINIMUM_SCALE( Vector3::ONE );
+const Vector3 MAXIMUM_SCALE( Vector3::ONE * 2.0f );
+const float SCALE_BACK_ANIMATION_DURATION( 0.25f );
+
+/**
+ * @brief Creates a background with a linear gradient which matches parent size & is placed in the center.
+ */
+Actor CreateBackground()
+{
+  Actor background = Control::New();
+  background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  background.SetParentOrigin( ParentOrigin::CENTER );
+  background.SetProperty(
+      Control::Property::BACKGROUND,
+      Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT )
+                     .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( BACKGROUND_GRADIENT_1 )
+                                                                                  .Add( BACKGROUND_GRADIENT_2 ) )
+                     .Add( GradientVisual::Property::START_POSITION, BACKGROUND_GRADIENT_START_POSITION )
+                     .Add( GradientVisual::Property::END_POSITION,   BACKGROUND_GRADIENT_END_POSITION ) );
+  return background;
+}
+
+/**
+ * @brief Create a control with a circular gradient & a specific size & is placed in the center of its parent.
+ *
+ * @param[in]  size  The size we want the control to be.
+ */
+Actor CreateTouchControl( const Vector2& size )
+{
+  Actor touchControl = Control::New();
+  touchControl.SetSize( size );
+  touchControl.SetParentOrigin( ParentOrigin::CENTER );
+  touchControl.SetProperty(
+      Control::Property::BACKGROUND,
+      Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT )
+                     .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( CONTROL_GRADIENT_1 )
+                                                                                  .Add( CONTROL_GRADIENT_2 ) )
+                     .Add( GradientVisual::Property::CENTER, CONTROL_GRADIENT_CENTER )
+                     .Add( GradientVisual::Property::RADIUS, CONTROL_GRADIENT_RADIUS )
+  );
+  return touchControl;
+}
+
+/**
+ * @brief Shows the given string between the given start and end times.
+ *
+ * Appropriately animates the string into and out of the scene.
+ *
+ * @param[in]  string     The label to display, this is an rvalue reference & will be moved
+ * @param[in]  parent     The parent to add the label to
+ * @param[in]  animation  The animation to add the animators created in this function
+ * @param[in]  startTime  When to start the animators
+ * @param[in]  endTime    When to end the animators
+ */
+void AddHelpInfo( const std::string&& string, Actor parent, Animation animation, float startTime, float endTime )
+{
+  Actor text = TextLabel::New( std::move( string ) );
+  Vector3 position( Stage::GetCurrent().GetSize() * HELP_TEXT_POSITION_MULTIPLIER );
+
+  text.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+  text.SetParentOrigin( ParentOrigin::TOP_CENTER );
+  text.SetPosition( position );
+  text.SetOpacity( 0.0f );
+  text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, Text::HorizontalAlignment::CENTER );
+  parent.Add( text );
+
+  // Animate IN
+  TimePeriod timePeriod( startTime, HELP_ANIMATION_TRANSITION_DURATION );
+  animation.AnimateTo( Property( text, Actor::Property::COLOR_ALPHA ),  1.0f,       timePeriod );
+  animation.AnimateBy( Property( text, Actor::Property::POSITION_X ),  -position.x, timePeriod );
+
+  // Animate OUT
+  timePeriod.delaySeconds = endTime;
+  animation.AnimateTo( Property( text, Actor::Property::COLOR_ALPHA ),  0.0f,       timePeriod );
+  animation.AnimateBy( Property( text, Actor::Property::POSITION_X ),  -position.x, timePeriod );
+}
+
+} // unnamed namespace
+
+/**
+ * @brief This example shows how to use the different gesture detectors available.
+ *
+ * - Tapping on the control shows a small rotation animation.
+ * - A Long press on the control puts it into Pan Mode.
+ * - When in Pan mode, the control can be panned (moved).
+ * - When the pan ends, we exit the Pan mode via an animation.
+ * - Pinching the control changes the scale of the control.
+ */
+class GestureExample : public ConnectionTracker
+{
+public:
+
+  /**
+   * @brief Constructor.
+   *
+   * @param[in]  application  Reference to the application
+   */
+  GestureExample( Application &application )
+  : mApplication( application )
+  {
+    // Connect to the Application's Init signal
+    application.InitSignal().Connect( this, &GestureExample::Create );
+  }
+
+private:
+
+  /**
+   * @brief Creates the scene as described in this class' description.
+   *
+   * @param[in]  application  Reference to the application class
+   */
+  void Create( Application& application )
+  {
+    // Get a handle to the stage & connect to the key event signal
+    Stage stage = Stage::GetCurrent();
+    stage.KeyEventSignal().Connect(this, &GestureExample::OnKeyEvent);
+
+    // Create a background with a gradient
+    Actor background = CreateBackground();
+    stage.Add( background );
+
+    // Create a control that we'll use for the gestures to be a quarter of the size of the stage
+    Actor touchControl = CreateTouchControl( stage.GetSize() * 0.25f );
+    background.Add( touchControl );
+
+    // Connect to the touch signal
+    touchControl.TouchSignal().Connect( this, &GestureExample::OnTouch );
+    touchControl.SetLeaveRequired( true );
+
+    // Create a long press gesture detector, attach the actor & connect
+    mLongPressDetector = LongPressGestureDetector::New();
+    mLongPressDetector.Attach( touchControl );
+    mLongPressDetector.DetectedSignal().Connect( this, &GestureExample::OnLongPress );
+
+    // Create a pan gesture detector, attach the actor & connect
+    mPanDetector = PanGestureDetector::New();
+    mPanDetector.Attach( touchControl );
+    mPanDetector.DetectedSignal().Connect( this, &GestureExample::OnPan );
+
+    // Create a tap gesture detector, attach the actor & connect
+    mTapDetector = TapGestureDetector::New();
+    mTapDetector.Attach( touchControl );
+    mTapDetector.DetectedSignal().Connect( this, &GestureExample::OnTap );
+
+    // Create a pinch gesture detector, attach the actor & connect
+    mPinchDetector = PinchGestureDetector::New();
+    mPinchDetector.Attach( touchControl );
+    mPinchDetector.DetectedSignal().Connect( this, &GestureExample::OnPinch );
+
+    // Create an animation which shakes the actor when in Pan mode
+    mShakeAnimation = Animation::New( SHAKY_ANIMATION_DURATION );
+    mShakeAnimation.AnimateBy( Property( touchControl, Actor::Property::ORIENTATION ),
+                               Quaternion( Degree(  SHAKY_ANIMATION_ANGLE ), Vector3::ZAXIS ),
+                               AlphaFunction::BOUNCE,
+                               TimePeriod( 0.0f, SHAKY_ANIMATION_SEGMENT_TIME ) );
+    mShakeAnimation.AnimateBy( Property( touchControl, Actor::Property::ORIENTATION ),
+                               Quaternion( Degree( -SHAKY_ANIMATION_ANGLE ), Vector3::ZAXIS ),
+                               AlphaFunction::BOUNCE,
+                               TimePeriod( SHAKY_ANIMATION_SEGMENT_TIME, SHAKY_ANIMATION_SEGMENT_TIME ) );
+
+    // Animate help information
+    // Here we just animate some text on the screen to show tips on how to use this example
+    // The help animation loops
+    Animation helpAnimation = Animation::New( HELP_ANIMATION_DURATION );
+
+    float startTime( 0.0f );
+    float endTime( startTime + HELP_ANIMATION_SEGMENT_TIME );
+
+    AddHelpInfo( "Tap image for animation",         background, helpAnimation, startTime, endTime );
+    AddHelpInfo( "Press & Hold image to drag",      background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
+    AddHelpInfo( "Pinch image to resize",           background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
+    helpAnimation.SetLooping( true );
+    helpAnimation.Play();
+  }
+
+  /**
+   * @brief Called when our actor is touched.
+   *
+   * @param[in]  actor  The touched actor
+   * @param[in]  touch  The touch event
+   */
+  bool OnTouch( Actor actor, const TouchData& touch )
+  {
+    switch( touch.GetState( 0 ) )
+    {
+      case PointState::DOWN:
+      {
+        // When we get a touch point, change the color of the actor.
+
+        Animation anim = Animation::New( TOUCH_MODE_ANIMATION_DURATION );
+        anim.AnimateTo( Property( actor, Actor::Property::COLOR ), TOUCH_MODE_COLOR );
+        anim.Play();
+        break;
+      }
+
+      case PointState::LEAVE:
+      case PointState::UP:
+      case PointState::INTERRUPTED:
+      {
+        if( ! mPanStarted )
+        {
+          // If we're not panning, change the color back to normal.
+
+          Animation anim = Animation::New( TOUCH_MODE_ANIMATION_DURATION );
+          anim.AnimateTo( Property( actor, Actor::Property::COLOR ), Vector4::ONE );
+          anim.Play();
+
+          // Stop the shake animation from looping.
+          mShakeAnimation.SetLooping( false );
+        }
+        break;
+      }
+
+      default:
+      {
+        break;
+      }
+    }
+    return true;
+  }
+
+  /**
+   * @brief Called when a long-press gesture is detected on our control.
+   *
+   * @param[in]  actor      The actor that's been long-pressed
+   * @param[in]  longPress  The long-press gesture information
+   */
+  void OnLongPress( Actor actor, const LongPressGesture& longPress )
+  {
+    switch( longPress.state )
+    {
+      case Gesture::Started:
+      {
+        // When we first receive a long press, change state to pan mode.
+
+        // Do a small animation to indicate to the user that we are in pan mode.
+        Animation anim = Animation::New( PAN_MODE_CHANGE_ANIMATION_DURATION );
+        anim.AnimateTo( Property( actor, Actor::Property::SCALE ), actor.GetCurrentScale() * PAN_MODE_START_ANIMATION_SCALE, AlphaFunction::BOUNCE );
+        anim.Play();
+        mPanMode = true;
+
+        // Start the shake animation so the user knows when they are in pan mode.
+        mShakeAnimation.SetLooping( true );
+        mShakeAnimation.Play();
+        break;
+      }
+
+      case Gesture::Finished:
+      case Gesture::Cancelled:
+      {
+        // We get this state when all touches are released after a long press. We end pan mode...
+        mPanMode = false;
+        break;
+      }
+
+      default:
+      {
+        break;
+      }
+    }
+  }
+
+  /**
+   * @brief Called when a pan gesture is detected on our control.
+   *
+   * @param[in]  actor  The actor that's been panned
+   * @param[in]  pan    The pan gesture information
+   */
+  void OnPan( Actor actor, const PanGesture& pan )
+  {
+    if( mPanMode || mPanStarted )
+    {
+      // When we are in Pan mode, just move the actor by the displacement.
+
+      // As the displacement is in local actor coords, we will have to multiply the displacement by the
+      // actor's scale so that it moves the correct amount in the parent's coordinate system.
+      Vector3 scaledDisplacement( pan.displacement );
+      scaledDisplacement *= actor.GetCurrentScale();
+
+      Vector3 currentPosition;
+      actor.GetProperty( Actor::Property::POSITION ).Get( currentPosition );
+
+      Vector3 newPosition = currentPosition + scaledDisplacement;
+      actor.SetPosition( newPosition );
+
+      switch( pan.state )
+      {
+        case Gesture::Started:
+        {
+          mPanStarted = true;
+          break;
+        }
+
+        case Gesture::Finished:
+        case Gesture::Cancelled:
+        {
+          // If we cancel or finish the pan, do an animation to indicate this and stop the shake animation.
+
+          Animation anim = Animation::New( PAN_MODE_CHANGE_ANIMATION_DURATION );
+          anim.AnimateTo( Property( actor, Actor::Property::COLOR ), Vector4::ONE );
+          anim.AnimateTo( Property( actor, Actor::Property::SCALE ), actor.GetCurrentScale() * PAN_MODE_END_ANIMATION_SCALE, AlphaFunction::BOUNCE );
+
+          // Move actor back to center if we're out of bounds
+          Vector2 halfStageSize = Stage::GetCurrent().GetSize() * 0.5f;
+          if( ( std::abs( newPosition.x ) > halfStageSize.width  ) ||
+              ( std::abs( newPosition.y ) > halfStageSize.height ) )
+          {
+            anim.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3::ZERO, AlphaFunction::EASE_IN );
+          }
+          anim.Play();
+
+          mShakeAnimation.SetLooping( false );
+          mPanStarted = false;
+          break;
+        }
+
+        default:
+        {
+          break;
+        }
+      }
+    }
+  }
+
+  /**
+   * @brief Called when a tap gesture is detected on our control.
+   *
+   * @param[in]  actor The actor that's been tapped
+   * @param[in]  tap   The tap gesture information
+   */
+  void OnTap( Actor actor, const TapGesture& tap )
+  {
+    // Do a short animation to show a tap has happened.
+
+    Animation anim = Animation::New( TAP_ANIMATION_DURATON );
+    anim.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Degree( 360.0f ), Vector3::ZAXIS ) );
+    anim.AnimateTo( Property( actor, Actor::Property::SCALE ), Vector3::ONE, AlphaFunction::LINEAR );
+    anim.AnimateTo( Property( actor, Actor::Property::COLOR ), TAP_ANIMATION_COLOR, AlphaFunction::BOUNCE );
+    anim.Play();
+  }
+
+  /**
+   * @brief Called when a pinch gesture is detected on our control.
+   *
+   * @param[in]  actor  The actor that's been pinched
+   * @param[in]  pinch  The pinch gesture information
+   */
+  void OnPinch( Actor actor, const PinchGesture& pinch )
+  {
+    switch( pinch.state )
+    {
+      case Gesture::Started:
+      {
+        // Starting scale is required so that we know what to multiply the pinch.scale by.
+        mStartingScale = actor.GetCurrentScale();
+        break;
+      }
+
+      case Gesture::Finished:
+      case Gesture::Cancelled:
+      {
+        Vector3 scale( actor.GetCurrentScale() );
+
+        // Ensure the actor sizes itself to be within the limits defined.
+        if ( scale.x < MINIMUM_SCALE.x )
+        {
+          scale = MINIMUM_SCALE;
+        }
+        else if ( scale.x > MAXIMUM_SCALE.x )
+        {
+          scale = MAXIMUM_SCALE;
+        }
+
+        // Do an animation to come back to go back to the limits.
+        Animation anim = Animation::New( SCALE_BACK_ANIMATION_DURATION );
+        anim.AnimateTo( Property( actor, Actor::Property::SCALE ), scale, AlphaFunction::LINEAR );
+        anim.Play();
+        break;
+      }
+
+      default:
+      {
+        break;
+      }
+    }
+
+    actor.SetScale( mStartingScale * pinch.scale );
+  }
+
+  /**
+   * @brief Called when any key event is received.
+   *
+   * Will use this to quit the application if Back or the Escape key is received.
+   * @param[in] event The key event information
+   */
+  void OnKeyEvent( const KeyEvent& event )
+  {
+    if( event.state == KeyEvent::Down )
+    {
+      if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
+private:
+  Application&  mApplication;
+
+  PanGestureDetector mPanDetector;
+  LongPressGestureDetector mLongPressDetector;
+  TapGestureDetector mTapDetector;
+  PinchGestureDetector mPinchDetector;
+
+  Vector3 mStartingScale; ///< Set to the scale of the control when pinch starts.
+  Animation mShakeAnimation; ///< "Shake" animation to show when we are in panning mode.
+  bool mPanMode = false; ///< Set to true when we have long-pressed to put us into panning mode.
+  bool mPanStarted = false; ///< Set to true to state that panning has started.
+};
+
+int DALI_EXPORT_API main( int argc, char **argv )
+{
+  Application application = Application::New( &argc, &argv );
+  GestureExample controller( application );
+  application.MainLoop();
+  return 0;
+}
diff --git a/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp b/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp
new file mode 100644 (file)
index 0000000..04ad1fb
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+/**
+ * @file simple-text-label-example.cpp
+ * @brief Basic usage of SimpleTextLabel control
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/devel-api/text-abstraction/bitmap-font.h>
+#include <dali-toolkit/devel-api/text/bitmap-font.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+/**
+ * @brief The main class of the demo.
+ */
+class SimpleTextLabelExample : public ConnectionTracker
+{
+public:
+
+  SimpleTextLabelExample( Application& application )
+  : mApplication( application )
+  {
+    // Connect to the Application's Init signal
+    mApplication.InitSignal().Connect( this, &SimpleTextLabelExample::Create );
+  }
+
+  ~SimpleTextLabelExample()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * One-time setup in response to Application InitSignal.
+   */
+  void Create( Application& application )
+  {
+    Stage stage = Stage::GetCurrent();
+
+    stage.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent);
+
+    TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+    DevelText::BitmapFontDescription fontDescription;
+    fontDescription.name = "Digits";
+    fontDescription.underlinePosition = 0.f;
+    fontDescription.underlineThickness = 0.f;
+
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0030.png", "0", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0031.png", "1", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0032.png", "2", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0033.png", "3", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0034.png", "4", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0035.png", "5", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0036.png", "6", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0037.png", "7", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0038.png", "8", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0039.png", "9", 34.f, 0.f } );
+    fontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u003a.png", ":", 34.f, 0.f } );
+
+
+    DevelText::BitmapFontDescription colorFontDescription;
+    colorFontDescription.name = "DigitsColor";
+    colorFontDescription.underlinePosition = 0.f;
+    colorFontDescription.underlineThickness = 0.f;
+    colorFontDescription.isColorFont = true;
+
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0030_color.png", "0", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0031_color.png", "1", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0032_color.png", "2", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0033_color.png", "3", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0034_color.png", "4", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0035_color.png", "5", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0036_color.png", "6", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0037_color.png", "7", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0038_color.png", "8", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u0039_color.png", "9", 34.f, 0.f } );
+    colorFontDescription.glyphs.push_back( { DEMO_IMAGE_DIR "u003a_color.png", ":", 34.f, 0.f } );
+
+    TextAbstraction::BitmapFont bitmapFont;
+    TextAbstraction::BitmapFont bitmapColorFont;
+
+    DevelText::CreateBitmapFont( fontDescription, bitmapFont );
+    DevelText::CreateBitmapFont( colorFontDescription, bitmapColorFont );
+
+    fontClient.GetFontId( bitmapFont );
+    fontClient.GetFontId( bitmapColorFont );
+
+    TextLabel label01 = TextLabel::New();
+    label01.SetAnchorPoint( AnchorPoint::CENTER );
+    label01.SetParentOrigin( ParentOrigin::CENTER );
+    label01.SetSize( 400.f, 50.f );
+    label01.SetPosition( 0.f, -100.f );
+    label01.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+    label01.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
+    label01.SetProperty( TextLabel::Property::TEXT, "012<color 'value'='green'>345</color>6789:" );
+    label01.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED );
+    label01.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
+
+    label01.SetBackgroundColor( Color::BLACK );
+
+    stage.Add( label01 );
+
+
+    TextLabel  label02 = TextLabel::New();
+    label02.SetAnchorPoint( AnchorPoint::CENTER );
+    label02.SetParentOrigin( ParentOrigin::CENTER );
+    label02.SetSize( 400.f, 50.f );
+    label02.SetPosition( 0.f, -50.f );
+    label02.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+    label02.SetProperty( TextLabel::Property::TEXT, "0123456789:" );
+    label02.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE );
+    label02.SetProperty( TextLabel::Property::FONT_FAMILY, "DigitsColor" );
+
+    label02.SetBackgroundColor( Color::BLACK );
+
+    stage.Add( label02 );
+
+    TextLabel  label03 = TextLabel::New();
+    label03.SetAnchorPoint( AnchorPoint::CENTER );
+    label03.SetParentOrigin( ParentOrigin::CENTER );
+    label03.SetSize( 400.f, 50.f );
+    label03.SetPosition( 0.f, 0.f );
+    label03.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+    label03.SetProperty( TextLabel::Property::TEXT, "0123456789:" );
+    label03.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
+
+    label03.SetBackgroundColor( Color::WHITE );
+
+    stage.Add( label03 );
+
+    TextLabel  label04 = TextLabel::New();
+    label04.SetAnchorPoint( AnchorPoint::CENTER );
+    label04.SetParentOrigin( ParentOrigin::CENTER );
+    label04.SetSize( 400.f, 50.f );
+    label04.SetPosition( 0.f, 50.f );
+    label04.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+    label04.SetProperty( TextLabel::Property::TEXT, "0123456789:" );
+    label04.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" );
+    label04.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE );
+
+    label04.SetBackgroundColor( Color::BLACK );
+
+    stage.Add( label04 );
+ }
+
+  /**
+   * Main key event handler
+   */
+  void OnKeyEvent(const KeyEvent& event)
+  {
+    if(event.state == KeyEvent::Down)
+    {
+      if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
+private:
+
+  Application& mApplication;
+};
+
+void RunTest( Application& application )
+{
+  SimpleTextLabelExample test( application );
+
+  application.MainLoop();
+}
+
+/** Entry point for Linux & Tizen applications */
+int main( int argc, char **argv )
+{
+  Application application = Application::New( &argc, &argv );
+
+  RunTest( application );
+
+  return 0;
+}
diff --git a/examples/simple-text-field/simple-text-field.cpp b/examples/simple-text-field/simple-text-field.cpp
new file mode 100644 (file)
index 0000000..d96906b
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+/**
+ * @file simple-text-field-example.cpp
+ * @brief Very basic usage of TextField control
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+#include <iostream>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+
+/**
+ * @brief The main class of the demo.
+ */
+class SimpleTextFieldExample : public ConnectionTracker
+{
+public:
+
+  SimpleTextFieldExample( Application& application )
+  : mApplication( application )
+  {
+    // Connect to the Application's Init signal
+    mApplication.InitSignal().Connect( this, &SimpleTextFieldExample::Create );
+  }
+
+  ~SimpleTextFieldExample()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * One-time setup in response to Application InitSignal.
+   */
+  void Create( Application& application )
+  {
+    Stage stage = Stage::GetCurrent();
+    stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
+
+    TextField field = TextField::New();
+    field.SetParentOrigin( ParentOrigin::CENTER );
+    field.SetSize( 300.f, 60.f );
+    field.SetBackgroundColor( Color::WHITE );
+    field.SetBackgroundColor( Vector4( 1.f, 1.f, 1.f, 0.15f ) );
+
+    field.SetProperty( TextField::Property::TEXT_COLOR, Color::BLACK );
+    field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" );
+    field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." );
+
+    stage.Add( field );
+  }
+
+private:
+
+  Application& mApplication;
+};
+
+void RunTest( Application& application )
+{
+  SimpleTextFieldExample test( application );
+
+  application.MainLoop();
+}
+
+/** Entry point for Linux & Tizen applications */
+int main( int argc, char **argv )
+{
+  // DALI_DEMO_THEME_PATH not passed to Application so TextField example uses default Toolkit style sheet.
+  Application application = Application::New( &argc, &argv );
+
+  RunTest( application );
+
+  return 0;
+}
diff --git a/examples/simple-text-label/simple-text-label-example.cpp b/examples/simple-text-label/simple-text-label-example.cpp
new file mode 100644 (file)
index 0000000..78e7db7
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+/**
+ * @file simple-text-label-example.cpp
+ * @brief Basic usage of SimpleTextLabel control
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+/**
+ * @brief The main class of the demo.
+ */
+class SimpleTextLabelExample : public ConnectionTracker
+{
+public:
+
+  SimpleTextLabelExample( Application& application )
+  : mApplication( application )
+  {
+    // Connect to the Application's Init signal
+    mApplication.InitSignal().Connect( this, &SimpleTextLabelExample::Create );
+  }
+
+  ~SimpleTextLabelExample()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * One-time setup in response to Application InitSignal.
+   */
+  void Create( Application& application )
+  {
+    Stage stage = Stage::GetCurrent();
+
+    stage.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent);
+
+    mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" );
+    mLabel.SetName( "SimpleTextLabel" );
+    mLabel.SetAnchorPoint( AnchorPoint::CENTER );
+    mLabel.SetParentOrigin( ParentOrigin::CENTER );
+    mLabel.SetSize( 400.f, 400.f );
+    mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
+    mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
+    mLabel.SetBackgroundColor( Color::WHITE );
+
+    stage.Add( mLabel );
+  }
+
+  /**
+   * Main key event handler
+   */
+  void OnKeyEvent(const KeyEvent& event)
+  {
+    if(event.state == KeyEvent::Down)
+    {
+      if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
+private:
+
+  Application& mApplication;
+
+  TextLabel mLabel;
+};
+
+void RunTest( Application& application )
+{
+  SimpleTextLabelExample test( application );
+
+  application.MainLoop();
+}
+
+/** Entry point for Linux & Tizen applications */
+int main( int argc, char **argv )
+{
+  Application application = Application::New( &argc, &argv );
+
+  RunTest( application );
+
+  return 0;
+}
diff --git a/examples/simple-text-renderer/simple-text-renderer-example.cpp b/examples/simple-text-renderer/simple-text-renderer-example.cpp
new file mode 100644 (file)
index 0000000..3f8116f
--- /dev/null
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+/**
+ * @file simple-text-renderer-example.cpp
+ * @brief Basic usage of Text Renderer utility.
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/text/text-utils-devel.h>
+#include <devel-api/adaptor-framework/image-loading.h>
+
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+
+const std::string IMAGE1 = DEMO_IMAGE_DIR "application-icon-1.png";
+const std::string IMAGE2 = DEMO_IMAGE_DIR "application-icon-6.png";
+
+#define MAKE_SHADER(A)#A
+
+const std::string VERSION_3_ES = "#version 300 es\n";
+
+const char* VERTEX_SHADER = MAKE_SHADER(
+  precision mediump float;
+
+  in vec2 aPosition;
+  in vec2 aTexCoord;
+
+  out vec2 vUV;
+
+  uniform vec3 uSize;
+  uniform mat4 uMvpMatrix;
+
+  void main()
+  {
+    vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
+    vertexPosition.xyz *= uSize;
+    gl_Position = uMvpMatrix * vertexPosition;
+
+    vUV = aTexCoord;
+  }
+);
+
+const char* FRAGMENT_SHADER = MAKE_SHADER(
+  precision mediump float;
+
+  in vec2 vUV;
+
+  out vec4 FragColor;
+
+  uniform sampler2D sAlbedo;
+  uniform vec4 uColor;
+
+  void main()
+  {
+    vec4 color = texture( sAlbedo, vUV );
+    FragColor = vec4( color.rgb, uColor.a * color.a );
+  }
+);
+
+Renderer CreateRenderer()
+{
+  // Create the geometry.
+  struct Vertex
+  {
+    Dali::Vector2 position;
+    Dali::Vector2 texCoord;
+  };
+
+  static const Vertex vertices[] = {{ Dali::Vector2( -0.5f, -0.5f ), Dali::Vector2( 0.0f, 0.0f ) },
+                                    { Dali::Vector2(  0.5f, -0.5f ), Dali::Vector2( 1.0f, 0.0f ) },
+                                    { Dali::Vector2( -0.5f,  0.5f ), Dali::Vector2( 0.0f, 1.0f ) },
+                                    { Dali::Vector2(  0.5f,  0.5f ), Dali::Vector2( 1.0f, 1.0f ) }};
+
+  Property::Map property;
+  property.Add("aPosition", Property::VECTOR2).Add("aTexCoord", Property::VECTOR2);
+
+  PropertyBuffer vertexBuffer = PropertyBuffer::New(property);
+
+  vertexBuffer.SetData(vertices, sizeof(vertices) / sizeof(Vertex));
+
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer(vertexBuffer);
+
+  geometry.SetType(Geometry::TRIANGLE_STRIP);
+
+  // Create the shader
+  Shader shader = Shader::New( VERSION_3_ES + VERTEX_SHADER, VERSION_3_ES + FRAGMENT_SHADER );
+
+  // Create the renderer
+
+  Renderer renderer = Renderer::New( geometry, shader );
+
+  return renderer;
+}
+
+TextureSet CreateTextureSet( const Dali::Toolkit::DevelText::RendererParameters& textParameters, const std::vector<std::string>& embeddedItems )
+{
+
+  Dali::Vector<Dali::Toolkit::DevelText::EmbeddedItemInfo> embeddedItemLayout;
+
+  Devel::PixelBuffer pixelBuffer = Toolkit::DevelText::Render( textParameters, embeddedItemLayout );
+
+
+  const int dstWidth = static_cast<int>( pixelBuffer.GetWidth() );
+  const int dstHeight = static_cast<int>( pixelBuffer.GetHeight() );
+
+  unsigned int index = 0u;
+  for( const auto& itemLayout : embeddedItemLayout )
+  {
+    int width = static_cast<int>( itemLayout.size.width );
+    int height = static_cast<int>( itemLayout.size.height );
+    int x = static_cast<int>( itemLayout.position.x );
+    int y = static_cast<int>( itemLayout.position.y );
+
+    Dali::Devel::PixelBuffer itemPixelBuffer = Dali::LoadImageFromFile( embeddedItems[index++] );
+    itemPixelBuffer.Resize( width, height );
+    itemPixelBuffer.Rotate( itemLayout.angle );
+
+    width = static_cast<int>( itemPixelBuffer.GetWidth() );
+    height = static_cast<int>( itemPixelBuffer.GetHeight() );
+
+    Dali::Pixel::Format itemPixelFormat = itemPixelBuffer.GetPixelFormat();
+
+    // Check if the item is out of the buffer.
+
+    if( ( x + width < 0 ) ||
+        ( x > dstWidth ) ||
+        ( y < 0 ) ||
+        ( y - height > dstHeight ) )
+    {
+      // The embedded item is completely out of the buffer.
+      continue;
+    }
+
+    // Crop if it exceeds the boundaries of the destination buffer.
+    int layoutX = 0;
+    int layoutY = 0;
+    int cropX = 0;
+    int cropY = 0;
+    int newWidth = width;
+    int newHeight = height;
+
+    bool crop = false;
+
+    if( 0 > x )
+    {
+      newWidth += x;
+      cropX = std::abs( x );
+      crop = true;
+    }
+    else
+    {
+      layoutX = x;
+    }
+
+    if( cropX + newWidth > dstWidth )
+    {
+      crop = true;
+      newWidth -= ( ( cropX + newWidth ) - dstWidth );
+    }
+
+    layoutY = y;
+    if( 0.f > layoutY )
+    {
+      newHeight += layoutY;
+      cropY = std::abs(layoutY);
+      crop = true;
+    }
+
+    if( cropY + newHeight > dstHeight )
+    {
+      crop = true;
+      newHeight -= ( ( cropY + newHeight ) - dstHeight );
+    }
+
+    uint16_t uiCropX = static_cast<uint16_t>(cropX);
+    uint16_t uiCropY = static_cast<uint16_t>(cropY);
+    uint16_t uiNewWidth = static_cast<uint16_t>(newWidth);
+    uint16_t uiNewHeight = static_cast<uint16_t>(newHeight);
+
+    if( crop )
+    {
+      itemPixelBuffer.Crop( uiCropX, uiCropY, uiNewWidth, uiNewHeight );
+    }
+
+    // Blend the item pixel buffer with the text's color according its blending mode.
+    if( Dali::TextAbstraction::ColorBlendingMode::MULTIPLY == itemLayout.colorBlendingMode )
+    {
+      Dali::Devel::PixelBuffer buffer = Dali::Devel::PixelBuffer::New( uiNewWidth,
+                                                                       uiNewHeight,
+                                                                       itemPixelFormat );
+
+      unsigned char* bufferPtr = buffer.GetBuffer();
+      const unsigned char* itemBufferPtr = itemPixelBuffer.GetBuffer();
+      const unsigned int bytesPerPixel = Dali::Pixel::GetBytesPerPixel(itemPixelFormat);
+      const unsigned int size = uiNewWidth * uiNewHeight * bytesPerPixel;
+
+      for (unsigned int i = 0u; i < size; i += bytesPerPixel)
+      {
+        *(bufferPtr + 0u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 0u) ) * textParameters.textColor.r );
+        *(bufferPtr + 1u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 1u) ) * textParameters.textColor.g );
+        *(bufferPtr + 2u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 2u) ) * textParameters.textColor.b );
+        *(bufferPtr + 3u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 3u) ) * textParameters.textColor.a );
+
+        itemBufferPtr += bytesPerPixel;
+        bufferPtr += bytesPerPixel;
+      }
+
+      itemPixelBuffer = buffer;
+    }
+
+    Dali::Toolkit::DevelText::UpdateBuffer(itemPixelBuffer, pixelBuffer, layoutX, layoutY, true);
+  }
+
+  PixelData pixelData = Devel::PixelBuffer::Convert( pixelBuffer );
+
+  Texture texture = Texture::New( TextureType::TEXTURE_2D,
+                                  pixelData.GetPixelFormat(),
+                                  pixelData.GetWidth(),
+                                  pixelData.GetHeight() );
+  texture.Upload(pixelData);
+
+  TextureSet textureSet = TextureSet::New();
+  textureSet.SetTexture( 0u, texture );
+
+  return textureSet;
+}
+
+} // namespace
+
+
+/**
+ * @brief The main class of the demo.
+ */
+class SimpleTextRendererExample : public ConnectionTracker
+{
+public:
+
+  SimpleTextRendererExample( Application& application )
+  : mApplication( application )
+  {
+    // Connect to the Application's Init signal
+    mApplication.InitSignal().Connect( this, &SimpleTextRendererExample::Create );
+  }
+
+  ~SimpleTextRendererExample()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * One-time setup in response to Application InitSignal.
+   */
+  void Create( Application& application )
+  {
+    Stage stage = Stage::GetCurrent();
+    stage.SetBackgroundColor( Color::WHITE );
+    stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
+
+    stage.KeyEventSignal().Connect(this, &SimpleTextRendererExample::OnKeyEvent);
+
+    const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + IMAGE1 + "'/>";
+    const std::string image2 = "<item 'width'=26 'height'=26/>";
+
+    Dali::Toolkit::DevelText::RendererParameters textParameters;
+    textParameters.text = "Hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
+    textParameters.horizontalAlignment = "center";
+    textParameters.verticalAlignment = "center";
+    textParameters.circularAlignment = "center";
+    textParameters.fontFamily = "SamsungUI";
+    textParameters.fontWeight = "";
+    textParameters.fontWidth = "";
+    textParameters.fontSlant = "";
+    textParameters.layout = "circular";
+    textParameters.textColor = Color::BLACK;
+    textParameters.fontSize = 25.f;
+    textParameters.textWidth = 360u;
+    textParameters.textHeight = 360u;
+    textParameters.radius = 180u;
+    textParameters.beginAngle = 15.f;
+    textParameters.incrementAngle = 360.f;
+    textParameters.ellipsisEnabled = true;
+    textParameters.markupEnabled = true;
+
+    std::vector<std::string> embeddedItems = { IMAGE2, IMAGE2, IMAGE2, IMAGE2, IMAGE2 };
+
+    TextureSet textureSet = CreateTextureSet( textParameters, embeddedItems );
+
+    Renderer renderer = CreateRenderer();
+    renderer.SetTextures( textureSet );
+
+    Actor actor = Actor::New();
+    actor.SetAnchorPoint( AnchorPoint::CENTER );
+    actor.SetParentOrigin( ParentOrigin::CENTER );
+    actor.SetPosition( 0.f, 0.f);
+    actor.SetSize( 360.f, 360.f );
+    actor.SetColor( Color::WHITE );
+
+    actor.AddRenderer( renderer );
+
+    stage.Add( actor );
+  }
+
+  /**
+   * Main key event handler
+   */
+  void OnKeyEvent(const KeyEvent& event)
+  {
+    if(event.state == KeyEvent::Down)
+    {
+      if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
+private:
+
+  Application& mApplication;
+};
+
+/** Entry point for Linux & Tizen applications */
+int main( int argc, char **argv )
+{
+  Application application = Application::New( &argc, &argv );
+
+  SimpleTextRendererExample test( application );
+
+  application.MainLoop();
+
+  return 0;
+}
diff --git a/examples/simple-text-visual/simple-text-visual-example.cpp b/examples/simple-text-visual/simple-text-visual-example.cpp
new file mode 100644 (file)
index 0000000..b92e2a4
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+/**
+ * @file text-visual-example.cpp
+ * @brief Basic usage of Text Visual.
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+/**
+ * @brief The main class of the demo.
+ */
+class TextVisualExample : public ConnectionTracker
+{
+public:
+
+  TextVisualExample( Application& application )
+  : mApplication( application )
+  {
+    // Connect to the Application's Init signal
+    mApplication.InitSignal().Connect( this, &TextVisualExample::Create );
+  }
+
+  ~TextVisualExample()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * One-time setup in response to Application InitSignal.
+   */
+  void Create( Application& application )
+  {
+    Stage stage = Stage::GetCurrent();
+
+    stage.KeyEventSignal().Connect(this, &TextVisualExample::OnKeyEvent);
+    stage.SetBackgroundColor( Color::WHITE );
+
+    Dali::Toolkit::Control control = Dali::Toolkit::ImageView::New();
+    control.SetParentOrigin( ParentOrigin::CENTER );
+
+    const std::string markupText( "<color value='blue'><font size='50'>H</font></color>ello <color value='blue'><font size='50'>w</font></color>orld" );
+
+    Dali::Property::Map map;
+    map.Add( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::TEXT ).
+      Add( Dali::Toolkit::TextVisual::Property::ENABLE_MARKUP, true ).
+      Add( Dali::Toolkit::TextVisual::Property::TEXT, markupText ).
+      Add( Dali::Toolkit::TextVisual::Property::TEXT_COLOR, Dali::Vector4( 0.25f, 0.25f, 0.5f, 1.f ) ).
+      Add( Dali::Toolkit::TextVisual::Property::FONT_FAMILY, "TizenSansRegular" ).
+      Add( Dali::Toolkit::TextVisual::Property::POINT_SIZE, 30.f ).
+      Add( Dali::Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, "END" ).
+      Add( Dali::Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, "CENTER" );
+
+    control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+
+    stage.Add( control );
+  }
+
+  /**
+   * Main key event handler
+   */
+  void OnKeyEvent(const KeyEvent& event)
+  {
+    if(event.state == KeyEvent::Down)
+    {
+      if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
+private:
+
+  Application& mApplication;
+
+  TextLabel mLabel;
+};
+
+void RunTest( Application& application )
+{
+  TextVisualExample test( application );
+
+  application.MainLoop();
+}
+
+/** Entry point for Linux & Tizen applications */
+int main( int argc, char **argv )
+{
+  Application application = Application::New( &argc, &argv );
+
+  RunTest( application );
+
+  return 0;
+}
index fec61e2..ae96df1 100755 (executable)
@@ -2,7 +2,7 @@
 
 Name:       com.samsung.dali-demo
 Summary:    The OpenGLES Canvas Core Demo
-Version:    1.4.14
+Version:    1.4.15
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
diff --git a/resources/images/u0030.png b/resources/images/u0030.png
new file mode 100644 (file)
index 0000000..1b0cc3c
Binary files /dev/null and b/resources/images/u0030.png differ
diff --git a/resources/images/u0030_color.png b/resources/images/u0030_color.png
new file mode 100644 (file)
index 0000000..e96a6cb
Binary files /dev/null and b/resources/images/u0030_color.png differ
diff --git a/resources/images/u0031.png b/resources/images/u0031.png
new file mode 100644 (file)
index 0000000..2c70e9c
Binary files /dev/null and b/resources/images/u0031.png differ
diff --git a/resources/images/u0031_color.png b/resources/images/u0031_color.png
new file mode 100644 (file)
index 0000000..fe63bea
Binary files /dev/null and b/resources/images/u0031_color.png differ
diff --git a/resources/images/u0032.png b/resources/images/u0032.png
new file mode 100644 (file)
index 0000000..2ed2d75
Binary files /dev/null and b/resources/images/u0032.png differ
diff --git a/resources/images/u0032_color.png b/resources/images/u0032_color.png
new file mode 100644 (file)
index 0000000..c0344a0
Binary files /dev/null and b/resources/images/u0032_color.png differ
diff --git a/resources/images/u0033.png b/resources/images/u0033.png
new file mode 100644 (file)
index 0000000..2cb1673
Binary files /dev/null and b/resources/images/u0033.png differ
diff --git a/resources/images/u0033_color.png b/resources/images/u0033_color.png
new file mode 100644 (file)
index 0000000..50d5d62
Binary files /dev/null and b/resources/images/u0033_color.png differ
diff --git a/resources/images/u0034.png b/resources/images/u0034.png
new file mode 100644 (file)
index 0000000..99d72e1
Binary files /dev/null and b/resources/images/u0034.png differ
diff --git a/resources/images/u0034_color.png b/resources/images/u0034_color.png
new file mode 100644 (file)
index 0000000..2afbbaf
Binary files /dev/null and b/resources/images/u0034_color.png differ
diff --git a/resources/images/u0035.png b/resources/images/u0035.png
new file mode 100644 (file)
index 0000000..2780eae
Binary files /dev/null and b/resources/images/u0035.png differ
diff --git a/resources/images/u0035_color.png b/resources/images/u0035_color.png
new file mode 100644 (file)
index 0000000..7a08e63
Binary files /dev/null and b/resources/images/u0035_color.png differ
diff --git a/resources/images/u0036.png b/resources/images/u0036.png
new file mode 100644 (file)
index 0000000..62e240f
Binary files /dev/null and b/resources/images/u0036.png differ
diff --git a/resources/images/u0036_color.png b/resources/images/u0036_color.png
new file mode 100644 (file)
index 0000000..c4e0df2
Binary files /dev/null and b/resources/images/u0036_color.png differ
diff --git a/resources/images/u0037.png b/resources/images/u0037.png
new file mode 100644 (file)
index 0000000..ae3790a
Binary files /dev/null and b/resources/images/u0037.png differ
diff --git a/resources/images/u0037_color.png b/resources/images/u0037_color.png
new file mode 100644 (file)
index 0000000..0ee53db
Binary files /dev/null and b/resources/images/u0037_color.png differ
diff --git a/resources/images/u0038.png b/resources/images/u0038.png
new file mode 100644 (file)
index 0000000..e2b0d13
Binary files /dev/null and b/resources/images/u0038.png differ
diff --git a/resources/images/u0038_color.png b/resources/images/u0038_color.png
new file mode 100644 (file)
index 0000000..0f7f785
Binary files /dev/null and b/resources/images/u0038_color.png differ
diff --git a/resources/images/u0039.png b/resources/images/u0039.png
new file mode 100644 (file)
index 0000000..2a3f481
Binary files /dev/null and b/resources/images/u0039.png differ
diff --git a/resources/images/u0039_color.png b/resources/images/u0039_color.png
new file mode 100644 (file)
index 0000000..1133735
Binary files /dev/null and b/resources/images/u0039_color.png differ
diff --git a/resources/images/u003a.png b/resources/images/u003a.png
new file mode 100644 (file)
index 0000000..a6ca724
Binary files /dev/null and b/resources/images/u003a.png differ
diff --git a/resources/images/u003a_color.png b/resources/images/u003a_color.png
new file mode 100644 (file)
index 0000000..4922e69
Binary files /dev/null and b/resources/images/u003a_color.png differ
index bdfeeed..9b51947 100755 (executable)
@@ -40,6 +40,9 @@ msgstr "Clipping"
 msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER"
 msgstr "Clipping Draw Order"
 
+msgid "DALI_DEMO_STR_TITLE_GESTURES"
+msgstr "Gestures"
+
 msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
 msgstr "Colour Gradient"
 
index d2b73e3..6e8104f 100755 (executable)
@@ -40,6 +40,9 @@ msgstr "Clipping"
 msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER"
 msgstr "Clipping Draw Order"
 
+msgid "DALI_DEMO_STR_TITLE_GESTURES"
+msgstr "Gestures"
+
 msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
 msgstr "Color Gradient"
 
@@ -261,3 +264,12 @@ msgstr "Web View"
 
 msgid "DALI_DEMO_STR_TITLE_ANIMATED_VECTOR_IMAGES"
 msgstr "Animated Vector Images"
+
+msgid "DALI_DEMO_STR_TITLE_TEXT_RENDERER"
+msgstr "Text Renderer"
+
+msgid "DALI_DEMO_STR_TITLE_TEXT_VISUAL"
+msgstr "Text Visual"
+
+msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT"
+msgstr "Text Bitmap Font"
index 08580a1..d8e51aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -46,6 +46,7 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_CARD_ACTIVE                 dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CARD_ACTIVE")
 #define DALI_DEMO_STR_TITLE_CLIPPING                    dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING")
 #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER         dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER")
+#define DALI_DEMO_STR_TITLE_GESTURES                    dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_GESTURES")
 #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT              dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT")
 #define DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS  dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS")
 #define DALI_DEMO_STR_TITLE_CONTACT_CARDS               dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CONTACT_CARDS")
@@ -119,6 +120,9 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_TOOLTIP                     dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TOOLTIP")
 #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS          dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS")
 #define DALI_DEMO_STR_TITLE_WEB_VIEW                    dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_WEB_VIEW")
+#define DALI_DEMO_STR_TITLE_TEXT_RENDERER               dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_RENDERER")
+#define DALI_DEMO_STR_TITLE_TEXT_VISUAL                 dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_VISUAL")
+#define DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT      dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT")
 
 #else // !INTERNATIONALIZATION_ENABLED
 
@@ -136,6 +140,7 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_CARD_ACTIVE                 "Card Active"
 #define DALI_DEMO_STR_TITLE_CLIPPING                    "Clipping"
 #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER         "Clipping Draw Order"
+#define DALI_DEMO_STR_TITLE_GESTURES                    "Gestures"
 #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT              "Color Gradient"
 #define DALI_DEMO_STR_TITLE_COMPRESSED_TEXTURE_FORMATS  "Compressed Texture Formats"
 #define DALI_DEMO_STR_TITLE_CONTACT_CARDS               "Contact Cards"
@@ -209,6 +214,9 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_TOOLTIP                     "Tooltip"
 #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS          "Visual Transitions"
 #define DALI_DEMO_STR_TITLE_WEB_VIEW                    "Web View"
+#define DALI_DEMO_STR_TITLE_TEXT_RENDERER               "Text Renderer"
+#define DALI_DEMO_STR_TITLE_TEXT_VISUAL                 "Text Visual"
+#define DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT      "Text Bitmap Font"
 #endif
 
 #ifdef __cplusplus
index b8e84fb..fe635c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -49,6 +49,11 @@ int DALI_EXPORT_API main(int argc, char **argv)
   demo.AddExample(Example("text-memory-profiling.example", DALI_DEMO_STR_TITLE_TEXT_MEMORY_PROFILING));
   demo.AddExample(Example("text-overlap.example", DALI_DEMO_STR_TITLE_TEXT_OVERLAP));
   demo.AddExample(Example("visual-transitions.example", DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS));
+  demo.AddExample(Example("simple-text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL));
+  demo.AddExample(Example("simple-text-field.example", DALI_DEMO_STR_TITLE_TEXT_FIELD));
+  demo.AddExample(Example("simple-text-renderer.example", DALI_DEMO_STR_TITLE_TEXT_RENDERER));
+  demo.AddExample(Example("simple-text-visual.example", DALI_DEMO_STR_TITLE_TEXT_VISUAL));
+  demo.AddExample(Example("simple-bitmap-font-text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT));
 
   demo.SortAlphabetically( true );