Share via


BitmapFrame.Create メソッド

定義

指定された引数に基づいて、新しい BitmapFrame を作成します。

オーバーロード

Create(Stream)

指定されたサムネイル、 BitmapFrameStreamを作成します。

Create(Uri)

指定されたサムネイル、 BitmapFrameUriを作成します。

Create(BitmapSource)

指定されたサムネイル、 BitmapFrameBitmapSourceを作成します。

Create(Uri, RequestCachePolicy)

指定した BitmapFrame を使用して、指定した Uri から RequestCachePolicy を作成します。

Create(BitmapSource, BitmapSource)

指定したサムネイルを使用して、指定した BitmapFrame から新しい BitmapSource を作成します。

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

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

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

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

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

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

Create(BitmapSource, BitmapSource, BitmapMetadata, ReadOnlyCollection<ColorContext>)

指定したサムネイル、BitmapMetadata、および ColorContext を使用して、特定の BitmapSource から新しい BitmapFrame を作成します。

Create(Stream)

指定されたサムネイル、 BitmapFrameStreamを作成します。

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ Create(System::IO::Stream ^ bitmapStream);
public static System.Windows.Media.Imaging.BitmapFrame Create (System.IO.Stream bitmapStream);
static member Create : System.IO.Stream -> System.Windows.Media.Imaging.BitmapFrame
Public Shared Function Create (bitmapStream As Stream) As BitmapFrame

パラメーター

bitmapStream
Stream

Stream を構築する際に使用する BitmapFrame

戻り値

BitmapFrame

指定されたサムネイル、 BitmapFrameStreamを作成します。

注釈

フレームが bitmapStream 作成された後は、キャッシュ オプションが OnLoad 使用されている場合にのみ閉じることができます。 既定 OnDemand のキャッシュ オプションは、フレームが必要になるまでストリームを保持します。 このメソッドを Create(Stream, BitmapCreateOptions, BitmapCacheOption) 使用して、作成とキャッシュのオプションを指定します。

適用対象

Create(Uri)

指定されたサムネイル、 BitmapFrameUriを作成します。

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ Create(Uri ^ bitmapUri);
public static System.Windows.Media.Imaging.BitmapFrame Create (Uri bitmapUri);
static member Create : Uri -> System.Windows.Media.Imaging.BitmapFrame
Public Shared Function Create (bitmapUri As Uri) As BitmapFrame

パラメーター

bitmapUri
Uri

Uri のソースを識別する BitmapFrame

戻り値

BitmapFrame

指定されたサムネイル、 BitmapFrameUriを作成します。

次のコード例は、特定Uriのオブジェクトから作成BitmapFrameする方法を示しています。

int width = 128;
int height = width;
int stride = width/8;
byte[] pixels = new byte[height*stride];

// Try creating a new image with a custom palette.
List<System.Windows.Media.Color> colors = new List<System.Windows.Media.Color>();
colors.Add(System.Windows.Media.Colors.Red);
colors.Add(System.Windows.Media.Colors.Blue);
colors.Add(System.Windows.Media.Colors.Green);
BitmapPalette myPalette = new BitmapPalette(colors);

// Creates a new empty image with the pre-defined palette

BitmapSource image = BitmapSource.Create(
    width,
    height,
    96,
    96,
    PixelFormats.Indexed1,
    myPalette, 
    pixels, 
    stride);

FileStream stream = new FileStream("empty.tif", FileMode.Create);
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
encoder.Frames.Add(BitmapFrame.Create(image));
MessageBox.Show(myPalette.Colors.Count.ToString());
encoder.Save(stream);
Dim width As Integer = 128
Dim height As Integer = width
Dim stride As Integer = CType(width / 8, Integer)
Dim pixels(height * stride) As Byte

' Try creating a new image with a custom palette.
Dim colors As New List(Of System.Windows.Media.Color)()
colors.Add(System.Windows.Media.Colors.Red)
colors.Add(System.Windows.Media.Colors.Blue)
colors.Add(System.Windows.Media.Colors.Green)
Dim myPalette As New BitmapPalette(colors)

' Creates a new empty image with the pre-defined palette
Dim image As BitmapSource = System.Windows.Media.Imaging.BitmapSource.Create(width, height, 96, 96, PixelFormats.Indexed1, myPalette, pixels, stride)
Dim stream As New FileStream("empty.tif", FileMode.Create)
Dim encoder As New TiffBitmapEncoder()
Dim myTextBlock As New TextBlock()
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString()
encoder.Frames.Add(BitmapFrame.Create(image))
MessageBox.Show(myPalette.Colors.Count.ToString())
encoder.Save(stream)

適用対象

Create(BitmapSource)

指定されたサムネイル、 BitmapFrameBitmapSourceを作成します。

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ Create(System::Windows::Media::Imaging::BitmapSource ^ source);
public static System.Windows.Media.Imaging.BitmapFrame Create (System.Windows.Media.Imaging.BitmapSource source);
static member Create : System.Windows.Media.Imaging.BitmapSource -> System.Windows.Media.Imaging.BitmapFrame
Public Shared Function Create (source As BitmapSource) As BitmapFrame

パラメーター

source
BitmapSource

この BitmapFrame を構築するために使用する BitmapSource

戻り値

BitmapFrame

指定されたサムネイル、 BitmapFrameBitmapSourceを作成します。

適用対象

Create(Uri, RequestCachePolicy)

指定した BitmapFrame を使用して、指定した Uri から RequestCachePolicy を作成します。

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

パラメーター

bitmapUri
Uri

ビットマップの位置。ここから BitmapFrame が作成されます。

uriCachePolicy
RequestCachePolicy

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

戻り値

BitmapFrame

指定した BitmapFrame を使用した、特定の Uri からの RequestCachePolicy

注釈

Create(Uri, RequestCachePolicy)は、.NET Framework バージョン 3.5 で導入されています。 詳細については、「.NET Framework のバージョンおよび依存関係」を参照してください。

適用対象

Create(BitmapSource, BitmapSource)

指定したサムネイルを使用して、指定した BitmapFrame から新しい BitmapSource を作成します。

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ Create(System::Windows::Media::Imaging::BitmapSource ^ source, System::Windows::Media::Imaging::BitmapSource ^ thumbnail);
public static System.Windows.Media.Imaging.BitmapFrame Create (System.Windows.Media.Imaging.BitmapSource source, System.Windows.Media.Imaging.BitmapSource thumbnail);
static member Create : System.Windows.Media.Imaging.BitmapSource * System.Windows.Media.Imaging.BitmapSource -> System.Windows.Media.Imaging.BitmapFrame
Public Shared Function Create (source As BitmapSource, thumbnail As BitmapSource) As BitmapFrame

パラメーター

source
BitmapSource

BitmapFrame を構築する元となるソース。

thumbnail
BitmapSource

作成された BitmapFrame のサムネイル画像。

戻り値

BitmapFrame

指定したサムネイルを使用した、特定の BitmapFrame からの BitmapSource

適用対象

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

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

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ Create(System::IO::Stream ^ bitmapStream, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
public static System.Windows.Media.Imaging.BitmapFrame 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.BitmapFrame
Public Shared Function Create (bitmapStream As Stream, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption) As BitmapFrame

パラメーター

bitmapStream
Stream

この BitmapFrame を構築する元となるストリーム。

createOptions
BitmapCreateOptions

この BitmapFrame を作成する際に使用するオプション。

cacheOption
BitmapCacheOption

この BitmapFrame を作成する際に使用するキャッシュ オプション。

戻り値

BitmapFrame

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

注釈

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

適用対象

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

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

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ Create(Uri ^ bitmapUri, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
public static System.Windows.Media.Imaging.BitmapFrame 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.BitmapFrame
Public Shared Function Create (bitmapUri As Uri, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption) As BitmapFrame

パラメーター

bitmapUri
Uri

ビットマップの位置。ここから BitmapFrame が作成されます。

createOptions
BitmapCreateOptions

この BitmapFrame を作成する際に使用するオプション。

cacheOption
BitmapCacheOption

この BitmapFrame を作成する際に使用するキャッシュ オプション。

戻り値

BitmapFrame

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

適用対象

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

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

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ 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.BitmapFrame 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.BitmapFrame
Public Shared Function Create (bitmapUri As Uri, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption, uriCachePolicy As RequestCachePolicy) As BitmapFrame

パラメーター

bitmapUri
Uri

ビットマップの位置。ここから BitmapFrame が作成されます。

createOptions
BitmapCreateOptions

この BitmapFrame を作成する際に使用するオプション。

cacheOption
BitmapCacheOption

この BitmapFrame を作成する際に使用するキャッシュ オプション。

uriCachePolicy
RequestCachePolicy

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

戻り値

BitmapFrame

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

注釈

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)は、.NET Framework バージョン 3.5 で導入されています。 詳細については、「.NET Framework のバージョンおよび依存関係」を参照してください。

適用対象

Create(BitmapSource, BitmapSource, BitmapMetadata, ReadOnlyCollection<ColorContext>)

指定したサムネイル、BitmapMetadata、および ColorContext を使用して、特定の BitmapSource から新しい BitmapFrame を作成します。

public:
 static System::Windows::Media::Imaging::BitmapFrame ^ Create(System::Windows::Media::Imaging::BitmapSource ^ source, System::Windows::Media::Imaging::BitmapSource ^ thumbnail, System::Windows::Media::Imaging::BitmapMetadata ^ metadata, System::Collections::ObjectModel::ReadOnlyCollection<System::Windows::Media::ColorContext ^> ^ colorContexts);
public static System.Windows.Media.Imaging.BitmapFrame Create (System.Windows.Media.Imaging.BitmapSource source, System.Windows.Media.Imaging.BitmapSource thumbnail, System.Windows.Media.Imaging.BitmapMetadata metadata, System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Media.ColorContext> colorContexts);
static member Create : System.Windows.Media.Imaging.BitmapSource * System.Windows.Media.Imaging.BitmapSource * System.Windows.Media.Imaging.BitmapMetadata * System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Media.ColorContext> -> System.Windows.Media.Imaging.BitmapFrame
Public Shared Function Create (source As BitmapSource, thumbnail As BitmapSource, metadata As BitmapMetadata, colorContexts As ReadOnlyCollection(Of ColorContext)) As BitmapFrame

パラメーター

source
BitmapSource

この BitmapFrame を構築するために使用する BitmapSource

thumbnail
BitmapSource

作成された BitmapFrame のサムネイル画像。

metadata
BitmapMetadata

この BitmapFrame に関連付けるメタデータ。

colorContexts
ReadOnlyCollection<ColorContext>

この BitmapFrame に関連付ける ColorContext オブジェクト。

戻り値

BitmapFrame

指定されたサムネイル、BitmapMetadataColorContext を持つ所定の BitmapSource から作成される BitmapFrame

適用対象