[NUI] VectorGraphcis: Change StrokeDash type from List to ReadOnlyCollection.
authorJunsuChoi <jsuya.choi@samsung.com>
Wed, 24 Mar 2021 01:58:36 +0000 (10:58 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 1 Apr 2021 01:24:35 +0000 (10:24 +0900)
src/Tizen.NUI/src/public/BaseComponents/VectorGraphcis/Shape.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CanvasViewSamsple.cs

index 4a24605..2ffe8b6 100755 (executable)
@@ -17,6 +17,7 @@
 
 using System;
 using System.ComponentModel;
+using System.Collections.ObjectModel;
 using System.Collections.Generic;
 
 namespace Tizen.NUI.BaseComponents.VectorGraphics
@@ -194,15 +195,17 @@ namespace Tizen.NUI.BaseComponents.VectorGraphics
         /// </summary>
         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public List<float> StrokeDash
+        public ReadOnlyCollection<float> StrokeDash
         {
             get {
-                List<float> ret = new List<float>();
+                List<float> retList = new List<float>();
                 int patternCount = Interop.Shape.GetStrokeDashCount(BaseHandle.getCPtr(this));
                 for (int i = 0; i < patternCount; i++)
                 {
-                    ret.Add(Interop.Shape.GetStrokeDashIndexOf(BaseHandle.getCPtr(this), i));
+                    retList.Add(Interop.Shape.GetStrokeDashIndexOf(BaseHandle.getCPtr(this), i));
                 }
+                
+                ReadOnlyCollection<float> ret = new ReadOnlyCollection<float>(retList);
                 return ret;
             }
             set {
index 71d12af..f8c343a 100644 (file)
@@ -1,6 +1,8 @@
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.BaseComponents.VectorGraphics;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
 
 namespace Tizen.NUI.Samples
 {
@@ -56,7 +58,7 @@ namespace Tizen.NUI.Samples
                 FillColor = new Color(0.0f, 0.0f, 1.0f, 1.0f),
                 StrokeColor = new Color(1.0f, 1.0f, 0.0f, 1.0f),
                 StrokeWidth = 10.0f,
-                StrokeDash = new List<float>() {15.0f, 30.0f},
+                StrokeDash = new List<float>(){15.0f, 30.0f}.AsReadOnly(),
             };
             shape2.AddCircle(0.0f, 0.0f, 150.0f, 100.0f);
             shape2.Transform(new float[] {0.6f, 0.0f, 350.0f, 0.0f, 0.6f, 100.0f, 0.0f, 0.0f, 1.0f});
@@ -118,11 +120,6 @@ namespace Tizen.NUI.Samples
 
             canvasView.AddDrawable(shape);
 
-            timer = new Timer(1000 / 32);
-            timer.Tick += onTick;
-            timer.Start();
-
-
             // Test Getter
             log.Debug(tag, "Shape2 Color : " + shape2.FillColor.R + " " + shape2.FillColor.G + " " + shape2.FillColor.B + " " + shape2.FillColor.A + "\n");
             log.Debug(tag, "Shape2 StrokeColor : " + shape2.StrokeColor.R + " " + shape2.StrokeColor.G + " " + shape2.StrokeColor.B + " " + shape2.StrokeColor.A + "\n");
@@ -140,6 +137,10 @@ namespace Tizen.NUI.Samples
             }
             
             root.Add(canvasView);
+
+            timer = new Timer(1000 / 32);
+            timer.Tick += onTick;
+            timer.Start();
         }
 
         public void Deactivate()