CanvasRenderer::Shape: Add ResetPath() method for reset path information 97/256797/3
authorJunsuChoi <jsuya.choi@samsung.com>
Tue, 13 Apr 2021 07:07:30 +0000 (16:07 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 14 Apr 2021 05:34:24 +0000 (14:34 +0900)
There was no way to modify or remote previously added path information.
The user can update the shape by deleting the path information
and adding a new path information by using ResetPath() API.

Change-Id: Ia5a6484877aa410c18ba6c53d72bc65c77ad09fa

dali/devel-api/adaptor-framework/canvas-renderer-shape.cpp
dali/devel-api/adaptor-framework/canvas-renderer-shape.h
dali/internal/canvas-renderer/common/shape-impl.cpp
dali/internal/canvas-renderer/common/shape-impl.h
dali/internal/canvas-renderer/tizen/shape-impl-tizen.cpp
dali/internal/canvas-renderer/tizen/shape-impl-tizen.h
dali/internal/canvas-renderer/ubuntu/shape-impl-ubuntu.cpp
dali/internal/canvas-renderer/ubuntu/shape-impl-ubuntu.h

index 4dd6b75ba015eb8e3c8be075185b9ce595efd8c6..56fc4ce9a5004cdfae80979e21a1d224e9222868 100644 (file)
@@ -78,6 +78,11 @@ bool CanvasRenderer::Shape::Close()
   return GetImplementation(*this).Close();
 }
 
+bool CanvasRenderer::Shape::ResetPath()
+{
+  return GetImplementation(*this).ResetPath();
+}
+
 bool CanvasRenderer::Shape::SetFillColor(Vector4 color)
 {
   return GetImplementation(*this).SetFillColor(color);
index ddd621c514cf8f43f5ecc83541b187135a08f83b..91ca295e461ff1b5f060eb5d4644d5d27275fdde 100644 (file)
@@ -179,6 +179,13 @@ public:
    */
   bool Close();
 
+  /**
+   * @brief Reset the added path(rect, circle, path, etc...) information.
+   * Color and Stroke information are keeped.
+   * @return Returns True when it's successful. False otherwise.
+   */
+  bool ResetPath();
+
   /**
    * @brief Set the color to use for filling the path.
    * @param[in] color The color value.
index 3b3e850b9bd8a872c839ac1524e2e02f3122f849..b71e7a676529c4fc7cd2e216e154a0f5fe3812f9 100644 (file)
@@ -63,6 +63,11 @@ bool Shape::Close()
   return false;
 }
 
+bool Shape::ResetPath()
+{
+  return false;
+}
+
 bool Shape::SetFillColor(Vector4 color)
 {
   return false;
index e5b485dc553c014eeedd33f1db7afa7d0f350ff6..2b6193578508cd5270d4d7f9cb17901aed9e3974 100644 (file)
@@ -82,10 +82,15 @@ public:
   virtual bool AddCubicTo(Vector2 controlPoint1, Vector2 controlPoint2, Vector2 endPoint);
 
   /**
-   * @copydoc Dali::CanvasRenderer::Shape::AddClose
+   * @copydoc Dali::CanvasRenderer::Shape::Close
    */
   virtual bool Close();
 
+  /**
+   * @copydoc Dali::CanvasRenderer::Shape::ResetPath
+   */
+  virtual bool ResetPath();
+
   /**
    * @copydoc Dali::CanvasRenderer::Shape::SetFillColor
    */
index 04db5c4b1f31f650abe5f8099c3c4710cd4ac698..7c8dd2ad56a386efe290ffcbfe534daf035e07e9 100644 (file)
@@ -216,6 +216,27 @@ bool ShapeTizen::Close()
 #endif
 }
 
+bool ShapeTizen::ResetPath()
+{
+#ifdef THORVG_SUPPORT
+  if(!mTvgShape)
+  {
+    DALI_LOG_ERROR("Shape is null\n");
+    return false;
+  }
+
+  if(static_cast<tvg::Shape*>(mTvgShape)->reset() != tvg::Result::Success)
+  {
+    DALI_LOG_ERROR("reset() fail.\n");
+    return false;
+  }
+  Drawable::SetChanged(true);
+  return true;
+#else
+  return false;
+#endif
+}
+
 bool ShapeTizen::SetFillColor(Vector4 color)
 {
 #ifdef THORVG_SUPPORT
index 0e9311334914b20fc42988991bc6c913becaf227..3b6fdb050f68a67e8ba89f2c0259e31121676e20 100644 (file)
@@ -82,6 +82,11 @@ public:
    */
   bool Close() override;
 
+  /**
+   * @copydoc Dali::CanvasRenderer::Shape::ResetPath
+   */
+  bool ResetPath() override;
+
   /**
    * @copydoc Dali::CanvasRenderer::Shape::SetFillColor
    */
index 6eae2d486d6999987fac7bcb04132af7dfe7b449..3605083130006806f652fcb5d41ffddccb6df3a4 100644 (file)
@@ -216,6 +216,27 @@ bool ShapeUbuntu::Close()
 #endif
 }
 
+bool ShapeUbuntu::ResetPath()
+{
+#ifdef THORVG_SUPPORT
+  if(!mTvgShape)
+  {
+    DALI_LOG_ERROR("Shape is null\n");
+    return false;
+  }
+
+  if(static_cast<tvg::Shape*>(mTvgShape)->reset() != tvg::Result::Success)
+  {
+    DALI_LOG_ERROR("reset() fail.\n");
+    return false;
+  }
+  Drawable::SetChanged(true);
+  return true;
+#else
+  return false;
+#endif
+}
+
 bool ShapeUbuntu::SetFillColor(Vector4 color)
 {
 #ifdef THORVG_SUPPORT
index 491a2bd4fcbfbd271d60c493fc25e2e38387a520..bd4b08792403e0c5030fcc4e80cf9c332a015e54 100644 (file)
@@ -82,6 +82,11 @@ public:
    */
   bool Close() override;
 
+  /**
+   * @copydoc Dali::CanvasRenderer::Shape::ResetPath
+   */
+  bool ResetPath() override;
+
   /**
    * @copydoc Dali::CanvasRenderer::Shape::SetFillColor
    */