UWP,如何处理图像和缩放? [英] UWP, how to handle images and scaling?

查看:194
本文介绍了UWP,如何处理图像和缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Xamarin Forms项目,该项目将在Android,iOS和UWP上运行.在Android上,您在不同的文件夹中有许多不同的图像,以支持iOS上的大量不同的屏幕(和PPI),而在iOS中,您具有类似的系统(@ 2x,@ 3x等).我一生无法找到如何为UWP实现类似的功能.当我在Windows平板电脑上以150%或200%的建议缩放比例运行该项目时,所有图像也会被放大,从而导致图像模糊.即使对于本机"(不使用Xamarin)UWP应用程序,我也找不到有关如何在UWP应用程序中处理图像的任何东西.

We have a Xamarin Forms project which shall run on Android, iOS and UWP. On Android you have a number of different images in different folder to support a vast number of different screens (and PPIs) on iOS you have a similar system (@2x, @3x etc.). I can't for the life of me find how to achive something similar for UWP. When I run the project on a Windows tablet with a recommended scaling of 150 % or 200 % all the images are also scaled up, which results in a blurry image. I can't find any thing on how to handle images in an UWP app, even for a "native" (not using Xamarin) UWP app.

推荐答案

通过在Assets文件夹中提供不同的缩放版本,可以在UWP本机中缩放图像.

Scaling images in UWP native is done by supplying different scaled versions in the Assets folder.

文件命名模式如下:****.scale-100.png****.scale-200.png 在您的应用中使用的实际文件名仍然是****.png,但是系统将自动检测并使用所需的缩放版本.

The file naming pattern is like so : ****.scale-100.png or ****.scale-200.png The actual file name to use in your app is still ****.png but the system will auto detect the needed scaled version and use that.

有关参考文档,请参见 https://docs.microsoft.com/en-us/windows/uwp/app-resources/images-tailored-for-scale-theme-contrast 和此处

For reference the doc on this is here https://docs.microsoft.com/en-us/windows/uwp/app-resources/images-tailored-for-scale-theme-contrast and here https://docs.microsoft.com/en-us/windows/uwp/app-resources/tailor-resources-lang-scale-contrast

建议比例因子为100、200和400.

Recommended scale factors are 100, 200 and 400.

这篇关于UWP,如何处理图像和缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