mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
ImageLoader
This commit is contained in:
parent
789fc98789
commit
07548efb93
4 changed files with 32 additions and 24 deletions
|
|
@ -26,7 +26,9 @@ namespace MapControl
|
|||
public static async Task<ImageSource> LoadImageAsync(IRandomAccessStream randomAccessStream)
|
||||
{
|
||||
var image = new BitmapImage();
|
||||
|
||||
await image.SetSourceAsync(randomAccessStream);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
|
@ -48,9 +50,9 @@ namespace MapControl
|
|||
{
|
||||
var file = await StorageFile.GetFileFromPathAsync(path);
|
||||
|
||||
using (var stream = await file.OpenReadAsync())
|
||||
using (var randomAccessStream = await file.OpenReadAsync())
|
||||
{
|
||||
image = await LoadImageAsync(stream);
|
||||
image = await LoadImageAsync(randomAccessStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +62,7 @@ namespace MapControl
|
|||
internal static async Task<WriteableBitmap> LoadWriteableBitmapAsync(BitmapDecoder decoder)
|
||||
{
|
||||
var image = new WriteableBitmap((int)decoder.PixelWidth, (int)decoder.PixelHeight);
|
||||
|
||||
var pixelData = await decoder.GetPixelDataAsync(
|
||||
BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied, new BitmapTransform(),
|
||||
ExifOrientationMode.IgnoreExifOrientation, ColorManagementMode.DoNotColorManage);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue