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

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

適用於