[NUI] Add Culled property as Hidden-API
authorDongsug Song <dongsug.song@samsung.com>
Fri, 19 Feb 2021 06:20:35 +0000 (15:20 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 25 Feb 2021 08:24:58 +0000 (17:24 +0900)
- pair with https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/253893/
- should be merged after https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/253893/ is applied

src/Tizen.NUI/src/internal/Interop/Interop.ActorProperty.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CulledTest.cs [new file with mode: 0755]

index ab678da..01b890c 100755 (executable)
@@ -196,6 +196,9 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_Actor_Property")]
             public static extern void DeleteActorProperty(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_Property_CULLED_get")]
+            public static extern int CulledGet();
         }
     }
 }
index 1e2be3a..c41b61d 100755 (executable)
@@ -2525,5 +2525,26 @@ namespace Tizen.NUI.BaseComponents
         {
             get;
         } = new List<Transition>();
+
+        /// <summary>
+        /// Get whether the View is culled or not.
+        /// True means that the View is out of the view frustum.
+        /// </summary>
+        /// <remarks>
+        /// Hidden-API (Inhouse-API).
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Culled
+        {
+            get
+            {
+                bool temp = false;
+                var pValue = GetProperty(View.Property.Culled);
+                pValue.Get(out temp);
+                pValue.Dispose();
+                return temp;
+            }
+        }
+
     }
 }
index 2668007..cbc8d89 100755 (executable)
@@ -210,6 +210,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int SHADOW = Interop.ViewProperty.ShadowGet();
             internal static readonly int CaptureAllTouchAfterStart = Interop.ActorProperty.CaptureAllTouchAfterStartGet();
             internal static readonly int BlendEquation = Interop.ActorProperty.BlendEquationGet();
+            internal static readonly int Culled = Interop.ActorProperty.CulledGet();
         }
     }
 }
diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CulledTest.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CulledTest.cs
new file mode 100755 (executable)
index 0000000..621b1a6
--- /dev/null
@@ -0,0 +1,68 @@
+
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using NUnit.Framework;
+
+namespace Tizen.NUI.Samples
+{
+    using tlog = Tizen.Log;
+    public class CulledTest : IExample
+    {
+        const string tag = "NUITEST";
+        private Window win;
+        private TextLabel text, textStatus;
+        private Timer timer;
+
+        public void Activate()
+        {
+            win = NUIApplication.GetDefaultWindow();
+            win.KeyEvent += OnKeyEvent;
+            win.BackgroundColor = Color.Green;
+
+            text = new TextLabel("Culled Test");
+            text.TextColor = Color.Blue;
+            text.PointSize = 12.0f;
+            text.BackgroundColor = Color.Yellow;
+            text.Size = new Size(200, 100, 0);
+            text.Position = new Position(100, 100, 0);
+            win.Add(text);
+
+            Animation animation = new Animation(6000);
+            animation.AnimateTo(text, "Position", new Position(2000, 1500, 0), 0, 3000);
+            animation.AnimateTo(text, "Position", new Position(100, 100, 0), 3000, 6000);
+            animation.Looping = true;
+            animation.Play();
+
+            textStatus = new TextLabel();
+            textStatus.PointSize = 12.0f;
+            textStatus.BackgroundColor = Color.Cyan;
+            textStatus.Size = new Size(200, 100, 0);
+            textStatus.Position = new Position(0, 0, 0);
+            win.Add(textStatus);
+
+            timer = new Timer(300);
+            timer.Tick += onTick;
+            timer.Start();
+            tlog.Debug(tag, $"timer start!");
+        }
+
+        private bool onTick(object o, Timer.TickEventArgs e) 
+        {
+            textStatus.Text = $"Culled={text.Culled}";
+            tlog.Debug(tag, $"text.Culled={text.Culled}");
+            return true;
+        }
+
+        public void Deactivate()
+        {
+            timer.Stop();
+            timer.Dispose();
+
+            text.Unparent();
+            textStatus.Unparent();
+            text.Dispose();
+            textStatus.Dispose();
+        }
+    }
+}