[NUI] Add GetCapturedBuffer api for Capture
authorSeungho Baek <sbsh.baek@samsung.com>
Wed, 26 May 2021 13:49:25 +0000 (22:49 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 1 Jun 2021 08:03:31 +0000 (17:03 +0900)
Signed-off-by: Seungho Baek <sbsh.baek@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.Capture.cs
src/Tizen.NUI/src/public/Utility/Capture.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CaptureTest.cs

index a9cd2e7..e11d191 100755 (executable)
@@ -87,6 +87,9 @@ namespace Tizen.NUI
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Capture_GenerateUrl")]
             public static extern string GenerateUrl(HandleRef capture);
 
+            [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Capture_GetCapturedBuffer")]
+            public static extern IntPtr GetCapturedBuffer(HandleRef capture);
+
         }
     }
 }
index 5ecbc98..f944196 100755 (executable)
@@ -333,6 +333,16 @@ namespace Tizen.NUI
             Tizen.Log.Debug("NUI", $"GetNativeImageSource()");
             return new NativeImageSource(Interop.Capture.GetNativeImageSourcePtr(SwigCPtr), true);
         }
+
+        /// <summary>
+        /// Get Captured buffer.
+        /// </summary>
+        /// <returns>PixelBuffer of captured buffer</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public PixelBuffer GetCapturedBuffer()
+        {
+            return new PixelBuffer(Interop.Capture.GetCapturedBuffer(SwigCPtr), true);
+        }
     }
 
     /// <summary>
index 5ca6d03..b06d104 100755 (executable)
@@ -58,7 +58,9 @@ namespace Tizen.NUI.Samples
             if (sender is Capture)
             {
                 log.Debug(tag, $"sender is Capture \n");
-                var url = capture.GetNativeImageSource().Url;
+                PixelBuffer pixelBuffer = capture.GetCapturedBuffer();
+                PixelData pixelData = PixelBuffer.Convert(pixelBuffer);
+                var url = pixelData.Url;//capture.GetNativeImageSource().Url;
                 capturedImage = new ImageView(url);
                 log.Debug(tag, $"url={url} \n");