BitmapDecoder.Create Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Erstellt eine BitmapDecoder mithilfe der angegebenen BitmapCreateOptions und BitmapCacheOption.
Überlädt
| Name | Beschreibung |
|---|---|
| Create(Stream, BitmapCreateOptions, BitmapCacheOption) |
Erstellt ein Aus BitmapDecoder einer Stream mithilfe der angegebenen BitmapCreateOptions und BitmapCacheOption. |
| Create(Uri, BitmapCreateOptions, BitmapCacheOption) |
Erstellt ein Aus BitmapDecoder einer Uri mithilfe der angegebenen BitmapCreateOptions und BitmapCacheOption. |
| Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy) |
Erstellt ein Aus BitmapDecoder einer Uri mithilfe des angegebenen BitmapCreateOptionsund BitmapCacheOptionRequestCachePolicy. |
Create(Stream, BitmapCreateOptions, BitmapCacheOption)
Erstellt ein Aus BitmapDecoder einer Stream mithilfe der angegebenen BitmapCreateOptions und 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
Parameter
- bitmapStream
- Stream
Der Dateidatenstrom, der die zu decodierende Bitmap identifiziert.
- createOptions
- BitmapCreateOptions
Gibt den BitmapCreateOptions für diesen Decoder an.
- cacheOption
- BitmapCacheOption
Gibt den BitmapCacheOption für diesen Decoder an.
Gibt zurück
A BitmapDecoder von a Stream mithilfe der angegebenen BitmapCreateOptions und BitmapCacheOption.
Beispiele
Im folgenden Beispiel wird veranschaulicht, wie die Methode zum Erstellen eines Decoders für ein bestimmtes Bild verwendet Create wird. Das erste BitmapFrame Bild wird als Quelle eines Image Steuerelements verwendet.
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)
Hinweise
Verwenden Sie die OnLoad Cacheoption, wenn Sie den bitmapStream Decoder schließen möchten, nachdem der Decoder erstellt wurde. Die Standardcacheoption OnDemand behält den Zugriff auf den Datenstrom bei, bis die Bitmap benötigt wird, und die Bereinigung wird vom Garbage Collector behandelt.
Weitere Informationen
Gilt für:
Create(Uri, BitmapCreateOptions, BitmapCacheOption)
Erstellt ein Aus BitmapDecoder einer Uri mithilfe der angegebenen BitmapCreateOptions und 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
Parameter
- createOptions
- BitmapCreateOptions
Gibt den BitmapCreateOptions für diesen Decoder an.
- cacheOption
- BitmapCacheOption
Gibt den BitmapCacheOption für diesen Decoder an.
Gibt zurück
A BitmapDecoder von a Uri mithilfe der angegebenen BitmapCreateOptions und BitmapCacheOption.
Ausnahmen
bitmapUri ist null.
Dies bitmapUri gibt eine Klassen-ID eines nicht unterstützten Formattyps an.
Beispiele
Im folgenden Beispiel wird veranschaulicht, wie die Methode zum Erstellen eines Decoders für ein bestimmtes Bild verwendet Create(Uri, BitmapCreateOptions, BitmapCacheOption) wird. Das erste BitmapFrame Bild wird als Quelle eines Image Steuerelements verwendet.
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)
Weitere Informationen
Gilt für:
Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)
Erstellt ein Aus BitmapDecoder einer Uri mithilfe des angegebenen BitmapCreateOptionsund BitmapCacheOptionRequestCachePolicy.
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
Parameter
- bitmapUri
- Uri
Der Speicherort der Bitmap, aus der die BitmapDecoder Datei erstellt wird.
- createOptions
- BitmapCreateOptions
Die Optionen, die zum Erstellen dieses BitmapDecoderVorgangs verwendet werden.
- cacheOption
- BitmapCacheOption
Die Cacheoption, die zum Erstellen dieses BitmapDecoderVorgangs verwendet wird.
- uriCachePolicy
- RequestCachePolicy
Die Zwischenspeicherungsanforderungen hierfür BitmapDecoder.
Gibt zurück
A BitmapDecoder von a Uri mithilfe des angegebenen BitmapCreateOptionsund BitmapCacheOptionRequestCachePolicy.
Hinweise
Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy) wird in der .NET Framework Version 3.5 eingeführt.