Share via


BitmapImage.DecodePixelType 屬性

定義

取得或設定值,決定解碼作業的 DecodePixelWidthDecodePixelHeight 值如何解譯。

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 可以設定為 LogicalPhysical。 預設值為 Physical。 如果未設定 DecodePixelType 或設定為 Physical,則會使用 DecodePixelWidthDecodePixelHeight 值來解碼影像,而解碼作業會直接使用這些值。 如果 DecodePixelType 設定為 Logical,則會使用 DecodePixelWidth 和代表邏輯圖元 的 DecodePixelHeight 值來解碼影像。 內部邏輯會根據裝置解析度資訊,以及邏輯和實體圖元在目標裝置上的分解方式,轉換解碼寬度和高度。

一旦轉譯影像,影像就會以邏輯圖元指定Image元素的寬度高度,但這些邏輯圖元會受到裝置解析度的影響。 針對代表影像檔來源的 BitmapImage 元素,預設會以實體圖元指定 DecodePixelWidthDecodePixelHeight 。 為解碼作業提供的實體圖元值會影響記憶體中建立的點陣圖大小。 藉由將 DecodePixelType 指定為 Logical,影像會使用預先納入邏輯解析的因數值來解碼,而且可能不會使用太多記憶體。 如需裝置解析度和影像來源的詳細資訊,請參閱 有效圖元和縮放比例

適用於