BaseComponent: Introduce CanvasView component for vector primitives.
authorJunsuChoi <jsuya.choi@samsung.com>
Thu, 18 Mar 2021 08:40:22 +0000 (17:40 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 1 Apr 2021 01:24:35 +0000 (10:24 +0900)
CanvasView draws Vector Primitives using ThorVG library.
CanvasView can draw a shape in its internal buffer by adding a Shape object.
Shape is a command list based on Path. Fill and Stroke properties can be set using setters and getters.
Paint is a parent class of Shape and it has common class of classes to be added later (Scene, etc.).

Classes
  Tizen.NUI.BaseComponents.VectorGraphics.CanvasView
  Tizen.NUI.BaseComponents.VectorGraphics.Paint
  Tizen.NUI.BaseComponents.VectorGraphics.Shape

Dependancy
  Dali-Toolkit : https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-toolkit/+/250398/
  Dali-Adaptor : https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-adaptor/+/250466/
  ThorVG : https://github.com/Samsung/thorvg

Example
  test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CanvasViewSamsple.cs

src/Tizen.NUI/src/internal/Interop/Interop.CanvasView.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.Paint.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.Shape.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/CanvasView.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/Paint.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/Shape.cs [new file with mode: 0755]
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CanvasViewSamsple.cs [new file with mode: 0644]

diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.CanvasView.cs b/src/Tizen.NUI/src/internal/Interop/Interop.CanvasView.cs
new file mode 100755 (executable)
index 0000000..c281ce2
--- /dev/null
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.NUI
+{
+    internal static partial class Interop
+    {
+        internal static partial class CanvasView
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_CanvasView_Property")]
+            public static extern global::System.IntPtr NewCanvasViewProperty();
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_CanvasView_Property")]
+            public static extern void DeleteCanvasViewProperty(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_New__SWIG_0")]
+            public static extern global::System.IntPtr New(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_CanvasView")]
+            public static extern void DeleteCanvasView(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_Assign")]
+            public static extern global::System.IntPtr Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_DownCast")]
+            public static extern global::System.IntPtr DownCast(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_AddPaint")]
+            public static extern bool AddPaint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Paint.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Paint.cs
new file mode 100755 (executable)
index 0000000..a103ad7
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI
+{
+    internal static partial class Interop
+    {
+        internal static partial class Paint
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Translate")]
+            public static extern bool Translate(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_SetOpacity")]
+            public static extern bool SetOpacity(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_GetOpacity")]
+            public static extern float GetOpacity(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Scale")]
+            public static extern bool Scale(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Rotate")]
+            public static extern bool Rotate(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Transform")]
+            public static extern bool Transform(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)] float[] jarg2);
+        }
+}
+    }
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Shape.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Shape.cs
new file mode 100755 (executable)
index 0000000..d08e531
--- /dev/null
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.NUI
+{
+    internal static partial class Interop
+    {
+        internal static partial class Shape
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_New")]
+            public static extern global::System.IntPtr New();
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_AddRect")]            
+            public static extern bool AddRect(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, float jarg7);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_AddCircle")]
+            public static extern bool AddCircle(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_AddArc")]
+            public static extern bool AddArc(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, bool jarg7);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_AddMoveTo")]
+            public static extern bool AddMoveTo(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_AddLineTo")]
+            public static extern bool AddLineTo(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_AddCubicTo")]
+            public static extern bool AddCubicTo(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, float jarg7);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_Close")]
+            public static extern bool Close(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetFillColor")]
+            public static extern bool SetFillColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetFillColor")]
+            public static extern global::System.IntPtr GetFillColor(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetFillRule")]
+            public static extern bool SetFillRule(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetFillRule")]
+            public static extern int GetFillRule(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetStrokeWidth")]
+            public static extern bool SetStrokeWidth(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetStrokeWidth")]
+            public static extern float GetStrokeWidth(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetStrokeColor")]
+            public static extern bool SetStrokeColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetStrokeColor")]
+            public static extern global::System.IntPtr GetStrokeColor(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_SetStrokeDash")]
+            public static extern bool SetStrokeDash(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)] float[] jarg2, int jarg3);
+            
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_GetStrokeDashIndexOf")]
+            public static extern float GetStrokeDashIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+            
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_GetStrokeDashCount")]
+            public static extern int GetStrokeDashCount(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetStrokeCap")]
+            public static extern bool SetStrokeCap(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetStrokeCap")]
+            public static extern int GetStrokeCap(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetStrokeJoin")]
+            public static extern bool SetStrokeJoin(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetStrokeJoin")]
+            public static extern int GetStrokeJoin(global::System.Runtime.InteropServices.HandleRef jarg1);
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/CanvasView.cs b/src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/CanvasView.cs
new file mode 100755 (executable)
index 0000000..f51864d
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+* 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.
+*
+*/
+using System;
+using System.ComponentModel;
+
+
+namespace Tizen.NUI.BaseComponents
+{
+    namespace VectorGraphics
+    {
+        /// <summary>
+        /// CanvasView is a class for displaying vector primitives.<br />
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public class CanvasView : View
+        {
+            
+            static CanvasView() { }
+
+            /// <summary>
+            /// Creates an initialized CanvasView.
+            /// </summary>
+            /// <param name="viewBox">The size of viewbox.</param>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public CanvasView(Size2D viewBox) : this(Interop.CanvasView.New(Uint16Pair.getCPtr( new Uint16Pair((uint)viewBox.Width, (uint)viewBox.Height))), true)
+            {
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+
+            internal CanvasView(global::System.IntPtr cPtr, bool shown = true) : base(cPtr, shown)
+            {
+                if (!shown)
+                {
+                    SetVisible(false);
+                }
+            }
+
+            /// <summary>
+            /// Downcasts a handle to CanvasView handle.
+            /// </summary>
+            /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
+            /// Please do not use! this will be deprecated!
+            /// Instead please use as keyword.
+            [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
+            "Like: " +
+            "BaseHandle handle = new CanvasView(viewBox); " +
+            "CanvasView canvasView = handle as CanvasView")]
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public static CanvasView DownCast(BaseHandle handle)
+            {
+                if (null == handle)
+                {
+                    throw new ArgumentNullException(nameof(handle));
+                }
+                CanvasView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as CanvasView;
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+
+            /// This will not be public opened.
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+            {
+                Interop.CanvasView.DeleteCanvasView(swigCPtr);
+            }
+
+            /// <summary>
+            /// you can override it to clean-up your own resources.
+            /// </summary>
+            /// <param name="type">DisposeTypes</param>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            protected override void Dispose(DisposeTypes type)
+            {
+                if (disposed)
+                {
+                    return;
+                }
+
+                base.Dispose(type);
+            }
+
+            /// <summary>
+            /// Add paint object to the CanvasView.
+            /// This method is similar to registration. The added shape is drawn on the inner canvas.
+            /// </summary>
+            /// <param name="paint">Paint object</param>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public void AddPaint(Paint paint)
+            {   
+                Interop.CanvasView.AddPaint(View.getCPtr(this), BaseHandle.getCPtr(paint));
+            }
+
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/Paint.cs b/src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/Paint.cs
new file mode 100755 (executable)
index 0000000..4f30567
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+* 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.
+*
+*/
+using System.ComponentModel;
+
+namespace Tizen.NUI.BaseComponents
+{
+
+    namespace VectorGraphics
+    {
+        /// <summary>
+        /// Paint is a object class for drawing a vector primitive.<br />
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public class Paint : BaseHandle
+        {
+            private Paint()
+            {
+
+            }
+
+            internal Paint(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+            {
+            }
+
+            /// <summary>
+            /// Set the transparency value
+            /// </summary>
+            /// <param name="opacity">The transparency level [0 ~ 1.0], 0 means totally transparent, while 1 means opaque.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool SetOpacity(float opacity)
+            {   
+                if (Interop.Paint.SetOpacity(BaseHandle.getCPtr(this), opacity))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Get the transparency value
+            /// </summary>
+            /// <returns>The transparency level</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public float GetOpacity()
+            {   
+                return Interop.Paint.GetOpacity(BaseHandle.getCPtr(this));
+            }
+
+            /// <summary>
+            /// Set the x, y movement value of translate transformation.
+            /// </summary>
+            /// <param name="x">The x-axis movement value.</param>
+            /// <param name="y">The y-axis movement value.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool Translate(float x, float y)
+            {   
+                if (Interop.Paint.Translate(BaseHandle.getCPtr(this), x, y))
+                    return true;
+                return false;
+            }
+            
+            /// <summary>
+            /// Set the scale value of scale transformation.
+            /// </summary>
+            /// <param name="factor">The scale factor value.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool Scale(float factor)
+            {   
+                if (Interop.Paint.Scale(BaseHandle.getCPtr(this), factor))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Set the angle of rotation transformation.
+            /// </summary>
+            /// <param name="degree">The degree value of angle.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool Rotate(float degree)
+            {   
+                if (Interop.Paint.Rotate(BaseHandle.getCPtr(this), degree))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Set the matrix value for affine transform.
+            /// </summary>
+            /// <param name="matrix">The float type array of 3x3 matrix.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool Transform(float[] matrix)
+            {   
+                if (Interop.Paint.Transform(BaseHandle.getCPtr(this), matrix))
+                    return true;
+                return false;
+            }
+        }
+        
+
+    }
+}
diff --git a/src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/Shape.cs b/src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/Shape.cs
new file mode 100755 (executable)
index 0000000..fb53e7e
--- /dev/null
@@ -0,0 +1,397 @@
+/*
+* 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.
+*
+*/
+using System.ComponentModel;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.BaseComponents
+{
+
+    namespace VectorGraphics
+    {
+        /// <summary>
+        /// Shape is a command list for drawing one shape groups It has own path data & properties for sync/asynchronous drawing
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public class Shape : Paint
+        {
+            /// <summary>
+            /// Enumeration for The cap style to be used for stroking the path.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public enum StrokeCap
+            {
+                /// <summary>
+                /// The end of lines is rendered as a square around the last point.
+                /// </summary>
+                Square = 0,
+                /// <summary>
+                /// The end of lines is rendered as a half-circle around the last point.
+                /// </summary>
+                Round,
+                /// <summary>
+                /// The end of lines is rendered as a full stop on the last point itself.
+                /// </summary>
+                Butt
+            }
+
+            /// <summary>
+            /// numeration for The join style to be used for stroking the path.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public enum StrokeJoin
+            {
+                /// <summary>
+                /// Used to render beveled line joins. The outer corner of the joined lines is filled by enclosing the triangular region of the corner with a straight line between the outer corners of each stroke.
+                /// </summary>
+                Bevel = 0,
+                /// <summary>
+                /// Used to render rounded line joins. Circular arcs are used to join two lines smoothly.
+                /// </summary>
+                Round,
+                /// <summary>
+                /// Used to render mitered line joins. The intersection of the strokes is clipped at a line perpendicular to the bisector of the angle between the strokes, at the distance from the intersection of the segments equal to the product of the miter limit value and the border radius.  This prevents long spikes being created.
+                /// </summary>
+                Miter
+            }
+
+            /// <summary>
+            /// Enumeration for The fill rule of shape.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public enum FillRule
+            {
+                /// <summary>
+                /// Draw a horizontal line from the point to a location outside the shape. Determine whether the direction of the line at each intersection point is up or down. The winding number is determined by summing the direction of each intersection. If the number is non zero, the point is inside the shape.
+                /// </summary>
+                Winding = 0,
+                /// <summary>
+                /// Draw a horizontal line from the point to a location outside the shape, and count the number of intersections. If the number of intersections is an odd number, the point is inside the shape.
+                /// </summary>
+                EvenOdd
+            }
+
+            public Shape() : this(Interop.Shape.New(), true)
+            {
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+
+            internal Shape(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+            {
+            }
+
+            /// <summary>
+            /// Append the given rectangle with rounded corner to the path.
+            /// The roundedCorner arguments specify the radii of the ellipses defining the
+            /// corners of the rounded rectangle.
+            ///
+            /// roundedCorner are specified in terms of width and height respectively.
+            ///
+            /// If roundedCorner's values are 0, then it will draw a rectangle without rounded corner.
+            /// </summary>
+            /// <param name="x">X co-ordinate of the rectangle.</param>
+            /// <param name="Y">Y co-ordinate of the rectangle.</param>
+            /// <param name="width">Width of the rectangle.</param>
+            /// <param name="height">Height of the rectangle.</param>
+            /// <param name="roundedCornerX">The x radius of the rounded corner and should be in range [ 0 to w/2 ].</param>
+            /// <param name="roundedCornerY">The y radius of the rounded corner and should be in range [ 0 to w/2 ].</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool AddRect(float x, float y, float width, float height, float roundedCornerX, float roundedCornerY)
+            {   
+                if (Interop.Shape.AddRect(BaseHandle.getCPtr(this), x, y, width, height, roundedCornerX, roundedCornerY))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Append a circle with given center and x,y-axis radius
+            /// </summary>
+            /// <param name="x">X co-ordinate of the center of the circle.</param>
+            /// <param name="y">Y co-ordinate of the center of the circle.</param>
+            /// <param name="radiusX">X axis radius of the circle.</param>
+            /// <param name="radiusY">X axis radius of the circle.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool AddCircle(float x, float y, float radiusX, float radiusY)
+            {
+                if (Interop.Shape.AddCircle(BaseHandle.getCPtr(this), x, y, radiusX, radiusY))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Append the arcs.
+            /// </summary>
+            /// <param name="x">X co-ordinate of end point of the arc.</param>
+            /// <param name="y">Y co-ordinate of end point of the arc.</param>
+            /// <param name="radius">Radius of arc</param>
+            /// <param name="startAngle">Start angle (in degrees) where the arc begins.</param>
+            /// <param name="sweep">The Angle measures how long the arc will be drawn.</param>
+            /// <param name="pie">If True, the area is created by connecting start angle point and sweep angle point of the drawn arc. If false, it doesn't.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool AddArc(float x, float y, float radius, float startAngle, float sweep, bool pie)
+            {
+                if (Interop.Shape.AddArc(BaseHandle.getCPtr(this), x, y, radius, startAngle, sweep, pie))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Add a point that sets the given point as the current point,
+            /// implicitly starting a new subpath and closing the previous one.
+            /// </summary>
+            /// <param name="x">X co-ordinate of the current point.</param>
+            /// <param name="y">Y co-ordinate of the current point.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool AddMoveTo(float x, float y)
+            {
+                if (Interop.Shape.AddMoveTo(BaseHandle.getCPtr(this), x, y))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Adds a straight line from the current position to the given end point.
+            /// After the line is drawn, the current position is updated to be at the
+            /// end point of the line.
+            /// If no current position present, it draws a line to itself, basically * a point.
+            /// </summary>
+            /// <param name="x">X co-ordinate of end point of the line.</param>
+            /// <param name="y">Y co-ordinate of end point of the line.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool AddLineTo(float x, float y)
+            {
+                if (Interop.Shape.AddLineTo(BaseHandle.getCPtr(this), x, y))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Adds a cubic Bezier curve between the current position and the
+            /// given end point (lineEndPoint) using the control points specified by
+            /// (controlPoint1), and (controlPoint2). After the path is drawn,
+            /// the current position is updated to be at the end point of the path.
+            /// </summary>
+            /// <param name="controlPoint1X">X co-ordinate of 1st control point.</param>
+            /// <param name="controlPoint1Y">Y co-ordinate of 1st control point.</param>
+            /// <param name="controlPoint2X">X co-ordinate of 2nd control point.</param>
+            /// <param name="controlPoint2Y">Y co-ordinate of 2nd control point.</param>
+            /// <param name="endPointX">X co-ordinate of end point of the line.</param>
+            /// <param name="endPointY">Y co-ordinate of end point of the line.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool AddCubicTo(float controlPoint1X, float controlPoint1Y, float controlPoint2X, float controlPoint2Y, float endPointX, float endPointY)
+            {
+                if (Interop.Shape.AddCubicTo(BaseHandle.getCPtr(this),  controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, endPointX, endPointY))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Closes the current subpath by drawing a line to the beginning of the
+            /// subpath, automatically starting a new path. The current point of the
+            /// new path is (0, 0).
+            /// If the subpath does not contain any points, this function does nothing.
+            /// </summary>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool Close()
+            {
+                if (Interop.Shape.Close(BaseHandle.getCPtr(this)))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Set the color to use for filling the path.
+            /// </summary>
+            /// <param name="color">The color value.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool SetFillColor(Color color)
+            {   
+                if (Interop.Shape.SetFillColor(BaseHandle.getCPtr(this), Vector4.getCPtr(color)))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Get the color to use for filling the path.
+            /// </summary>
+            /// <returns>Returns the color value.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public Color GetFillColor()
+            {   
+                global::System.IntPtr cPtr = Interop.Shape.GetFillColor(BaseHandle.getCPtr(this));
+                Color color = Vector4.GetVector4FromPtr(cPtr);
+                return color;
+            }
+
+            /// <summary>
+            /// Set the fill rule.
+            /// </summary>
+            /// <param name="rule">The current fill rule of the shape.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool SetFillRule(FillRule rule)
+            {
+                if (Interop.Shape.SetFillRule(BaseHandle.getCPtr(this), (int)rule))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Get the fill rule.
+            /// </summary>
+            /// <returns>Returns the current fill rule of the shape.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public FillRule GetFillRule()
+            {
+                return (FillRule)Interop.Shape.GetFillRule(BaseHandle.getCPtr(this));
+            }
+
+            /// <summary>
+            /// Set the stroke width to use for stroking the path.
+            /// </summary>
+            /// <param name="width">Stroke width to be used.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool SetStrokeWidth(float width)
+            {
+                if (Interop.Shape.SetStrokeWidth(BaseHandle.getCPtr(this), width))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Get the stroke width to use for stroking the path.
+            /// </summary>
+            /// <returns>Returns stroke width to be used.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public float GetStrokeWidth()
+            {
+                return Interop.Shape.GetStrokeWidth(BaseHandle.getCPtr(this));
+            }
+            
+            /// <summary>
+            /// Set the color to use for stroking the path.
+            /// </summary>
+            /// <param name="color">The stroking color.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool SetStrokeColor(Color color)
+            {
+                if (Interop.Shape.SetStrokeColor(BaseHandle.getCPtr(this), Vector4.getCPtr(color)))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Get the color to use for stroking the path.
+            /// </summary>
+            /// <returns>Returns the stroking color.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public Color GetStrokeColor()
+            {
+                global::System.IntPtr cPtr = Interop.Shape.GetStrokeColor(BaseHandle.getCPtr(this));
+                Color color = Vector4.GetVector4FromPtr(cPtr);
+                return color;
+            }
+
+            /// <summary>
+            /// Sets the stroke dash pattern. The dash pattern is specified dash pattern.
+            /// </summary>
+            /// <param name="dashPattern">Lenght and a gap list.</param>
+            /// <param name="count">Pattern list length</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public bool SetStrokeDash(float[] dashPattern, int count)
+            {
+                if (Interop.Shape.SetStrokeDash(BaseHandle.getCPtr(this), dashPattern, count))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Gets the stroke dash pattern.
+            /// </summary>
+            /// <returns>Returns the stroke dash pattern. The dash pattern is specified dash pattern.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public List<float> GetStrokeDash()
+            {
+                List<float> pattern = new List<float>();
+
+                int patternCount = Interop.Shape.GetStrokeDashCount(BaseHandle.getCPtr(this));
+                for(int i = 0; i < patternCount; i++)
+                {
+                    pattern.Add(Interop.Shape.GetStrokeDashIndexOf(BaseHandle.getCPtr(this), i));
+                }
+                return pattern;
+            }
+
+            /// <summary>
+            /// Set the cap style to use for stroking the path. The cap will be used for capping the end point of a open subpath.
+            /// </summary>
+            /// <param name="cap">Cap style to use.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]            
+            public bool SetStrokeCap(StrokeCap cap)
+            {
+                if (Interop.Shape.SetStrokeCap(BaseHandle.getCPtr(this), (int)cap))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Get the cap style to use for stroking the path.
+            /// </summary>
+            /// <returns>Returns the cap style.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]            
+            public StrokeCap GetStrokeCap()
+            {
+                return (StrokeCap)Interop.Shape.GetStrokeCap(BaseHandle.getCPtr(this));
+            }
+
+            /// <summary>
+            /// Set the join style to use for stroking the path.
+            /// The join style will be used for joining the two line segment while stroking the path.
+            /// </summary>
+            /// <param name="join">Join style to use.</param>
+            /// <returns>True when it's successful. False otherwise.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]            
+            public bool SetStrokeJoin(StrokeJoin join)
+            {
+                if (Interop.Shape.SetStrokeJoin(BaseHandle.getCPtr(this), (int)join))
+                    return true;
+                return false;
+            }
+
+            /// <summary>
+            /// Get the join style to use for stroking the path.
+            /// </summary>
+            /// <returns>Returns join style to use.</returns>
+            [EditorBrowsable(EditorBrowsableState.Never)]            
+            public StrokeJoin GetStrokeJoin()
+            {
+                return (StrokeJoin)Interop.Shape.GetStrokeJoin(BaseHandle.getCPtr(this));
+            }
+        }
+    }
+}
diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CanvasViewSamsple.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CanvasViewSamsple.cs
new file mode 100644 (file)
index 0000000..65e7ca4
--- /dev/null
@@ -0,0 +1,163 @@
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.BaseComponents.VectorGraphics;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Samples
+{
+    using log = Tizen.Log;
+
+    public class CanvasViewSample : IExample
+    {
+        private View root;
+        private CanvasView canvasView ;
+        private Shape mShape;
+
+        private int mCount = 0;
+
+        const string tag = "NUITEST";
+        private Timer timer;
+
+        public void Activate()
+        {
+            Window window = NUIApplication.GetDefaultWindow();
+
+            root = new View()
+            {
+                Size = window.Size,
+                ParentOrigin = ParentOrigin.Center,
+                PivotPoint = PivotPoint.Center,
+                PositionUsesPivotPoint = true,
+            };
+            window.Add(root);
+
+            canvasView = new CanvasView(window.Size)
+            {
+                Size = window.Size,
+                ParentOrigin = ParentOrigin.Center,
+                PivotPoint = PivotPoint.Center,
+                PositionUsesPivotPoint = true,
+            };
+
+            Shape shape1 = new Shape();
+            shape1.AddRect(-50.0f, -50.0f, 100.0f, 100.0f, 10.0f, 10.0f);
+            shape1.SetFillColor(new Color(0.5f, 1.0f, 0.0f, 1.0f));
+            shape1.SetStrokeColor(new Color(0.5f, 0.0f, 0.0f, 0.5f));
+            shape1.SetStrokeWidth(10.0f);
+            
+            shape1.Translate(100.0f, 100.0f);
+            shape1.Scale(1.2f);
+            shape1.Rotate(45.0f);
+           
+            canvasView.AddPaint(shape1);
+
+            Shape shape2 = new Shape();
+            shape2.AddCircle(0.0f, 0.0f, 150.0f, 100.0f);
+            shape2.SetOpacity(0.5f);
+            shape2.SetFillColor(new Color(0.0f, 0.0f, 1.0f, 1.0f));
+            shape2.SetStrokeColor(new Color(1.0f, 1.0f, 0.0f, 1.0f));
+            shape2.SetStrokeWidth(10.0f);
+            shape2.SetStrokeDash(new float[] {15.0f, 30.0f}, 2);
+
+            shape2.Transform(new float[] {0.6f, 0.0f, 350.0f, 0.0f, 0.6f, 100.0f, 0.0f, 0.0f, 1.0f});
+
+            canvasView.AddPaint(shape2);
+
+            Shape shape3 = new Shape();
+            shape3.AddArc(0.0f, 0.0f, 80.0f, 10.0f, 120.0f, true);
+            shape3.SetStrokeColor(new Color(0.0f, 0.5f, 0.0f, 0.5f));
+            shape3.SetStrokeWidth(10.0f);
+            shape3.Translate(100.0f, 300.0f);
+            shape3.SetStrokeJoin(Shape.StrokeJoin.Miter);
+            canvasView.AddPaint(shape3);
+
+            Shape shape4 = new Shape();
+            shape4.AddMoveTo(0.0f, -160.0f);
+            shape4.AddLineTo(125.0f, 160.0f);
+            shape4.AddLineTo(-180.0f, -45.0f);
+            shape4.AddLineTo(180.0f, -45.0f);    
+            shape4.AddLineTo(-125.0f, 160.0f);
+            shape4.Close();
+            shape4.SetFillColor(new Color(0.0f, 0.5f, 0.0f, 0.5f));
+            shape4.SetStrokeColor(new Color(0.5f, 0.0f, 0.5f, 0.5f));
+            shape4.SetStrokeWidth(30.0f);
+            shape4.Translate(350.0f, 300.0f);
+            shape4.Scale(0.5f);
+            shape4.SetFillRule(Shape.FillRule.EvenOdd);
+            shape4.SetStrokeJoin(Shape.StrokeJoin.Round);
+            shape4.SetOpacity(0.5f);
+            
+            canvasView.AddPaint(shape4);
+
+            mShape = new Shape();
+            mShape.AddMoveTo(-1.0f, -165.0f);
+            mShape.AddLineTo(53.0f, -56.0f);
+            mShape.AddLineTo(174.0f, -39.0f);
+            mShape.AddLineTo(87.0f, 45.0f);
+            mShape.AddLineTo(107.0f, 166.0f);
+            mShape.AddLineTo(-1.0f, 110.0f);
+            mShape.AddLineTo(-103.0f, 166.0f);
+            mShape.AddLineTo(-88.0f, 46.0f);
+            mShape.AddLineTo(-174.0f, -38.0f);
+            mShape.AddLineTo(-54.0f, -56.0f);
+
+            mShape.Close();
+
+            mShape.SetFillColor(new Color(0.0f, 1.0f, 1.0f, 1.0f));
+            mShape.SetStrokeColor(new Color(0.5f, 1.0f, 0.5f, 1.0f));
+            mShape.SetStrokeWidth(30.0f);
+            mShape.SetStrokeCap(Shape.StrokeCap.Round);
+            mShape.Scale(0.6f);
+            mShape.Translate(250.0f, 550.0f);
+            mShape.SetOpacity(0.5f);
+
+            canvasView.AddPaint(mShape);
+
+            timer = new Timer(1000 / 32);
+            timer.Tick += onTick;
+            timer.Start();
+
+
+            // Test Get APIs
+            Color shape2Color = shape2.GetFillColor();
+            log.Debug(tag, "Shape2 Color : " + shape2Color.R + " " + shape2Color.G + " " + shape2Color.B + " " + shape2Color.A + "\n");
+
+            Color shape2StrockeColor = shape2.GetStrokeColor();
+            log.Debug(tag, "Shape2 StrokeColor : " + shape2StrockeColor.R + " " + shape2StrockeColor.G + " " + shape2StrockeColor.B + " " + shape2StrockeColor.A + "\n");
+
+            log.Debug(tag, "Shape3 StrokeCap : " + shape3.GetStrokeCap() + "\n");
+
+            log.Debug(tag, "Shape4 FillRule : " + shape4.GetFillRule() + "\n");
+            log.Debug(tag, "Shape4 StrokeWidth : " + shape4.GetStrokeWidth() + "\n");
+            log.Debug(tag, "Shape4 StrokeJoin : " + shape4.GetStrokeJoin() + "\n");
+            log.Debug(tag, "Shape4 Opacity : " + shape4.GetOpacity() + "\n");
+
+            List<float> pattern = shape2.GetStrokeDash();
+            for(int i = 0; i < pattern.Count; i++)
+            {
+                log.Debug(tag, "Shape4 StrokeDash : " + pattern[i] + "\n");
+            }
+            
+            root.Add(canvasView);
+        }
+
+        private bool onTick(object o, Timer.TickEventArgs e)
+        {
+            mShape.Rotate((float)(mCount * 2.0f));
+            mShape.Scale((float)(mCount % 100) * 0.01f + 0.6f);
+            mCount++;
+
+            return true;
+        }
+
+        public void Deactivate()
+        {
+            if (root != null)
+            {
+                NUIApplication.GetDefaultWindow().Remove(root);
+                canvasView.Dispose();
+                root.Dispose();
+            }
+        }
+    }
+}