问题
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.
In UWP you can have different image sizes to handle different scaled screen sizes. Here are 3 different sized versions of the same image.
So my questions
- Is the 100 scale size is the image used when the Windows user has chosen no scaling of the screen (100%)?
- Are the 200 and 400 scale sizes for when the user tells Windows to make everything 2x or 4x bigger?
- What image size does Xamarin UWP choose when the Windows scale factor is 125, 250, or some other random factor that doesn't match up with any of the scale factors for the image?
回答1:
Is the 100 scale size is the image used when the Windows user has chosen no scaling of the screen (100%)?
I think it is, for scale factor, 100,200,400...
Are the 200 and 400 scale sizes for when the user tells Windows to make everything 2x or 4x bigger?
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
来源:https://stackoverflow.com/questions/56633408/uwp-image-scaling-with-xamarin-forms