[NUI.Scene3D] Support SceneView CornerRadius/Borderline Property applied
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 27 Sep 2024 08:41:39 +0000 (17:41 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Thu, 10 Oct 2024 10:57:23 +0000 (19:57 +0900)
Relative dali patch :

https://review.tizen.org/gerrit/c/platform/core/uifw/dali-toolkit/+/318377
https://review.tizen.org/gerrit/c/platform/core/uifw/dali-csharp-binder/+/318385

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.SceneView.cs
src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
src/Tizen.NUI/src/public/WebView/WebView.cs
test/Tizen.NUI.Scene3D.Sample/Scene3DSample.cs

index d844df74cf3c73c339223b16188bc61d924b0b7d..26ff877e7df0da3bbbc9002cb1e641e40fcbc181 100755 (executable)
@@ -126,6 +126,22 @@ namespace Tizen.NUI.Scene3D
 
             [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_CaptureFinishedSignal_Disconnect")]
             public static extern void CaptureFinishedDisconnect(global::System.Runtime.InteropServices.HandleRef actor, global::System.Runtime.InteropServices.HandleRef handler);
+
+            /// Property enum get
+            [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_Property_CornerRadius_get")]
+            public static extern int CornerRadiusGet();
+
+            [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_Property_CornerRadiusPolicy_get")]
+            public static extern int CornerRadiusPolicyGet();
+
+            [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_Property_BorderlineWidth_get")]
+            public static extern int BorderlineWidthGet();
+
+            [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_Property_BorderlineColor_get")]
+            public static extern int BorderlineColorGet();
+
+            [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_Property_BorderlineOffset_get")]
+            public static extern int BorderlineOffsetGet();
         }
     }
 }
index d7a72f20558454437deadd6e034efc6d12012f5b..ff99b138e9b938ec387d8f547cb400e2cece2ed2 100755 (executable)
@@ -834,6 +834,59 @@ namespace Tizen.NUI.Scene3D
             return ret;
         }
 
+        /// <summary>
+        /// Callback when CornerRadius property changed.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ApplyCornerRadius()
+        {
+            base.ApplyCornerRadius();
+
+            if (backgroundExtraData == null) return;
+
+            // Update corner radius properties to image by ActionUpdateProperty
+            if (backgroundExtraDataUpdatedFlag.HasFlag(BackgroundExtraDataUpdatedFlag.ContentsCornerRadius))
+            {
+                if (backgroundExtraData.CornerRadius != null)
+                {
+                    using var setValue = new Tizen.NUI.PropertyValue(backgroundExtraData.CornerRadius);
+                    SetProperty(Interop.SceneView.CornerRadiusGet(), setValue);
+                }
+                {
+                    using var setValue = new Tizen.NUI.PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
+                    SetProperty(Interop.SceneView.CornerRadiusPolicyGet(), setValue);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Callback when Borderline property changed.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ApplyBorderline()
+        {
+            base.ApplyBorderline();
+
+            if (backgroundExtraData == null) return;
+
+            // Update corner radius properties to image by ActionUpdateProperty
+            if (backgroundExtraDataUpdatedFlag.HasFlag(BackgroundExtraDataUpdatedFlag.ContentsBorderline))
+            {
+                {
+                    using var setValue = new Tizen.NUI.PropertyValue(backgroundExtraData.BorderlineWidth);
+                    SetProperty(Interop.SceneView.BorderlineWidthGet(), setValue);
+                }
+                {
+                    using var setValue = new Tizen.NUI.PropertyValue((backgroundExtraData.BorderlineColor ?? Color.Black));
+                    SetProperty(Interop.SceneView.BorderlineColorGet(), setValue);
+                }
+                {
+                    using var setValue = new Tizen.NUI.PropertyValue(backgroundExtraData.BorderlineOffset);
+                    SetProperty(Interop.SceneView.BorderlineOffsetGet(), setValue);
+                }
+            }
+        }
+
         /// <summary>
         /// Release swigCPtr.
         /// </summary>
index 8297bb9cf3a93a0b221d2c3a74cc775e53112c50..d68912f97bfd49bdc74f4280c296dd379b2b3ad3 100755 (executable)
@@ -1923,7 +1923,8 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        internal override void ApplyCornerRadius()
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ApplyCornerRadius()
         {
             base.ApplyCornerRadius();
 
@@ -1940,7 +1941,8 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        internal override void ApplyBorderline()
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ApplyBorderline()
         {
             base.ApplyBorderline();
 
index 8e1eb8a28f463dfabae3dd04cd93f828415096da..285490a0e2f0ca5483256db608be37381eaecbdb 100755 (executable)
@@ -1258,8 +1258,8 @@ namespace Tizen.NUI.BaseComponents
             backgroundExtraDataUpdatedFlag = BackgroundExtraDataUpdatedFlag.None;
         }
 
-        /// TODO open as a protected level
-        internal virtual void ApplyCornerRadius()
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void ApplyCornerRadius()
         {
             if (backgroundExtraData == null) return;
 
@@ -1282,8 +1282,8 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        /// TODO open as a protected level
-        internal virtual void ApplyBorderline()
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void ApplyBorderline()
         {
             if (backgroundExtraData == null) return;
 
index 12b5557724ed18dcf868dd93ef3e68135f439b0c..1035141c3c812952e1410710fa397e60729b8eb1 100755 (executable)
@@ -2982,8 +2982,8 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
-
-        internal override void ApplyCornerRadius()
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ApplyCornerRadius()
         {
             base.ApplyCornerRadius();
 
index 8edc3412fd09a95a41cfd6d32432595e6fbbac23..c06eb04fdc9f5043478e9067a46f862b3d9bcc0a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -30,6 +30,8 @@ class Scene3DSample : NUIApplication
     Window mWindow;
     Vector2 mWindowSize;
 
+    private float mSceneViewSizeRate = 0.95f; // The scene view size relation as window size.
+
     SceneView mSceneView;
     Model mModel;
     Animation mModelAnimation;
@@ -130,13 +132,16 @@ class Scene3DSample : NUIApplication
     {
         mSceneView = new SceneView()
         {
-            SizeWidth = mWindowSize.Width,
-            SizeHeight = mWindowSize.Height,
+            SizeWidth = mWindowSize.Width * mSceneViewSizeRate,
+            SizeHeight = mWindowSize.Height * mSceneViewSizeRate,
             PositionX = 0.0f,
             PositionY = 0.0f,
-            PivotPoint = PivotPoint.TopLeft,
-            ParentOrigin = ParentOrigin.TopLeft,
+            PivotPoint = PivotPoint.Center,
+            ParentOrigin = ParentOrigin.Center,
             PositionUsesPivotPoint = true,
+
+            UseFramebuffer = true,
+            BackgroundColor = Color.DarkOrchid,
         };
 
         mSceneView.CameraTransitionFinished += (o, e) =>
@@ -480,6 +485,18 @@ class Scene3DSample : NUIApplication
                     }
                     break;
                 }
+                case "c":
+                {
+                    if (mSceneView != null)
+                    {
+                        mSceneView.CornerRadius = new Vector4(40.0f, 40.0f, 40.0f, 40.0f);
+                        mSceneView.CornerRadiusPolicy = VisualTransformPolicyType.Absolute;
+                        mSceneView.BorderlineWidth = 20.0f;
+                        mSceneView.BorderlineColor = new Vector4(1.0f, 1.0f, 1.0f, 0.2f);
+                        mSceneView.BorderlineOffset = -1.0f;
+                    }
+                    break;
+                }
             }
 
             FullGC();
@@ -501,19 +518,24 @@ class Scene3DSample : NUIApplication
                     mModelAnimation.Play();
                 }
             }
+            if (mSceneView != null)
+            {
+                mSceneView.CornerRadius = Vector4.Zero;
+                mSceneView.BorderlineWidth = 0.0f;
+            }
         }
     }
 
     public void Activate()
     {
         mWindow = Window.Default;
-        mWindow.BackgroundColor = Color.DarkOrchid;
+        mWindow.BackgroundColor = Color.Blue;
         mWindowSize = mWindow.WindowSize;
 
         mWindow.Resized += (o, e) =>
         {
             mWindowSize = mWindow.WindowSize;
-            mSceneView.Size = new Size(mWindowSize);
+            mSceneView.Size = new Size(mWindowSize * mSceneViewSizeRate);
         };
 
         mWindow.KeyEvent += OnKeyEvent;