Microsoft.Maui.Graphics
Microsoft.Maui.Graphics copied to clipboard
How to load a image on the windows platform?
The PlatformImage type isn't supported on Windows. PlatformImage.FromStream(stream),it is unusable. I can't find any solution. Is there any other solution?
private void LoadImages()
{
IImage image = null;
#if WINDOWS
Assembly assembly = GetType().GetTypeInfo().Assembly;
var service = new Microsoft.Maui.Graphics.Win2D.W2DImageLoadingService();
using (Stream stream = assembly.GetManifestResourceStream("HappySokoban.Resources.Images.box.jpg"))
{
image = service.FromStream(stream, ImageFormat.Jpeg);
}
#else
Assembly assembly = GetType().GetTypeInfo().Assembly;
using (Stream stream = assembly.GetManifestResourceStream("HappySokoban.Resources.Images.box.jpg"))
{
image = PlatformImage.FromStream(stream);
}
#endif }
It also don't work with skiasharp drawbitmap on Platform-Windows.