本文整理匯總了C#中Windows.UI.Xaml.Media.Imaging.WriteableBitmap.RotateFree方法的典型用法代碼示例。如果您正苦於以下問題:C# WriteableBitmap.RotateFree方法的具體用法?C# WriteableBitmap.RotateFree怎麽用?C# WriteableBitmap.RotateFree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.Xaml.Media.Imaging.WriteableBitmap
的用法示例。
在下文中一共展示了WriteableBitmap.RotateFree方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ShowVehicleLocations
private async Task ShowVehicleLocations()
{
var vehicleLocations = await searchVm.GetBusLocations();
while (vehicleCounter > 0)
{
SearchMap.MapElements.RemoveAt(SearchMap.MapElements.Count - 1);
vehicleCounter--;
}
var inboundBM = new WriteableBitmap(40, 40);
await inboundBM.SetSourceAsync(await RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Inbound.png")).OpenReadAsync());
var outboundBM = new WriteableBitmap(40, 40);
await outboundBM.SetSourceAsync(await RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Outbound.png")).OpenReadAsync());
foreach (Bus bus in vehicleLocations)
{
if (bus.direction.Equals("inbound"))
{
var rotatedImage = inboundBM.RotateFree(bus.busHeading, false);
var stream = new InMemoryRandomAccessStream();
await rotatedImage.ToStream(stream, BitmapEncoder.PngEncoderId);
var busMarker = new MapIcon
{
Image = RandomAccessStreamReference.CreateFromStream(stream),
CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible,
Location = new Geopoint(new BasicGeoposition { Latitude = bus.latitude, Longitude = bus.longitude }),
NormalizedAnchorPoint = new Point(0.5, 0.5),
ZIndex = 99
};
SearchMap.MapElements.Add(busMarker);
await stream.FlushAsync();
stream.Dispose();
rotatedImage = null;
}
else if (bus.direction.Equals("outbound"))
{
var rotatedImage = outboundBM.RotateFree(bus.busHeading, false);
var stream = new InMemoryRandomAccessStream();
await rotatedImage.ToStream(stream, BitmapEncoder.PngEncoderId);
var busMarker = new MapIcon
{
Image = RandomAccessStreamReference.CreateFromStream(stream),
CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible,
Location = new Geopoint(new BasicGeoposition { Latitude = bus.latitude, Longitude = bus.longitude }),
NormalizedAnchorPoint = new Point(0.5, 0.5),
ZIndex = 99
};
SearchMap.MapElements.Add(busMarker);
await stream.FlushAsync();
stream.Dispose();
rotatedImage = null;
}
vehicleCounter++;
}
inboundBM = null;
outboundBM = null;
}