Table of Contents

Class BitmapEncoder

Namespace
SharpDX.WIC
Assembly
SharpDX.Direct2D1.dll
[Guid("00000103-a8f2-4877-ba0a-fd2b6645fb94")]
public class BitmapEncoder : ComObject
Inheritance
BitmapEncoder
Derived

Constructors

BitmapEncoder(ImagingFactory, Guid)

Initializes a new instance of the BitmapEncoder class.

public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid)

Parameters

factory ImagingFactory

The factory.

containerFormatGuid Guid

The container format GUID. List from ContainerFormatGuids

BitmapEncoder(ImagingFactory, Guid, WICStream)

Initializes a new instance of the BitmapEncoder class.

public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid, WICStream stream = null)

Parameters

factory ImagingFactory

The factory.

containerFormatGuid Guid

The container format GUID. List from ContainerFormatGuids

stream WICStream

A stream to use as the output of this bitmap encoder.

BitmapEncoder(ImagingFactory, Guid, Guid)

Initializes a new instance of the BitmapEncoder class.

public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid, Guid guidVendorRef)

Parameters

factory ImagingFactory

The factory.

containerFormatGuid Guid

The container format GUID. List from ContainerFormatGuids

guidVendorRef Guid

The GUID vendor ref.

BitmapEncoder(ImagingFactory, Guid, Guid, WICStream)

Initializes a new instance of the BitmapEncoder class.

public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid, Guid guidVendorRef, WICStream stream = null)

Parameters

factory ImagingFactory

The factory.

containerFormatGuid Guid

The container format GUID. List from ContainerFormatGuids

guidVendorRef Guid

The GUID vendor ref.

stream WICStream

A stream to use as the output of this bitmap encoder.

BitmapEncoder(ImagingFactory, Guid, Guid, Stream)

Initializes a new instance of the BitmapEncoder class.

public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid, Guid guidVendorRef, Stream stream = null)

Parameters

factory ImagingFactory

The factory.

containerFormatGuid Guid

The container format GUID. List from ContainerFormatGuids

guidVendorRef Guid

The GUID vendor ref.

stream Stream

A stream to use as the output of this bitmap encoder.

BitmapEncoder(ImagingFactory, Guid, Stream)

Initializes a new instance of the BitmapEncoder class.

public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid, Stream stream = null)

Parameters

factory ImagingFactory

The factory.

containerFormatGuid Guid

The container format GUID. List from ContainerFormatGuids

stream Stream

A stream to use as the output of this bitmap encoder.

BitmapEncoder(nint)

public BitmapEncoder(nint nativePtr)

Parameters

nativePtr nint

Properties

ContainerFormat

Retrieves the encoder's container format.

public Guid ContainerFormat { get; }

Property Value

Guid

EncoderInfo

Retrieves an BitmapEncoderInfo for the encoder.

public BitmapEncoderInfo EncoderInfo { get; }

Property Value

BitmapEncoderInfo

MetadataQueryWriter

Proxy function for the GetMetadataQueryWriter method.

public MetadataQueryWriter MetadataQueryWriter { get; }

Property Value

MetadataQueryWriter

Palette

Proxy function for the SetPalette method.

public Palette Palette { set; }

Property Value

Palette

Preview

Sets the global preview for the image.

public BitmapSource Preview { set; }

Property Value

BitmapSource

Thumbnail

Sets the global thumbnail for the image.

public BitmapSource Thumbnail { set; }

Property Value

BitmapSource

Methods

Commit()

Commits all changes for the image and closes the stream.

public void Commit()

Remarks

To finalize an image, both the frame Commit and the encoder Commit must be called. However, only call the encoder Commit method after all frames have been committed.

After the encoder has been committed, it can't be re-initialized or reused with another stream. A new encoder interface must be created, for example, with IWICImagingFactory::CreateEncoder.

For the encoder Commit to succeed, you must at a minimum call IWICBitmapEncoder::Initialize and either IWICBitmapFrameEncode::WriteSource or IWICBitmapFrameEncode::WritePixels.

IWICBitmapFrameEncode::WriteSource specifies all parameters needed to encode the image data. IWICBitmapFrameEncode::WritePixels requires that you also call IWICBitmapFrameEncode::SetSize, IWICBitmapFrameEncode::SetPixelFormat, and IWICBitmapFrameEncode::SetPalette (if the pixel format is indexed).

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

Initialize(IStream)

Initializes the encoder with the provided stream.

public void Initialize(IStream stream)

Parameters

stream IStream

The stream to use for initialization.

Initialize(Stream)

Initializes the encoder with the provided stream.

public void Initialize(Stream stream)

Parameters

stream Stream

The stream to use for initialization.

SetColorContexts(ColorContext[])

Sets the ColorContext objects for the encoder.

public void SetColorContexts(ColorContext[] colorContextOut)

Parameters

colorContextOut ColorContext[]

The color contexts to set for the encoder.

Operators

explicit operator BitmapEncoder(nint)

public static explicit operator BitmapEncoder(nint nativePtr)

Parameters

nativePtr nint

Returns

BitmapEncoder