提交 5991c93b 编写于 作者: E Elie Bariche

perf(WindowManager): Add RawPixelsToBase64EncodeImage binding

上级 5152ab27
......@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
using Windows.Foundation;
using Windows.Storage.Streams;
using Uno.Foundation;
using Uno.UI.Xaml;
using Uno.UI.Xaml.Media;
namespace Windows.UI.Xaml.Media.Imaging
......@@ -17,7 +18,7 @@ namespace Windows.UI.Xaml.Media.Imaging
try
{
var value = WebAssemblyRuntime.InvokeJS("Uno.UI.WindowManager.current.rawPixelsToBase64EncodeImage(" + pinnedData + ", " + PixelWidth + ", " + PixelHeight + ");");
var value = WindowManagerInterop.RawPixelsToBase64EncodeImage(pinnedData, PixelWidth, PixelHeight);
image = ImageData.FromDataUri(value);
......
......@@ -1180,6 +1180,14 @@ namespace Uno.UI.Xaml
}
#endregion
internal static string RawPixelsToBase64EncodeImage(IntPtr data, int width, int height)
=>
#if NET7_0_OR_GREATER
NativeMethods.RawPixelsToBase64EncodeImage(data, width, height);
#else
WebAssemblyRuntime.InvokeJS("Uno.UI.WindowManager.current.rawPixelsToBase64EncodeImage(" + data + ", " + width + ", " + height + ");");
#endif
internal static void SetRootElement(IntPtr htmlId)
{
#if NET7_0_OR_GREATER
......@@ -1259,6 +1267,9 @@ namespace Uno.UI.Xaml
[JSImport("globalThis.Uno.UI.WindowManager.current.measureViewNativeFast")]
internal static partial void MeasureView(IntPtr htmlId, double availableWidth, double availableHeight, bool measureContent, IntPtr pReturn);
[JSImport("globalThis.Uno.UI.WindowManager.current.rawPixelsToBase64EncodeImage")]
internal static partial string RawPixelsToBase64EncodeImage(IntPtr data, int width, int height);
[JSImport("globalThis.Uno.UI.WindowManager.current.releasePointerCapture")]
internal static partial void ReleasePointerCapture(IntPtr htmlId, double pointerId);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册