BitmapFrame.Create Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee maakt u een nieuwe BitmapFrame op basis van de opgegeven argumenten.
Overloads
Create(Stream)
Hiermee maakt u een nieuwe BitmapFrame op basis van een bepaalde 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
Parameters
- bitmapStream
- Stream
De Stream die wordt gebruikt om de BitmapFrame.
Retouren
Een BitmapFrame van een gegeven Stream.
Opmerkingen
De bitmapStream optie kan worden gesloten nadat het frame alleen is gemaakt wanneer de OnLoad cacheoptie wordt gebruikt. De standaardcacheoptie OnDemand behoudt de stream totdat het frame nodig is. Gebruik de Create(Stream, BitmapCreateOptions, BitmapCacheOption) methode om opties voor maken en cache op te geven.
Van toepassing op
Create(Uri)
Hiermee maakt u een nieuwe BitmapFrame op basis van een bepaalde 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
Parameters
- bitmapUri
- Uri
De Uri bron van de BitmapFrame.
Retouren
Een BitmapFrame van een gegeven Uri.
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u een BitmapFrame van een gegeven Urimaakt.
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)
Van toepassing op
Create(BitmapSource)
Hiermee maakt u een nieuwe BitmapFrame op basis van een bepaalde 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
Parameters
- source
- BitmapSource
De BitmapSource die wordt gebruikt om dit BitmapFramete bouwen.
Retouren
Een BitmapFrame van een gegeven BitmapSource.
Van toepassing op
Create(Uri, RequestCachePolicy)
Hiermee maakt u een BitmapFrame van een gegeven Uri met de opgegeven 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
Parameters
- bitmapUri
- Uri
De locatie van de bitmap waaruit de BitmapFrame bitmap is gemaakt.
- uriCachePolicy
- RequestCachePolicy
De cachevereisten hiervoor BitmapFrame.
Retouren
Een BitmapFrame van een gegeven Uri met de opgegeven RequestCachePolicy.
Opmerkingen
Create(Uri, RequestCachePolicy) wordt geïntroduceerd in de .NET Framework versie 3.5. Zie Versies en afhankelijkheden voor meer informatie.
Van toepassing op
Create(BitmapSource, BitmapSource)
Hiermee maakt u een nieuwe BitmapFrame op basis van een bepaalde BitmapSource waarde met de opgegeven miniatuur.
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
Parameters
- source
- BitmapSource
De bron waaruit de BitmapFrame is samengesteld.
- thumbnail
- BitmapSource
Een miniatuurafbeelding van het resulterende BitmapFrame.
Retouren
Een BitmapFrame van een gegeven BitmapSource met de opgegeven miniatuur.
Van toepassing op
Create(Stream, BitmapCreateOptions, BitmapCacheOption)
Hiermee maakt u een nieuwe BitmapFrame op basis van een bepaalde Stream waarde met de opgegeven BitmapCreateOptions en 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
Parameters
- bitmapStream
- Stream
De stroom waaruit dit BitmapFrame is opgebouwd.
- createOptions
- BitmapCreateOptions
De opties die worden gebruikt om dit BitmapFramete maken.
- cacheOption
- BitmapCacheOption
De cacheoptie die wordt gebruikt om deze BitmapFramete maken.
Retouren
Een BitmapFrame van een gegeven Stream met de opgegeven BitmapCreateOptions en BitmapCacheOption.
Opmerkingen
Gebruik de OnLoad cacheoptie als u de bitmapStream cache wilt sluiten nadat de bitmap is gemaakt. De standaardcacheoptie OnDemand behoudt toegang tot de stream totdat de bitmap nodig is en opschonen wordt verwerkt door de garbagecollector.
Van toepassing op
Create(Uri, BitmapCreateOptions, BitmapCacheOption)
Hiermee maakt u een BitmapFrame van een gegeven Uri met de opgegeven BitmapCreateOptions en 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
Parameters
- bitmapUri
- Uri
De locatie van de bitmap waaruit de BitmapFrame bitmap is gemaakt.
- createOptions
- BitmapCreateOptions
De opties die worden gebruikt om dit BitmapFramete maken.
- cacheOption
- BitmapCacheOption
De cacheoptie die wordt gebruikt om deze BitmapFramete maken.
Retouren
Een BitmapFrame van een gegeven Uri met de opgegeven BitmapCreateOptions, en BitmapCacheOption.
Van toepassing op
Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy)
Hiermee maakt u een BitmapFrame van een gegeven Uri met de opgegeven BitmapCreateOptions, BitmapCacheOptionen 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
Parameters
- bitmapUri
- Uri
De locatie van de bitmap waaruit de BitmapFrame bitmap is gemaakt.
- createOptions
- BitmapCreateOptions
De opties die worden gebruikt om dit BitmapFramete maken.
- cacheOption
- BitmapCacheOption
De cacheoptie die wordt gebruikt om deze BitmapFramete maken.
- uriCachePolicy
- RequestCachePolicy
De cachevereisten hiervoor BitmapFrame.
Retouren
Een BitmapFrame van een gegeven Uri met de opgegeven BitmapCreateOptions, BitmapCacheOptionen RequestCachePolicy.
Opmerkingen
Create(Uri, BitmapCreateOptions, BitmapCacheOption, RequestCachePolicy) wordt geïntroduceerd in de .NET Framework versie 3.5. Zie Versies en afhankelijkheden voor meer informatie.
Van toepassing op
Create(BitmapSource, BitmapSource, BitmapMetadata, ReadOnlyCollection<ColorContext>)
Hiermee maakt u een nieuwe BitmapFrame op basis van een bepaalde BitmapSource waarde met de opgegeven miniatuur, BitmapMetadataen 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
Parameters
- source
- BitmapSource
De BitmapSource die wordt gebruikt om dit BitmapFramete bouwen.
- thumbnail
- BitmapSource
Een miniatuurafbeelding van het resulterende BitmapFrame.
- metadata
- BitmapMetadata
De metagegevens die u aan deze BitmapFramegegevens wilt koppelen.
- colorContexts
- ReadOnlyCollection<ColorContext>
De ColorContext objecten die aan dit BitmapFramezijn gekoppeld.
Retouren
Een BitmapFrame van een gegeven BitmapSource met de opgegeven miniatuur, BitmapMetadataen ColorContext.