WinUI: use WriteableBitmap instead of BitmapImage or SoftwareBitmapSource

This commit is contained in:
ClemensFischer 2023-08-17 23:29:41 +02:00
parent d2fc65f133
commit ff6f6b63ea
2 changed files with 30 additions and 107 deletions

View file

@ -6,11 +6,6 @@ using System;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
using Windows.Storage;
#if WINUI
using Microsoft.UI.Xaml.Media.Imaging;
#else
using Windows.UI.Xaml.Media.Imaging;
#endif
namespace MapControl
{
@ -22,17 +17,11 @@ namespace MapControl
using (var stream = await file.OpenReadAsync())
{
WriteableBitmap bitmap;
Matrix transform;
MapProjection projection = null;
var decoder = await BitmapDecoder.CreateAsync(stream);
using (var swbmp = await decoder.GetSoftwareBitmapAsync())
{
bitmap = new WriteableBitmap(swbmp.PixelWidth, swbmp.PixelHeight);
swbmp.CopyToBuffer(bitmap.PixelBuffer);
}
var bitmap = await ImageLoader.LoadImageAsync(decoder);
var geoKeyDirectoryQuery = QueryString(GeoKeyDirectoryTag);
var pixelScaleQuery = QueryString(ModelPixelScaleTag);