BitmapDecoder.CreateInPlaceBitmapMetadataWriter Método

Definición

Crea una instancia de InPlaceBitmapMetadataWriter, que puede usarse para actualizar los metadatos de un mapa de bits.

public:
 virtual System::Windows::Media::Imaging::InPlaceBitmapMetadataWriter ^ CreateInPlaceBitmapMetadataWriter();
public virtual System.Windows.Media.Imaging.InPlaceBitmapMetadataWriter CreateInPlaceBitmapMetadataWriter ();
abstract member CreateInPlaceBitmapMetadataWriter : unit -> System.Windows.Media.Imaging.InPlaceBitmapMetadataWriter
override this.CreateInPlaceBitmapMetadataWriter : unit -> System.Windows.Media.Imaging.InPlaceBitmapMetadataWriter
Public Overridable Function CreateInPlaceBitmapMetadataWriter () As InPlaceBitmapMetadataWriter

Devoluciones

Instancia de InPlaceBitmapMetadataWriter.

Excepciones

El flujo de imagen original del archivo es de solo lectura.

El descodificador no es un decodificador integrado.

Ejemplos

En el ejemplo de código siguiente se muestra cómo crear un InPlaceBitmapMetadataWriter para actualizar los metadatos asociados a una imagen de mapa de bits.

Stream^ pngStream = gcnew FileStream("smiley.png", FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite);
PngBitmapDecoder^ pngDecoder = gcnew PngBitmapDecoder(pngStream, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapFrame^ pngFrame = pngDecoder->Frames[0];
InPlaceBitmapMetadataWriter^ pngInplace = pngFrame->CreateInPlaceBitmapMetadataWriter();
if (pngInplace->TrySave() == true)
{
   pngInplace->SetQuery("/Text/Description", "Have a nice day.");
}
pngStream->Close();
Stream pngStream = new System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
PngBitmapDecoder pngDecoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapFrame pngFrame = pngDecoder.Frames[0];
InPlaceBitmapMetadataWriter pngInplace = pngFrame.CreateInPlaceBitmapMetadataWriter();
if (pngInplace.TrySave() == true)
{ pngInplace.SetQuery("/Text/Description", "Have a nice day."); }
pngStream.Close();
Dim pngStream As New System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)
Dim pngDecoder As New PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim pngFrame As BitmapFrame = pngDecoder.Frames(0)
Dim pngInplace As InPlaceBitmapMetadataWriter = pngFrame.CreateInPlaceBitmapMetadataWriter()
If pngInplace.TrySave() = True Then
    pngInplace.SetQuery("/Text/Description", "Have a nice day.")
End If
pngStream.Close()

Se aplica a

Consulte también