在Windows Universal App的可视资产文件中,scale-240表示什么?

时间:2022-06-05 07:26:18

When I make a new Universal App in Visual Studio 2013 I get a number of graphics files for the logos, splash screens, etc. in the Assets folder, for example Square71x71Logo.scale-240.png. The Package.appxmanifest then maps these files to the various required things. For example Square71x71Logo.scale-240.png is mapped in Package.appxmanifest to Square 71x71 Logo.

当我在Visual Studio 2013中创建一个新的通用应用程序时,我在Assets文件夹中获得了徽标,启动画面等的许多图形文件,例如Square71x71Logo.scale-240.png。然后Package.appxmanifest将这些文件映射到各种所需的东西。例如,Square71x71Logo.scale-240.png在Package.appxmanifest中映射到Square 71x71徽标。

The actual file is 170 pixels wide, 170 pixels high, Photoshop reads it as having 72 pixels per inch, and it has an 8 bit colour depth.

实际文件宽170像素,高170像素,Photoshop将其读取为每英寸72像素,并且它具有8位颜色深度。

What does the .scale-240 part of the file name signify?

文件名的.scale-240部分表示什么?

在Windows Universal App的可视资产文件中,scale-240表示什么?

I'm replacing the file and I am not sure how to scale-240-ify the new image.

我正在更换文件,我不知道如何扩展240-ify新图像。

3 个解决方案

#1


7  

The scale-240 part of the file name is a resource qualifier that indicates that the file is used for 240% DPI systems.

文件名的scale-240部分是资源限定符,表示该文件用于240%DPI系统。

Resource qualifiers allow the app to provide different versions of the same resource for different scenarios and refer them all internally by the base name:

资源限定符允许应用程序为不同的方案提供相同资源的不同版本,并在内部通过基本名称引用它们:

  • Scaling for different DPI systems: .scale-100, .scale-140, .scale-180, .scale-240
  • 扩展不同的DPI系统:.scale-100,.scale-140,.scale-180,.scale-240
  • Language (if the image has text in it): .lang-de-DE, .lang-en-us
  • 语言(如果图像中包含文本):。lang-de-DE,.lang-en-us
  • Contrast (to simplify for high contrast modes): .contrast-high, .contrast-standard
  • 对比度(简化高对比度模式):.contrast-high,.contrast-standard
  • Layout direction (if the image should be different in LTR vs RTL language settings): .layoutdir-RTL, .layoutdir-LTR
  • 布局方向(如果图像在LTR与RTL语言设置中应该不同):. layoutout-RTL,.layoutdir-LTR
  • DirectX feature level: .DXFL-DX9, .DXFL-DX11
  • DirectX功能级别:.DXFL-DX9,.DXFL-DX11

The app can reference the image by its base name (e.g. logo.png) and the version which best matches the current scale, contrast level, language, etc. will be automatically used.

应用程序可以通过其基本名称(例如logo.png)引用图像,并且将自动使用与当前比例,对比度级别,语言等最匹配的版本。

The default phone template provides scale-240 images since high-DPI phones are fairly common and it is generally better to scale down from a larger image than to scale up a small image. Best would be for you to provide multiple resolutions when you replace the stock ones with your own, especially if your images are complicated and don't scale well by default.

默认手机模板提供了240级图像,因为高DPI手机相当普遍,通常从较大的图像缩小比放大小图像更好。当您用自己的库存替换库存时,最好是提供多种分辨率,特别是如果您的图像很复杂并且默认情况下不能很好地扩展。

See How to name resources using qualifiers (XAML)

请参见如何使用限定符命名资源(XAML)

#2


3  

Universal apps need to be able to run on very different screens. You cannot predict up front what kind of device the user might have. Big difference if he has a cheap contract phone, an expensive slate or a desktop machine. WinRT helps by automatically scaling your app to match the screen resolution.

