BitmapDecoder.Create Yöntem

Tanım

belirtilen BitmapDecoder ve BitmapCreateOptionskullanarak bir BitmapCacheOption oluşturur.

Aşırı Yüklemeler

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

belirtilen BitmapDecoder ve Streamkullanarak a'dan BitmapCreateOptions oluştururBitmapCacheOption.

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

Parametreler

bitmapStream
Stream

Kod çözme bit eşlemini tanımlayan dosya akışı.

createOptions
BitmapCreateOptions

Bu kod çözücü için öğesini BitmapCreateOptions tanımlar.

cacheOption
BitmapCacheOption

Bu kod çözücü için öğesini BitmapCacheOption tanımlar.

Döndürülenler

BitmapDecoder belirtilen Stream ve BitmapCreateOptionskullanarak a'danBitmapCacheOption.

Örnekler

Aşağıdaki örnekte, belirli bir görüntü için kod çözücü oluşturmak için yönteminin nasıl kullanılacağı Create gösterilmektedir. Görüntünün ilki BitmapFrame bir Image denetimin kaynağı olarak kullanılır.

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)

Açıklamalar

OnLoad Kod çözücü oluşturulduktan sonra öğesini kapatmak bitmapStream istiyorsanız önbellek seçeneğini kullanın. Varsayılan OnDemand önbellek seçeneği bit eşlem gerekli olana kadar akışa erişimi korur ve temizleme çöp toplayıcısı tarafından işlenir.

Ayrıca bkz.

Şunlara uygulanır

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

belirtilen BitmapDecoder ve Urikullanarak a'dan BitmapCreateOptions oluştururBitmapCacheOption.

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

Parametreler

bitmapUri
Uri

Kodunu Uri çözmek için bit eşlem.

createOptions
BitmapCreateOptions

Bu kod çözücü için öğesini BitmapCreateOptions tanımlar.

cacheOption
BitmapCacheOption

Bu kod çözücü için öğesini BitmapCacheOption tanımlar.

Döndürülenler

BitmapDecoder belirtilen Uri ve BitmapCreateOptionskullanarak a'danBitmapCacheOption.

Özel durumlar

bitmapUri şudur: null.

desteklenmeyen bitmapUri biçim türünün sınıf kimliğini belirtir.

Örnekler

Aşağıdaki örnekte, belirli bir görüntü için kod çözücü oluşturmak için yönteminin nasıl kullanılacağı Create(Uri, BitmapCreateOptions, BitmapCacheOption) gösterilmektedir. Görüntünün ilki BitmapFrame bir Image denetimin kaynağı olarak kullanılır.

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)

Ayrıca bkz.

Şunlara uygulanır

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

Parametreler

bitmapUri
Uri

bit eşleminin BitmapDecoder oluşturulduğu konum.

createOptions
BitmapCreateOptions

Bunu BitmapDecoderoluşturmak için kullanılan seçenekler.

cacheOption
BitmapCacheOption

Bunu BitmapDecoderoluşturmak için kullanılan önbellek seçeneği.

uriCachePolicy
RequestCachePolicy

Bu BitmapDecoderiçin önbelleğe alma gereksinimleri.

Döndürülenler

BitmapDecoder Belirtilen Urive BitmapCreateOptionsBitmapCacheOptionkullanarak a'danRequestCachePolicy.

Açıklamalar

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy), .NET Framework sürüm 3.5'te kullanıma sunulmuştur.

Şunlara uygulanır