Share via


BitmapDecoder.Create Metoda

Definice

Vytvoří pomocí BitmapDecoder zadaných BitmapCreateOptions a BitmapCacheOption.

Přetížení

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

Vytvoří BitmapDecoder z a Stream pomocí zadaných BitmapCreateOptions a BitmapCacheOption.

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

Vytvoří BitmapDecoder z a Uri pomocí zadaných BitmapCreateOptions a BitmapCacheOption.

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

Vytvoří BitmapDecoder z a Uri pomocí zadaných BitmapCreateOptions, BitmapCacheOption a RequestCachePolicy.

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

Vytvoří BitmapDecoder z a Stream pomocí zadaných BitmapCreateOptions a BitmapCacheOption.

public:
 static System::Windows::Media::Imaging::BitmapDecoder ^ Create(System::IO::Stream ^ bitmapStream, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
public static System.Windows.Media.Imaging.BitmapDecoder Create (System.IO.Stream bitmapStream, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
static member Create : System.IO.Stream * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.BitmapDecoder
Public Shared Function Create (bitmapStream As Stream, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption) As BitmapDecoder

Parametry

bitmapStream
Stream

Datový proud souboru, který identifikuje bitmapu k dekódování.

createOptions
BitmapCreateOptions

Určuje BitmapCreateOptions pro tento dekodér.

cacheOption
BitmapCacheOption

Určuje BitmapCacheOption pro tento dekodér.

Návraty

A BitmapDecoder z a Stream pomocí zadaných BitmapCreateOptions a BitmapCacheOption.

Příklady

Následující příklad ukazuje, jak použít metodu Create k vytvoření dekodéru pro daný obrázek. První BitmapFrame z obrázku se používá jako zdroj Image ovládacího prvku.

Stream imageStream = new FileStream("sampleImages/waterlilies.jpg",
   FileMode.Open, FileAccess.Read, FileShare.Read);

BitmapDecoder streamBitmap = BitmapDecoder.Create(
   imageStream, BitmapCreateOptions.None,
   BitmapCacheOption.Default);

// Create an image element;
Image streamImage = new Image();
streamImage.Width = 200;
// Set image source using the first frame.
streamImage.Source = streamBitmap.Frames[0];
Dim imageStream As FileStream = New FileStream("sampleImages/waterlilies.jpg", FileMode.Open, FileAccess.Read, FileShare.Read)

Dim streamBitmap As BitmapDecoder = BitmapDecoder.Create(imageStream, BitmapCreateOptions.None, BitmapCacheOption.Default)

' Create an image element;
Dim streamImage As New Image()
streamImage.Width = 200
' Set image source using the first frame.
streamImage.Source = streamBitmap.Frames(0)

Poznámky

OnLoad Pokud chcete po vytvoření dekodéru zavřít bitmapStream dekodér, použijte možnost mezipaměti. Výchozí OnDemand možnost mezipaměti zachová přístup k datovému proudu, dokud není potřeba rastrový obrázek, a vyčištění je zpracováno uvolňováním paměti.

Viz také

Platí pro

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

Vytvoří BitmapDecoder z a Uri pomocí zadaných BitmapCreateOptions a BitmapCacheOption.

public:
 static System::Windows::Media::Imaging::BitmapDecoder ^ Create(Uri ^ bitmapUri, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
public static System.Windows.Media.Imaging.BitmapDecoder Create (Uri bitmapUri, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
static member Create : Uri * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.BitmapDecoder
Public Shared Function Create (bitmapUri As Uri, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption) As BitmapDecoder

Parametry

bitmapUri
Uri

Rastrový Uri obrázek, který se má dekódovat.

createOptions
BitmapCreateOptions

Určuje BitmapCreateOptions pro tento dekodér.

cacheOption
BitmapCacheOption

Určuje BitmapCacheOption pro tento dekodér.

Návraty

A BitmapDecoder z a Uri pomocí zadaných BitmapCreateOptions a BitmapCacheOption.

Výjimky

Hodnota bitmapUri je null.

Určuje bitmapUri ID třídy nepodporovaného typu formátu.

Příklady

Následující příklad ukazuje, jak použít metodu Create(Uri, BitmapCreateOptions, BitmapCacheOption) k vytvoření dekodéru pro daný obrázek. První BitmapFrame z obrázku se používá jako zdroj Image ovládacího prvku.

BitmapDecoder uriBitmap = BitmapDecoder.Create(
   new Uri("sampleImages/waterlilies.jpg", UriKind.Relative),
   BitmapCreateOptions.None,
   BitmapCacheOption.Default);

// Create an image element;
Image uriImage = new Image();
uriImage.Width = 200;
// Set image source.
uriImage.Source = uriBitmap.Frames[0];
Dim uriBitmap As BitmapDecoder = BitmapDecoder.Create(New Uri("sampleImages/waterlilies.jpg", UriKind.Relative), BitmapCreateOptions.None, BitmapCacheOption.Default)

' Create an image element;
Dim uriImage As New Image()
uriImage.Width = 200
' Set image source.
uriImage.Source = uriBitmap.Frames(0)

Viz také

Platí pro

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

public:
 static System::Windows::Media::Imaging::BitmapDecoder ^ Create(Uri ^ bitmapUri, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption, System::Net::Cache::RequestCachePolicy ^ uriCachePolicy);
public static System.Windows.Media.Imaging.BitmapDecoder Create (Uri bitmapUri, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption, System.Net.Cache.RequestCachePolicy uriCachePolicy);
static member Create : Uri * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption * System.Net.Cache.RequestCachePolicy -> System.Windows.Media.Imaging.BitmapDecoder
Public Shared Function Create (bitmapUri As Uri, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption, uriCachePolicy As RequestCachePolicy) As BitmapDecoder

Parametry

bitmapUri
Uri

Umístění rastrového obrázku, ze kterého BitmapDecoder je vytvořen.

createOptions
BitmapCreateOptions

Možnosti, které jsou použity k vytvoření tohoto BitmapDecoder.

cacheOption
BitmapCacheOption

Možnost mezipaměti, která se používá k vytvoření tohoto BitmapDecoder.

uriCachePolicy
RequestCachePolicy

Požadavky na ukládání do mezipaměti pro tento BitmapDecoder.

Návraty

A BitmapDecoder z a Uri pomocí zadaných BitmapCreateOptions, BitmapCacheOption a RequestCachePolicy.

Poznámky

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy) je zaveden v rozhraní .NET Framework verze 3.5.

Platí pro