通用应用程序需要能够在非常不同的屏幕上运行。您无法预先预测用户可能拥有的设备类型。如果他有一个便宜的合同电话,昂贵的平板电脑或台式机,差别很大。 WinRT可帮助您自动扩展应用以匹配屏幕分辨率。

Supported scaling percentages for a desktop/slate app are 80, 100, 140 or 180%. For a phone it is 100, 140 or 240%.

桌面/平板应用程序支持的缩放百分比为80%,100%,140%或180%。对于手机,它是100,140或240%。

Text can auto-scale easily but images do not. They get blurry when they get rescaled, a single pixel in the image no longer coincides with a single screen pixel. Pretty noticeable when the image contains fine line art or text. Scaling down necessarily loses pixels, details may disappear.

文本可以轻松自动缩放,但图像不能。当它们重新缩放时,它们变得模糊,图像中的单个像素不再与单个屏幕像素重合。当图像包含细线艺术或文本时非常明显。按比例缩小必然会丢失像素,细节可能会消失。

So the Visual Assets tab of the manifest editor allows you to select multiple images, each suitable for a specific scaling percentage. You found the -240 version in your phone project's Assets directory, the 240% scaling version that were auto-generated when you created the project. The desktop version has -100 assets by default, 100% scaling.

因此,清单编辑器的Visual Assets选项卡允许您选择多个图像,每个图像都适合特定的缩放百分比。您在手机项目的Assets目录中找到了-240版本,这是在创建项目时自动生成的240%缩放版本。桌面版本默认具有-100个资产,100%缩放。

You may want to add your own. You don't have to.

您可能想要添加自己的。你不必。

#3


2  

.scale-xxx appears to refer to pre-scaled image resources. If you are using a an image logo.png with size 100x100px then logo.scale-240.png should be an image of size 240x240px, i.e. scaled by a factor of 240 percent. The idea behind this concept is apparently to avoid potentially expensive and inaccurate rescaling by the displaying device, by supplying several prescaled images at defined scales.

.scale-xxx似乎是指预先缩放的图像资源。如果您使用尺寸为100x100px的图像logo.png,则logo.scale-240.png应该是尺寸为240x240px的图像,即按比例缩放240%。这个概念背后的想法显然是通过以规定的比例提供几个预分割图像来避免显示设备的潜在昂贵和不准确的重新缩放。

In your case: 170px / 2.40 = ~71px

在你的情况下:170px / 2.40 = ~71px

See also the corresponding MSDN article. (The linked article is in German, I will leave it to the interested reader to find the matching English one ;-)

另请参阅相应的MSDN文章。 (链接的文章是德语,我会留给有兴趣的读者找到匹配的英文;-)

#1


7  

The scale-240 part of the file name is a resource qualifier that indicates that the file is used for 240% DPI systems.

文件名的scale-240部分是资源限定符,表示该文件用于240%DPI系统。

Resource qualifiers allow the app to provide different versions of the same resource for different scenarios and refer them all internally by the base name:

资源限定符允许应用程序为不同的方案提供相同资源的不同版本,并在内部通过基本名称引用它们:

  • Scaling for different DPI systems: .scale-100, .scale-140, .scale-180, .scale-240
  • 扩展不同的DPI系统:.scale-100,.scale-140,.scale-180,.scale-240
  • Language (if the image has text in it): .lang-de-DE, .lang-en-us
  • 语言(如果图像中包含文本):。lang-de-DE,.lang-en-us
  • Contrast (to simplify for high contrast modes): .contrast-high, .contrast-standard
  • 对比度(简化高对比度模式):.contrast-high,.contrast-standard
  • Layout direction (if the image should be different in LTR vs RTL language settings): .layoutdir-RTL, .layoutdir-LTR
  • 布局方向(如果图像在LTR与RTL语言设置中应该不同):. layoutout-RTL,.layoutdir-LTR
  • DirectX feature level: .DXFL-DX9, .DXFL-DX11
  • DirectX功能级别:.DXFL-DX9,.DXFL-DX11

