使用 Xamarin Forms 缩放 UWP 图像 [英] UWP image scaling with Xamarin Forms

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

问题描述

我正在使用 Xamarin Forms 创建 iOS、Android、UWP 应用.我精通 iOS 和 Android 平台如何处理图像缩放(1x、2x、3x 等).但是,我对 UWP 不太熟悉.

I am creating a iOS, Android, UWP app with Xamarin Forms. I am well versed in how the iOS and Android platforms handle image scaling (1x, 2x, 3x, etc). However, I am not so familiar with UWP.

在 UWP 中,您可以使用不同的图像尺寸来处理不同的缩放屏幕尺寸.这是同一图像的 3 个不同大小的版本.

In UWP you can have different image sizes to handle different scaled screen sizes. Here are 3 different sized versions of the same image.

我的问题

  1. 当 Windows 用户选择不缩放屏幕 (100%) 时使用的图像是 100 缩放大小吗?
  2. 当用户告诉 Windows 将所有东西放大 2 倍或 4 倍时,200 和 400 的比例是多少?
  3. 当 Windows 比例因子为 125、250 或其他一些与图像的任何比例因子都不匹配的随机因子时,Xamarin UWP 选择什么图像大小?

推荐答案

Windows 用户选择不缩放屏幕 (100%) 时使用的图像是 100 缩放大小吗?

Is the 100 scale size is the image used when the Windows user has chosen no scaling of the screen (100%)?

对于比例因子,我认为是 100,200,400...

I think it is, for scale factor, 100,200,400...

当用户告诉 Windows 将所有东西放大 2 倍或 4 倍时,200 和 400 的比例是多少?

Are the 200 and 400 scale sizes for when the user tells Windows to make everything 2x or 4x bigger?

Windows 会根据每个显示器的 DPI(每英寸点数)和设备的观看距离自动为每个显示器选择一个比例因子.您应该创建多个推荐尺寸(至少 100、200 和 400)的图像,以便 Windows 可以选择完美的尺寸或使用最接近的尺寸并对其进行缩放.为了让 Windows 能够识别哪个物理文件包含显示比例因子的正确图像大小,您可以使用比例限定符.

Windows automatically selects a scale factor for each display based on its DPI (dots-per-inch) and the viewing distance of the device. You should create your images at several recommended sizes (at least 100, 200, and 400) so that Windows can either choose the perfect size or can use the nearest size and scale it. So that Windows can identify which physical file contains the correct size of image for the display scale factor, you use a scale qualifier.

我发现有两篇文章你可以看看:

I find there are two articles that you can take a look:

https://docs.microsoft.com/en-us/windows/uwp/app-resources/images-tailored-for-scale-theme-contrast

https://docs.microsoft.com/en-us/windows/uwp/app-resources/tailor-resources-lang-scale-contrast

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

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