mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-07 07:25:21 +00:00
Updated MapsforgeTiles projects
This commit is contained in:
parent
105e812afa
commit
a9f0ccc78b
13 changed files with 196 additions and 138 deletions
30
MapsforgeTiles/WinUI/MapsforgeTileSource.WinUI.cs
Normal file
30
MapsforgeTiles/WinUI/MapsforgeTileSource.WinUI.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
#if UWP
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
#elif WINUI
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
#endif
|
||||
|
||||
namespace MapControl.MapsforgeTiles
|
||||
{
|
||||
public partial class MapsforgeTileSource
|
||||
{
|
||||
private static WriteableBitmap CreateImage(int[] pixels)
|
||||
{
|
||||
var size = (int)Math.Sqrt(pixels.Length);
|
||||
var bitmap = new WriteableBitmap(size, size);
|
||||
|
||||
using var stream = bitmap.PixelBuffer.AsStream();
|
||||
using var writer = new BinaryWriter(stream);
|
||||
|
||||
foreach (var pixel in pixels)
|
||||
{
|
||||
writer.Write(pixel);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue