Udostępnij za pośrednictwem


BitmapImage.DecodePixelType Property

Definition

Gets or sets a value that determines how DecodePixelWidth and DecodePixelHeight values are interpreted for decoding operations.

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

Property Value

A value of the enumeration. The default is Physical.

Remarks

DecodePixelType can be set to Logical or Physical. The default value is Physical. If DecodePixelType is not set, or set to Physical, the image is decoded using DecodePixelWidth and DecodePixelHeight values that represent physical pixels, and the decode operation uses these values directly. If DecodePixelType is set to Logical, the image is decoded using DecodePixelWidth and DecodePixelHeight values that represent logical pixels. Internal logic converts the decode width and height based on device resolution info and how logical and physical pixels are factored on the target device.

Width and Height for the Image element are specified in logical pixels once the image is rendered, but those logical pixels are influenced by the device resolution. For the BitmapImage element that represents the image file source, DecodePixelWidth and DecodePixelHeight are specified in physical pixels, by default. The physical pixel values for provided for the decode operation influences the size of the bitmap that's created in memory. By specifying DecodePixelType as Logical, the image is decoded using values that are pre-factored for the logical resolution, and it potentially won't use as much memory. For more info on device resolution and image sources, see Effective pixels and scaling.

Applies to