BitmapDecoder.Create メソッド

定義

指定した BitmapDecoder および BitmapCreateOptions を使用して BitmapCacheOption を作成します。

オーバーロード

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

指定した BitmapDecoder および Stream を使用して、BitmapCreateOptions から BitmapCacheOption を作成します。

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

指定した BitmapDecoder および Uri を使用して、BitmapCreateOptions から BitmapCacheOption を作成します。

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

指定した BitmapDecoderUri、および BitmapCreateOptions を使用して、BitmapCacheOption から RequestCachePolicy を作成します。

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

指定した BitmapDecoder および Stream を使用して、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 を識別します。

戻り値

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

次の例では、 メソッドを使用して、特定の Create イメージのデコーダーを作成する方法を示します。 イメージの 1 つ目 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)

指定した BitmapDecoder および Uri を使用して、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 を識別します。

戻り値

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

例外

bitmapUrinull です。

bitmapUri に、サポートされていない形式の種類のクラス ID が指定されます。

次の例では、 メソッドを使用して、特定の Create(Uri, BitmapCreateOptions, BitmapCacheOption) イメージのデコーダーを作成する方法を示します。 イメージの 1 つ目 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 で導入されています。

適用対象