티스토리 뷰
간단하게 이미지의 스케일을 변경한다. Bound와 Flip 등의 기능이 가능, 예제에서 찾아서 남김
private async void OnDeferredImageRequestedHandler(DataProviderRequest providerRequest, StorageFile imageFile)
{
// In this delegate we provide updated Bitmap data using delayed rendering.
if (imageFile != null)
{
// If the delegate is calling any asynchronous operations it needs to acquire the deferral first. This lets the
// system know that you are performing some operations that might take a little longer and that the call to
// SetData could happen after the delegate returns. Once you acquired the deferral object you must call Complete
// on it after your final call to SetData.
DataProviderDeferral deferral = providerRequest.GetDeferral();
InMemoryRandomAccessStream inMemoryStream = new InMemoryRandomAccessStream();
// Make sure to always call Complete when done with the deferral.
try
{
// Decode the image and re-encode it at 50% width and height.
IRandomAccessStream imageStream = await imageFile.OpenAsync(FileAccessMode.Read);
BitmapDecoder imageDecoder = await BitmapDecoder.CreateAsync(imageStream);
BitmapEncoder imageEncoder = await BitmapEncoder.CreateForTranscodingAsync(inMemoryStream, imageDecoder);
imageEncoder.BitmapTransform.ScaledWidth = (uint)(imageDecoder.OrientedPixelWidth * 0.5);
imageEncoder.BitmapTransform.ScaledHeight = (uint)(imageDecoder.OrientedPixelHeight * 0.5);
await imageEncoder.FlushAsync();
providerRequest.SetData(RandomAccessStreamReference.CreateFromStream(inMemoryStream));
}
finally
{
deferral.Complete();
}
}
}
'Previous Platforms > ETC' 카테고리의 다른 글
MTProto Mobile Protocol 번역 중 (2) | 2014.06.03 |
---|---|
Now FocusedElement, CurrentPage (0) | 2013.08.29 |
Custom ConfirmBox create (0) | 2013.08.21 |
patterns & practices: Prism for the Windows Runtime (0) | 2013.07.10 |
Microsoft .Net Framework 4.5 Quickstart Cookbook Review (0) | 2013.07.05 |
- Total
- Today
- Yesterday
- #prism
- ComboBox
- Visual Studio 2022
- WPF
- Build 2016
- dotNETconf
- uno-platform
- C#
- #uwp
- MVVM
- Cross-platform
- Bot Framework
- XAML
- visual studio 2019
- LINQ
- ef core
- Windows 10
- .net
- Microsoft
- uno platform
- Behavior
- PRISM
- Always Encrypted
- #Windows Template Studio
- UWP
- kiosk
- windows 11
- #MVVM
- .net 5.0
- IOT
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |