Working alternative for PlatformImage for Maui.Graphics.IImage for Windows?
See original GitHub issueDescription
https://docs.microsoft.com/en-us/dotnet/maui/user-interface/graphics/images
This sample shows how to load and work with image. The docs are not fully cross-platform.
I need user to select an image and resize it on Windows. PlatformImage
is not available on Windows.
What is the suggested solution (working IImage
implementation) for Windows?
Moreover, the docs say this:
Image loading functionality is provided by the
GraphicsService
class. Images can be loaded from a stream by theLoadFromStream
method, or from a byte array using theLoadImageFromBytes
method.
I cannot find any of these mentioned classes or methods. Is that a leftover from previous Preview version?
Thank you
Steps to Reproduce
Try get an IImage
on Windows
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
all?
Did you find any workaround?
not sure because SkiaImage
isn’t finished
other possible alternatives (have to check):
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
I might be reading this wrong but I think for Windows, PlatformImage is W2DImage (https://github.com/dotnet/Microsoft.Maui.Graphics/blob/main/src/Microsoft.Maui.Graphics.Win2D.WinUI.Desktop/W2DImage.cs). And instead of using
PlatformImage
, you should useIImage
instead, since that’s the base image type for all of them.@mattleibow does that sound right? It does seem weird that there is no direct PlatformImage for Windows that I can see.
The Skia* things is an alternative implementation that works across all platforms. You can either draw using win2d or skia.