WmpBitmapDecoder Constructor (Uri, BitmapCreateOptions, BitmapCacheOption)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of WmpBitmapDecoder from the specified Uri with the specified createOptions and cacheOption.

Namespace:   System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)

[SecurityCriticalAttribute]
public WmpBitmapDecoder(
	Uri bitmapUri,
	BitmapCreateOptions createOptions,
	BitmapCacheOption cacheOption
)

Parameters

bitmapUri
Type: System.Uri

The Uri that identifies the bitmap to decode.

createOptions
Type: System.Windows.Media.Imaging.BitmapCreateOptions

Initialization options for the bitmap image.

cacheOption
Type: System.Windows.Media.Imaging.BitmapCacheOption

The caching method for the bitmap image.

Exception Condition
ArgumentNullException

The bitmapUri value is null.

FileFormatException

The bitmapUri is not a Windows Media Photo encoded image.

The following code example demonstrates how to create an instance of and use a WmpBitmapDecoder from a Uri. The decoded image is used as the source of an Image control.


// Open a Uri and decode a WDP image
Uri myUri = new Uri("tulipfarm.wdp", UriKind.RelativeOrAbsolute);
WmpBitmapDecoder decoder3 = new WmpBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource3 = decoder3.Frames[0];

// Draw the Image
Image myImage2 = new Image();
myImage2.Source = bitmapSource3;
myImage2.Stretch = Stretch.None;
myImage2.Margin = new Thickness(20);

.NET Framework
Available since 3.0
Return to top
Show: