BitmapDecoder.Create メソッド

定義

指定したBitmapDecoderBitmapCreateOptionsを使用してBitmapCacheOptionを作成します。

オーバーロード

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

指定したBitmapDecoderStreamを使用して、BitmapCreateOptionsから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

パラメーター

bitmapStream
Stream

デコードするビットマップを識別するファイル ストリーム。

createOptions
BitmapCreateOptions

このデコーダーの BitmapCreateOptions を識別します。

cacheOption
BitmapCacheOption

このデコーダーの BitmapCacheOption を識別します。

返品

指定したBitmapDecoderStreamを使用したBitmapCreateOptionsからのBitmapCacheOption

次の例では、 Create メソッドを使用して、特定のイメージのデコーダーを作成する方法を示します。 イメージの最初の BitmapFrame は、 Image コントロールのソースとして使用されます。

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)

注釈

デコーダーの作成後にOnLoadを閉じる場合は、bitmapStream キャッシュ オプションを使用します。 既定の OnDemand キャッシュ オプションは、ビットマップが必要になるまでストリームへのアクセスを保持し、クリーンアップはガベージ コレクターによって処理されます。

こちらもご覧ください

適用対象

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

指定したBitmapDecoderUriを使用して、BitmapCreateOptionsから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

パラメーター

bitmapUri
Uri

デコードするビットマップの Uri

createOptions
BitmapCreateOptions

このデコーダーの BitmapCreateOptions を識別します。

cacheOption
BitmapCacheOption

このデコーダーの BitmapCacheOption を識別します。

返品

指定したBitmapDecoderUriを使用したBitmapCreateOptionsからのBitmapCacheOption

例外

bitmapUrinull です。

bitmapUriは、サポートされていない形式の型のクラス ID を指定します。

次の例では、 Create(Uri, BitmapCreateOptions, BitmapCacheOption) メソッドを使用して、特定のイメージのデコーダーを作成する方法を示します。 イメージの最初の BitmapFrame は、 Image コントロールのソースとして使用されます。

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)

こちらもご覧ください

適用対象

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

指定したBitmapDecoderUri、および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

パラメーター

bitmapUri
Uri

BitmapDecoderの作成元となるビットマップの場所。

createOptions
BitmapCreateOptions

この BitmapDecoderの作成に使用するオプション。

cacheOption
BitmapCacheOption

この BitmapDecoderの作成に使用されるキャッシュ オプション。

uriCachePolicy
RequestCachePolicy

この BitmapDecoderのキャッシュ要件。

返品

指定したBitmapDecoderUri、およびBitmapCreateOptionsを使用したBitmapCacheOptionからのRequestCachePolicy

注釈

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy) は、.NET Framework バージョン 3.5 で導入されています。

適用対象