语言

BitmapImage.DecodePixelType 属性

定义

获取或设置一个值,该值确定解码操作如何解释 DecodePixelWidth 和 DecodePixelHeight 值。

public:
 property DecodePixelType DecodePixelType { DecodePixelType get(); void set(DecodePixelType value); };
DecodePixelType DecodePixelType();

void DecodePixelType(DecodePixelType value);
public DecodePixelType DecodePixelType { get; set; }
var decodePixelType = bitmapImage.decodePixelType;
bitmapImage.decodePixelType = decodePixelType;
Public Property DecodePixelType As DecodePixelType

属性值

枚举的值。 默认值为 Physical。

注解

DecodePixelType 可设置为 逻辑 或 物理类型。 默认值为 Physical。 如果未设置 DecodePixelType 或设置为 Physical,则使用表示物理像素的 DecodePixelWidth 和 DecodePixelHeight 值对图像进行解码,解码操作直接使用这些值。 如果 DecodePixelType 设置为 Logical,则使用 DecodePixelWidth 和表示逻辑像素 的 DecodePixelHeight 值对图像进行解码。 内部逻辑根据设备分辨率信息转换解码宽度和高度,以及如何在目标设备上考虑逻辑和物理像素。

图像元素的宽度和高度在呈现图像后以逻辑像素形式指定,但这些逻辑像素受设备分辨率的影响。 对于表示图像文件源的 BitmapImage 元素,默认情况下, DecodePixelWidth 和 DecodePixelHeight 以物理像素指定。 为解码操作提供的物理像素值会影响内存中创建的位图的大小。 通过将 DecodePixelType 指定为 逻辑逻辑,将使用预先分解为逻辑解析的值对图像进行解码,并且它可能不会使用太多内存。 有关设备分辨率和图像源的详细信息,请参阅 有效像素和缩放。

适用于