Hi I'm having a problem with Windows Phone 8.1 Universal app. I have to create a WriteableBitmap from an image i have on the phone. I have my uri
Uri uri = new Uri("ms-appx;/Images/imageName.png");
but i honestly don't know how to use it to create a WriteableBitmap. I found a lot of solutions but they all use
WriteableBitmap wb = new WriteableBitmap(bitmapImageName);
This code is not working on Windows Phone 8.1, the only constructor avaiable is
WriteableBitmap wb = new WriteableBitmap(pixelHeight, pixelWidth);
bit i honestly don't know what to do.
Any help will be appreciated
Thanks all
var uri = new Uri("ms-appx:///Images/imageName.png");
var storageFile = await StorageFile.GetFileFromApplicationUriAsync(uri);
var writeableBitmap = new WriteableBitmap(pixelHeight, pixelWidth);
using (var stream = await storageFile.OpenReadAsync())
{
await writeableBitmap.SetSourceAsync(stream);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.