BmpBitmapDecoder Constructores
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Inicializa una nueva instancia de la clase BmpBitmapDecoder.
Sobrecargas
| BmpBitmapDecoder(Stream, BitmapCreateOptions, BitmapCacheOption) |
Inicializa una nueva instancia de la clase BmpBitmapDecoder a partir de la secuencia de archivos especificada con los valores especificados para |
| BmpBitmapDecoder(Uri, BitmapCreateOptions, BitmapCacheOption) |
Inicializa una nueva instancia de BmpBitmapDecoder a partir del Uri especificado con los valores especificados para |
BmpBitmapDecoder(Stream, BitmapCreateOptions, BitmapCacheOption)
Inicializa una nueva instancia de la clase BmpBitmapDecoder a partir de la secuencia de archivos especificada con los valores especificados para createOptions y cacheOption.
public:
BmpBitmapDecoder(System::IO::Stream ^ bitmapStream, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
[System.Security.SecurityCritical]
public BmpBitmapDecoder (System.IO.Stream bitmapStream, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
public BmpBitmapDecoder (System.IO.Stream bitmapStream, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
[<System.Security.SecurityCritical>]
new System.Windows.Media.Imaging.BmpBitmapDecoder : System.IO.Stream * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.BmpBitmapDecoder
new System.Windows.Media.Imaging.BmpBitmapDecoder : System.IO.Stream * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.BmpBitmapDecoder
Public Sub New (bitmapStream As Stream, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption)
Parámetros
- bitmapStream
- Stream
Secuencia de mapa de bits que se va a descodificar.
- createOptions
- BitmapCreateOptions
Opciones de inicialización para la imagen de mapa de bits.
- cacheOption
- BitmapCacheOption
Método de caché que se utiliza para la imagen de mapa de bits.
- Atributos
Excepciones
El valor bitmapStream es null.
no bitmapStream es una imagen codificada en mapa de bits (BMP).
Ejemplos
En el ejemplo de código siguiente se muestra cómo crear una instancia de y usar un BmpBitmapDecoder objeto a partir de una secuencia de archivos. La imagen descodificada se usa como origen de un Image control.
// Open a Stream and decode a BMP image
Stream^ imageStreamSource = gcnew FileStream("tulipfarm.bmp", FileMode::Open, FileAccess::Read, FileShare::Read);
BmpBitmapDecoder^ decoder = gcnew BmpBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapSource^ bitmapSource = decoder->Frames[0];
// Draw the Image
Image^ myImage = gcnew Image();
myImage->Source = bitmapSource;
myImage->Stretch = Stretch::None;
myImage->Margin = System::Windows::Thickness(20);
// Open a Stream and decode a BMP image
Stream imageStreamSource = new FileStream("tulipfarm.bmp", FileMode.Open, FileAccess.Read, FileShare.Read);
BmpBitmapDecoder decoder = new BmpBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource = decoder.Frames[0];
// Draw the Image
Image myImage = new Image();
myImage.Source = bitmapSource;
myImage.Stretch = Stretch.None;
myImage.Margin = new Thickness(20);
' Open a Stream and decode a BMP image
Dim imageStreamSource As New FileStream("tulipfarm.bmp", FileMode.Open, FileAccess.Read, FileShare.Read)
Dim decoder As New BmpBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim bitmapSource As BitmapSource = decoder.Frames(0)
' Draw the Image
Dim myImage As New Image()
myImage.Source = bitmapSource
myImage.Stretch = Stretch.None
myImage.Margin = New Thickness(20)
Comentarios
Use la OnLoad opción caché si desea cerrar bitmapStream después de crear el descodificador. La opción de caché predeterminada OnDemand conserva el acceso a la secuencia hasta que se necesita el mapa de bits y el recolector de elementos no utilizados controla la limpieza.
Se aplica a
BmpBitmapDecoder(Uri, BitmapCreateOptions, BitmapCacheOption)
Inicializa una nueva instancia de BmpBitmapDecoder a partir del Uri especificado con los valores especificados para createOptions y cacheOption.
public:
BmpBitmapDecoder(Uri ^ bitmapUri, System::Windows::Media::Imaging::BitmapCreateOptions createOptions, System::Windows::Media::Imaging::BitmapCacheOption cacheOption);
[System.Security.SecurityCritical]
public BmpBitmapDecoder (Uri bitmapUri, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
public BmpBitmapDecoder (Uri bitmapUri, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption);
[<System.Security.SecurityCritical>]
new System.Windows.Media.Imaging.BmpBitmapDecoder : Uri * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.BmpBitmapDecoder
new System.Windows.Media.Imaging.BmpBitmapDecoder : Uri * System.Windows.Media.Imaging.BitmapCreateOptions * System.Windows.Media.Imaging.BitmapCacheOption -> System.Windows.Media.Imaging.BmpBitmapDecoder
Public Sub New (bitmapUri As Uri, createOptions As BitmapCreateOptions, cacheOption As BitmapCacheOption)
Parámetros
- createOptions
- BitmapCreateOptions
Opciones de inicialización para la imagen de mapa de bits.
- cacheOption
- BitmapCacheOption
Método de caché que se utiliza para la imagen de mapa de bits.
- Atributos
Excepciones
El valor bitmapUri es null.
no bitmapUri es una imagen codificada en mapa de bits (BMP).
Ejemplos
En el ejemplo de código siguiente se muestra cómo crear una instancia de y usar un BmpBitmapDecoder objeto a partir de .Uri La imagen descodificada se usa como origen de un Image control.
// Open a Uri and decode a BMP image
System::Uri^ myUri = gcnew System::Uri("tulipfarm.bmp", UriKind::RelativeOrAbsolute);
BmpBitmapDecoder^ decoder2 = gcnew BmpBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapSource^ bitmapSource2 = decoder2->Frames[0];
// Draw the Image
Image^ myImage2 = gcnew Image();
myImage2->Source = bitmapSource2;
myImage2->Stretch = Stretch::None;
myImage2->Margin = System::Windows::Thickness(20);
// Open a Uri and decode a BMP image
Uri myUri = new Uri("tulipfarm.bmp", UriKind.RelativeOrAbsolute);
BmpBitmapDecoder decoder2 = new BmpBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource2 = decoder2.Frames[0];
// Draw the Image
Image myImage2 = new Image();
myImage2.Source = bitmapSource2;
myImage2.Stretch = Stretch.None;
myImage2.Margin = new Thickness(20);
' Open a Uri and decode a BMP image
Dim myUri As New Uri("tulipfarm.bmp", UriKind.RelativeOrAbsolute)
Dim decoder2 As New BmpBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim bitmapSource2 As BitmapSource = decoder2.Frames(0)
' Draw the Image
Dim myImage2 As New Image()
myImage2.Source = bitmapSource2
myImage2.Stretch = Stretch.None
myImage2.Margin = New Thickness(20)