The app can reference the image by its base name (e.g. logo.png) and the version which best matches the current scale, contrast level, language, etc. will be automatically used.

应用程序可以通过其基本名称(例如logo.png)引用图像,并且将自动使用与当前比例,对比度级别,语言等最匹配的版本。

The default phone template provides scale-240 images since high-DPI phones are fairly common and it is generally better to scale down from a larger image than to scale up a small image. Best would be for you to provide multiple resolutions when you replace the stock ones with your own, especially if your images are complicated and don't scale well by default.

默认手机模板提供了240级图像,因为高DPI手机相当普遍,通常从较大的图像缩小比放大小图像更好。当您用自己的库存替换库存时,最好是提供多种分辨率,特别是如果您的图像很复杂并且默认情况下不能很好地扩展。

See How to name resources using qualifiers (XAML)

请参见如何使用限定符命名资源(XAML)

#2


3  

Universal apps need to be able to run on very different screens. You cannot predict up front what kind of device the user might have. Big difference if he has a cheap contract phone, an expensive slate or a desktop machine. WinRT helps by automatically scaling your app to match the screen resolution.

通用应用程序需要能够在非常不同的屏幕上运行。您无法预先预测用户可能拥有的设备类型。如果他有一个便宜的合同电话,昂贵的平板电脑或台式机,差别很大。 WinRT可帮助您自动扩展应用以匹配屏幕分辨率。

Supported scaling percentages for a desktop/slate app are 80, 100, 140 or 180%. For a phone it is 100, 140 or 240%.

桌面/平板应用程序支持的缩放百分比为80%,100%,140%或180%。对于手机,它是100,140或240%。

Text can auto-scale easily but images do not. They get blurry when they get rescaled, a single pixel in the image no longer coincides with a single screen pixel. Pretty noticeable when the image contains fine line art or text. Scaling down necessarily loses pixels, details may disappear.

文本可以轻松自动缩放,但图像不能。当它们重新缩放时,它们变得模糊,图像中的单个像素不再与单个屏幕像素重合。当图像包含细线艺术或文本时非常明显。按比例缩小必然会丢失像素,细节可能会消失。

So the Visual Assets tab of the manifest editor allows you to select multiple images, each suitable for a specific scaling percentage. You found the -240 version in your phone project's Assets directory, the 240% scaling version that were auto-generated when you created the project. The desktop version has -100 assets by default, 100% scaling.

因此,清单编辑器的Visual Assets选项卡允许您选择多个图像,每个图像都适合特定的缩放百分比。您在手机项目的Assets目录中找到了-240版本,这是在创建项目时自动生成的240%缩放版本。桌面版本默认具有-100个资产,100%缩放。

You may want to add your own. You don't have to.

您可能想要添加自己的。你不必。

#3


2  

.scale-xxx appears to refer to pre-scaled image resources. If you are using a an image logo.png with size 100x100px then logo.scale-240.png should be an image of size 240x240px, i.e. scaled by a factor of 240 percent. The idea behind this concept is apparently to avoid potentially expensive and inaccurate rescaling by the displaying device, by supplying several prescaled images at defined scales.

.scale-xxx似乎是指预先缩放的图像资源。如果您使用尺寸为100x100px的图像logo.png,则logo.scale-240.png应该是尺寸为240x240px的图像,即按比例缩放240%。这个概念背后的想法显然是通过以规定的比例提供几个预分割图像来避免显示设备的潜在昂贵和不准确的重新缩放。

In your case: 170px / 2.40 = ~71px

在你的情况下:170px / 2.40 = ~71px

See also the corresponding MSDN article. (The linked article is in German, I will leave it to the interested reader to find the matching English one ;-)

另请参阅相应的MSDN文章。 (链接的文章是德语,我会留给有兴趣的读者找到匹配的英文;-)