BitmapEncoder.Save(Stream) Metod

Definition

Kodar en bitmappsbild till en angiven Stream.

public:
 virtual void Save(System::IO::Stream ^ stream);
[System.Security.SecurityCritical]
public virtual void Save(System.IO.Stream stream);
public virtual void Save(System.IO.Stream stream);
[<System.Security.SecurityCritical>]
abstract member Save : System.IO.Stream -> unit
override this.Save : System.IO.Stream -> unit
abstract member Save : System.IO.Stream -> unit
override this.Save : System.IO.Stream -> unit
Public Overridable Sub Save (stream As Stream)

Parametrar

stream
Stream

Identifierar den filström som bitmappen är kodad till.

Attribut

Undantag

Bitmappen har redan kodats.

Antalet Frames är mindre än eller lika med noll.

Exempel

I följande exempel visas hur du sparar en bitmappsbild till en filström med hjälp av den härledda TiffBitmapEncoder klassen.

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 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)

Kommentarer

I det här API:et är "spara" och "koda" synonyma.

Gäller för

Se även