[NUI] Add GetOriginalImageSize() considering rotation (#2667)
authortscholb <scholb.kim@samsung.com>
Wed, 24 Feb 2021 08:13:54 +0000 (17:13 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 25 Feb 2021 08:24:58 +0000 (17:24 +0900)
Co-authored-by: dongsug-song <35130733+dongsug-song@users.noreply.github.com>
src/Tizen.NUI/src/internal/Interop/Interop.ImageLoading.cs
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
src/Tizen.NUI/src/public/Images/ImageLoading.cs

index 52a6861..99a6ac7 100755 (executable)
@@ -39,7 +39,7 @@ namespace Tizen.NUI
             public static extern global::System.IntPtr GetClosestImageSize(string jarg1);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetOriginalImageSize")]
-            public static extern global::System.IntPtr GetOriginalImageSize(string jarg1);
+            public static extern global::System.IntPtr GetOriginalImageSize(string jarg1, bool jarg2);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_DownloadImageSynchronously__SWIG_0")]
             public static extern global::System.IntPtr DownloadImageSynchronously(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, bool jarg5);
index fdfc64a..5985c14 100755 (executable)
@@ -1244,7 +1244,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 if (_resourceUrl != null)
                 {
-                  Size2D imageSize = ImageLoading.GetOriginalImageSize(_resourceUrl);
+                  Size2D imageSize = ImageLoading.GetOriginalImageSize(_resourceUrl, true);
 
                   int adjustedDesiredWidth, adjustedDesiredHeight;
                   float aspectOfDesiredSize = (float)_desired_height / (float)_desired_width;
index a310ce6..f01b324 100755 (executable)
@@ -411,16 +411,17 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Get the size of an original image
+        /// Get the size of an original image consider rotation
         /// </summary>
         /// <param name="filename">The name of the image.</param>
+        /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
         /// <returns>Dimension of the original image.</returns>
-        /// <since_tizen> 5 </since_tizen>
-        /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
+        /// <since_tizen> 6 </since_tizen>
+        /// This will be released at Tizen.NET API Level 9. Therefore, currently this would be used as an in-house API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static Size2D GetOriginalImageSize(string filename)
+        public static Size2D GetOriginalImageSize(string filename, bool orientationCorrection = true)
         {
-            var val = new Uint16Pair(Interop.ImageLoading.GetOriginalImageSize(filename), true);
+            var val = new Uint16Pair(Interop.ImageLoading.GetOriginalImageSize(filename, orientationCorrection), true);
             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
             val.Dispose();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();