Is there a way to convert a Windows.UI.Xaml.Media.Imaging.BitmapSource object into a member of a class that implements Microsoft.Graphics.Canvas.ICanvasImage? The interface itself consists of just two rectangle-getting methods. However, I assume that's not enough, as my ultimate goal is to call
CanvasDrawingSession.DrawImage()
which I have to imagine requires a way to get at the bitmap pixels.
You cannot get pixel from Windows.UI.Xaml.Media.Imaging.BitmapImage directly. But you can use a WriteableBitmap instead of a BitmapImage. Then you can get pixel data via its PixelBuffer property.
After that, you could use CanvasBitmap.CreateFromBytes()
method to create CanvasBitmap. Then using this CanvasBitmap object as parameter to call CanvasDrawingSession.DrawImage()
method.