[NUI]CanvasView: Add BoundingBox property (#2995)
authorJunsuChoi <jsuya.choi@samsung.com>
Tue, 25 May 2021 07:59:12 +0000 (16:59 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 26 May 2021 01:00:09 +0000 (10:00 +0900)
Add BoundingBox property that uses Dali::CanvasRenderer::Drawable::GetBoundingBox api.

+)The float type Rectangle class is not ready yet.
Therefore, it transmits data in Vector4 class.
This type should later be changed to the appropriate data type.

src/Tizen.NUI/src/internal/Interop/Interop.Drawable.cs
src/Tizen.NUI/src/public/BaseComponents/VectorGraphics/Drawable.cs

index 5c45dd74447bf481770b19594112c7f55ebeb5fc..89105c1537e21333d195edca470d8f8dd08ca343 100755 (executable)
@@ -38,6 +38,9 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_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);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_GetBoundingBox")]
+            public static extern global::System.IntPtr GetBoundingBox(global::System.Runtime.InteropServices.HandleRef jarg1);
         }
     }
 }
index fcb537f6b64e602d54b5a0478d912b271d9b6962..f59a5104006df4741fac1779691fd0924a27b32e 100755 (executable)
@@ -52,6 +52,38 @@ namespace Tizen.NUI.BaseComponents.VectorGraphics
             }
         }
 
+        /// <summary>
+        /// The bounding box of the drawable object to which no transformation has been applied.
+        /// </summary>
+        /// <remarks>
+        /// The bounding box doesn't indicate the rendering region in the result but primitive region of the object.
+        /// </remarks>
+        /// <remarks>
+        /// The float type Rectangle class is not ready yet.
+        /// Therefore, it transmits data in Vector4 class.
+        /// This type should later be changed to the appropriate data type.
+        /// </remarks>
+        /// <code>
+        ///  Shape shape = new Shape()
+        ///  {      
+        ///      FillColor = new Color(1.0f, 0.0f, 0.0f, 1.0f)
+        ///  };
+        ///  shape.AddRect(0.0f, 0.0f, 100.0f, 100.0f, 0.0f, 0.0f);
+        ///  float boundingBoxX = shape.BoundingBox[0];      // boundingBoxX will be 0.
+        ///  float boundingBoxY = shape.BoundingBox[1];      // boundingBoxY will be 0.
+        ///  float boundingBoxWidth = shape.BoundingBox[2];  // boundingBoxWidth will be 100.
+        ///  float boundingBoxHeight = shape.BoundingBox[3]; // boundingBoxHeight will be 100.
+        /// </code>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Vector4 BoundingBox
+        {
+            get
+            {
+                global::System.IntPtr cPtr = Interop.Drawable.GetBoundingBox(BaseHandle.getCPtr(this));
+                return Vector4.GetVector4FromPtr(cPtr);
+            }
+        }
+
         /// <summary>
         /// Set the angle of rotation transformation.
         /// </summary>