Język

BitmapFrame.Create Metoda

Definicja

Tworzy nowy BitmapFrame na podstawie podanych argumentów.

Przeciążenia

Nazwa Opis
Create(Stream)

Tworzy nowy BitmapFrame element na podstawie danego Streamelementu .

Create(Uri)

Tworzy nowy BitmapFrame element na podstawie danego Urielementu .

Create(BitmapSource)

Tworzy nowy BitmapFrame element na podstawie danego BitmapSourceelementu .

Create(Uri, RequestCachePolicy)

Tworzy element BitmapFrame na podstawie danej Uri wartości z określonym RequestCachePolicyelementem .

Create(BitmapSource, BitmapSource)

Tworzy nowy BitmapFrame element na podstawie danej BitmapSource z określoną miniaturą.

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

Tworzy nowy BitmapFrame element na podstawie danej Stream wartości z określonymi BitmapCreateOptions wartościami i BitmapCacheOption.

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

Tworzy element BitmapFrame na podstawie danej Uri wartości z określonymi BitmapCreateOptions wartościami i BitmapCacheOption.

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

Tworzy element BitmapFrame na podstawie danej Uri wartości z określonymi BitmapCreateOptionselementami , BitmapCacheOptioni RequestCachePolicy.

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

Tworzy nowy BitmapFrame element na podstawie podanej BitmapSource miniatury, BitmapMetadatai ColorContext.

Create(Stream)

Tworzy nowy BitmapFrame element na podstawie danego Streamelementu .

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

Parametry

bitmapStream
Stream

Element Stream używany do konstruowania .BitmapFrame

Zwraca

Wartość BitmapFrame z danego Streamelementu .

Uwagi

Element bitmapStream można zamknąć po utworzeniu ramki tylko wtedy, gdy OnLoad jest używana opcja pamięci podręcznej. Domyślna OnDemand opcja pamięci podręcznej zachowuje strumień do momentu, gdy ramka będzie potrzebna. Create(Stream, BitmapCreateOptions, BitmapCacheOption) Użyj metody , aby określić opcje tworzenia i pamięci podręcznej.

Dotyczy

Create(Uri)

Tworzy nowy BitmapFrame element na podstawie danego Urielementu .

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

Parametry

bitmapUri
Uri

Element Uri identyfikujący źródło obiektu BitmapFrame.

Zwraca

Wartość BitmapFrame z danego Urielementu .

Przykłady

W poniższym przykładzie kodu pokazano, jak skonstruować element BitmapFrame z danego Uriobiektu .

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)

Dotyczy

Create(BitmapSource)

Tworzy nowy BitmapFrame element na podstawie danego BitmapSourceelementu .

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

Parametry

source
BitmapSource

Element BitmapSource używany do konstruowania tego .BitmapFrame

Zwraca

Wartość BitmapFrame z danego BitmapSourceelementu .

Dotyczy

Create(Uri, RequestCachePolicy)

Tworzy element BitmapFrame na podstawie danej Uri wartości z określonym RequestCachePolicyelementem .

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

Parametry

bitmapUri
Uri

Lokalizacja mapy bitowej, z której jest tworzona BitmapFrame .

uriCachePolicy
RequestCachePolicy

Wymagania dotyczące buforowania dla tego BitmapFrameelementu .

Zwraca

Wartość BitmapFrame z danej Uri wartości z określonym RequestCachePolicyelementem .

Uwagi

Create(Uri, RequestCachePolicy) jest wprowadzana w programie .NET Framework w wersji 3.5. Aby uzyskać więcej informacji, zobacz Wersje i zależności.

Dotyczy

Create(BitmapSource, BitmapSource)

Tworzy nowy BitmapFrame element na podstawie danej BitmapSource z określoną miniaturą.

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

Parametry

source
BitmapSource

Źródło, z którego BitmapFrame jest skonstruowany.

thumbnail
BitmapSource

Obraz miniatury wynikowego BitmapFrameelementu .

Zwraca

Wartość BitmapFrame z danej BitmapSource z określoną miniaturą.

Dotyczy

Create(Stream, BitmapCreateOptions, BitmapCacheOption)

Tworzy nowy BitmapFrame element na podstawie danej Stream wartości z określonymi BitmapCreateOptions wartościami i 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

Parametry

bitmapStream
Stream

Strumień, z którego BitmapFrame jest skonstruowany.

createOptions
BitmapCreateOptions

Opcje używane do utworzenia tego elementu BitmapFrame.

cacheOption
BitmapCacheOption

Opcja pamięci podręcznej używana do utworzenia tego elementu BitmapFrame.

Zwraca

Wartość BitmapFrame z danej Stream wartości z określonymi BitmapCreateOptions wartościami i BitmapCacheOption.

Uwagi

OnLoad Użyj opcji pamięci podręcznej, jeśli chcesz zamknąć bitmapStream element po utworzeniu mapy bitowej. Domyślna OnDemand opcja pamięci podręcznej zachowuje dostęp do strumienia, dopóki mapa bitowa nie będzie potrzebna, a czyszczenie jest obsługiwane przez moduł odśmiecanie pamięci.

Dotyczy

Create(Uri, BitmapCreateOptions, BitmapCacheOption)

Tworzy element BitmapFrame na podstawie danej Uri wartości z określonymi BitmapCreateOptions wartościami i 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

Parametry

bitmapUri
Uri

Lokalizacja mapy bitowej, z której jest tworzona BitmapFrame .

createOptions
BitmapCreateOptions

Opcje używane do utworzenia tego elementu BitmapFrame.

cacheOption
BitmapCacheOption

Opcja pamięci podręcznej używana do utworzenia tego elementu BitmapFrame.

Zwraca

Wartość BitmapFrame z danej Uri wartości z określonymi BitmapCreateOptionselementami i BitmapCacheOption.

Dotyczy

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)

Tworzy element BitmapFrame na podstawie danej Uri wartości z określonymi BitmapCreateOptionselementami , BitmapCacheOptioni 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

Parametry

bitmapUri
Uri

Lokalizacja mapy bitowej, z której jest tworzona BitmapFrame .

createOptions
BitmapCreateOptions

Opcje używane do utworzenia tego elementu BitmapFrame.

cacheOption
BitmapCacheOption

Opcja pamięci podręcznej używana do utworzenia tego elementu BitmapFrame.

uriCachePolicy
RequestCachePolicy

Wymagania dotyczące buforowania dla tego BitmapFrameelementu .

Zwraca

A BitmapFrame od danego Uri z określonymi BitmapCreateOptions, BitmapCacheOptioni RequestCachePolicy.

Uwagi

Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy) jest wprowadzana w programie .NET Framework w wersji 3.5. Aby uzyskać więcej informacji, zobacz Wersje i zależności.

Dotyczy

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

Tworzy nowy BitmapFrame element na podstawie podanej BitmapSource miniatury, BitmapMetadatai 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

Parametry

source
BitmapSource

Element BitmapSource używany do konstruowania tego .BitmapFrame

thumbnail
BitmapSource

Obraz miniatury wynikowego BitmapFrameelementu .

metadata
BitmapMetadata

Metadane do skojarzenia z tym BitmapFrameelementem .

colorContexts
ReadOnlyCollection<ColorContext>

Obiekty ColorContext , które są skojarzone z tym BitmapFrameelementem .

Zwraca

Element BitmapFrame z danej BitmapSource wartości z określoną miniaturą, BitmapMetadatai ColorContext.

Dotyczy