BitmapFrame.Create Methode

Definition

Erstellt eine neue BitmapFrame basierend auf den angegebenen Argumenten.

Überlädt

Name Beschreibung
Create(Stream)

Erstellt ein neues BitmapFrame aus einem gegebenen Stream.

Create(Uri)

Erstellt ein neues BitmapFrame aus einem gegebenen Uri.

Create(BitmapSource)

Erstellt ein neues BitmapFrame aus einem gegebenen BitmapSource.

Create(Uri, RequestCachePolicy)

Erstellt eine BitmapFrame aus einem gegebenen Uri Mit dem angegebenen RequestCachePolicy.

Create(BitmapSource, BitmapSource)

Erstellt ein neues BitmapFrame aus einer gegebenen Ansicht BitmapSource mit der angegebenen Miniaturansicht.

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

Erstellt ein neues BitmapFrame aus einem gegebenen Stream Mit dem angegebenen BitmapCreateOptions und BitmapCacheOption.

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

Erstellt eine BitmapFrame aus einem gegebenen Uri Mit dem angegebenen BitmapCreateOptions und BitmapCacheOption.

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

Erstellt eine BitmapFrame aus einem gegebenen Uri Mit dem angegebenen BitmapCreateOptions, BitmapCacheOptionund RequestCachePolicy.

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

Erstellt ein neues BitmapFrame aus einer gegebenen Ansicht BitmapSource mit der angegebenen Miniaturansicht, BitmapMetadataund ColorContext.

Create(Stream)

Erstellt ein neues BitmapFrame aus einem gegebenen Stream.

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

Parameter

bitmapStream
Stream

Das Stream wird zum Konstruieren der BitmapFrame.

Gibt zurück

A BitmapFrame von einem gegebenen Stream.

Hinweise

Dies bitmapStream kann geschlossen werden, nachdem der Frame erstellt wurde, wenn die OnLoad Cacheoption verwendet wird. Die Standardcacheoption OnDemand behält den Datenstrom bei, bis der Frame benötigt wird. Verwenden Sie die Create(Stream, BitmapCreateOptions, BitmapCacheOption) Methode, um Erstellungs- und Cacheoptionen anzugeben.

Gilt für:

Create(Uri)

Erstellt ein neues BitmapFrame aus einem gegebenen Uri.

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

Parameter

bitmapUri
Uri

Der Uri die Quelle der .BitmapFrame

Gibt zurück

A BitmapFrame von einem gegebenen Uri.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie ein BitmapFrame Aus einem bestimmten Beispiel Urierstellt wird.

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)

Gilt für:

Create(BitmapSource)

Erstellt ein neues BitmapFrame aus einem gegebenen BitmapSource.

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

Parameter

source
BitmapSource

Das BitmapSource wird verwendet, um dies BitmapFramezu konstruieren.

Gibt zurück

A BitmapFrame von einem gegebenen BitmapSource.

Gilt für:

Create(Uri, RequestCachePolicy)

Erstellt eine BitmapFrame aus einem gegebenen Uri Mit dem angegebenen 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

Parameter

bitmapUri
Uri

Der Speicherort der Bitmap, aus der die BitmapFrame Datei erstellt wird.

uriCachePolicy
RequestCachePolicy

Die Zwischenspeicherungsanforderungen hierfür BitmapFrame.

Gibt zurück

A BitmapFrame aus einem gegebenen Uri Mit dem angegebenen RequestCachePolicy.

Hinweise

Create(Uri, RequestCachePolicy) wird in der .NET Framework Version 3.5 eingeführt. Weitere Informationen finden Sie unter "Versionen und Abhängigkeiten".

Gilt für:

Create(BitmapSource, BitmapSource)

Erstellt ein neues BitmapFrame aus einer gegebenen Ansicht BitmapSource mit der angegebenen Miniaturansicht.

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

Parameter

source
BitmapSource

Die Quelle, aus der die BitmapFrame Konstruktion erstellt wird.

thumbnail
BitmapSource

Eine Miniaturansicht des resultierenden BitmapFrame.

Gibt zurück

A BitmapFrame aus einer gegebenen Mit BitmapSource der angegebenen Miniaturansicht.

Gilt für:

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

Erstellt ein neues BitmapFrame aus einem gegebenen Stream Mit dem angegebenen BitmapCreateOptions und 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

Parameter

bitmapStream
Stream

Der Strom, aus dem dies BitmapFrame konstruiert wird.

createOptions
BitmapCreateOptions

Die Optionen, die zum Erstellen dieses BitmapFrameVorgangs verwendet werden.

cacheOption
BitmapCacheOption

Die Cacheoption, die zum Erstellen dieses BitmapFrameVorgangs verwendet wird.

Gibt zurück

A BitmapFrame von einem gegebenen Stream mit dem angegebenen BitmapCreateOptions und BitmapCacheOption.

Hinweise

Verwenden Sie die OnLoad Cacheoption, wenn Sie die bitmapStream Bitmap schließen möchten, nachdem die Bitmap 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.

Gilt für:

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

Erstellt eine BitmapFrame aus einem gegebenen Uri Mit dem angegebenen BitmapCreateOptions und 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

Parameter

bitmapUri
Uri

Der Speicherort der Bitmap, aus der die BitmapFrame Datei erstellt wird.

createOptions
BitmapCreateOptions

Die Optionen, die zum Erstellen dieses BitmapFrameVorgangs verwendet werden.

cacheOption
BitmapCacheOption

Die Cacheoption, die zum Erstellen dieses BitmapFrameVorgangs verwendet wird.

Gibt zurück

A BitmapFrame aus einer gegebenen Mit Uri dem angegebenen BitmapCreateOptionsund BitmapCacheOption.

Gilt für:

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

Erstellt eine BitmapFrame aus einem gegebenen Uri Mit dem angegebenen BitmapCreateOptions, BitmapCacheOptionund 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

Parameter

bitmapUri
Uri

Der Speicherort der Bitmap, aus der die BitmapFrame Datei erstellt wird.

createOptions
BitmapCreateOptions

Die Optionen, die zum Erstellen dieses BitmapFrameVorgangs verwendet werden.

cacheOption
BitmapCacheOption

Die Cacheoption, die zum Erstellen dieses BitmapFrameVorgangs verwendet wird.

uriCachePolicy
RequestCachePolicy

Die Zwischenspeicherungsanforderungen hierfür BitmapFrame.

Gibt zurück

A BitmapFrame aus einem gegebenen Uri Mit dem angegebenen BitmapCreateOptions, BitmapCacheOption, und RequestCachePolicy.

Hinweise

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy) wird in der .NET Framework Version 3.5 eingeführt. Weitere Informationen finden Sie unter "Versionen und Abhängigkeiten".

Gilt für:

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

Erstellt ein neues BitmapFrame aus einer gegebenen Ansicht BitmapSource mit der angegebenen Miniaturansicht, BitmapMetadataund ColorContext.

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

Parameter

source
BitmapSource

Das BitmapSource wird verwendet, um dies BitmapFramezu konstruieren.

thumbnail
BitmapSource

Eine Miniaturansicht des resultierenden BitmapFrame.

metadata
BitmapMetadata

Die Metadaten, die dieser BitmapFrameZuordnung zugeordnet werden sollen.

colorContexts
ReadOnlyCollection<ColorContext>

Die ColorContext Objekte, die diesem BitmapFrameZugeordnet sind.

Gibt zurück

A BitmapFrame aus einer gegebenen Mit BitmapSource der angegebenen Miniaturansicht, BitmapMetadataund ColorContext.

Gilt für: