mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-20 22:05:07 +00:00
Update ImageLoader.WinUI.cs
This commit is contained in:
parent
f4a7c3fbdf
commit
2094facc5e
1 changed files with 12 additions and 13 deletions
|
|
@ -99,22 +99,21 @@ namespace MapControl
|
||||||
images[1] is WriteableBitmap image2 &&
|
images[1] is WriteableBitmap image2 &&
|
||||||
image1.PixelHeight == image2.PixelHeight)
|
image1.PixelHeight == image2.PixelHeight)
|
||||||
{
|
{
|
||||||
var width = image1.PixelWidth + image2.PixelWidth;
|
var buffer1 = image1.PixelBuffer;
|
||||||
var height = image2.PixelHeight;
|
var buffer2 = image2.PixelBuffer;
|
||||||
var stride1 = image1.PixelWidth * 4;
|
var stride1 = (uint)image1.PixelWidth * 4;
|
||||||
var stride2 = image2.PixelWidth * 4;
|
var stride2 = (uint)image2.PixelWidth * 4;
|
||||||
var buffer1 = image1.PixelBuffer.ToArray();
|
var stride = stride1 + stride2;
|
||||||
var buffer2 = image2.PixelBuffer.ToArray();
|
var height = image1.PixelHeight;
|
||||||
|
|
||||||
image = new WriteableBitmap(width, height);
|
image = new WriteableBitmap(image1.PixelWidth + image2.PixelWidth, height);
|
||||||
|
|
||||||
using (var pixelStream = image.PixelBuffer.AsStream())
|
var buffer = image.PixelBuffer;
|
||||||
|
|
||||||
|
for (uint y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
for (var y = 0; y < height; y++)
|
buffer1.CopyTo(y * stride1, buffer, y * stride, stride1);
|
||||||
{
|
buffer2.CopyTo(y * stride2, buffer, y * stride + stride1, stride2);
|
||||||
await pixelStream.WriteAsync(buffer1, y * stride1, stride1);
|
|
||||||
await pixelStream.WriteAsync(buffer2, y * stride2, stride2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue