Class BitmapEncoder
[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
ImagingFactoryThe factory.
containerFormatGuid
GuidThe 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
ImagingFactoryThe factory.
containerFormatGuid
GuidThe container format GUID. List from ContainerFormatGuids
stream
WICStreamA 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
ImagingFactoryThe factory.
containerFormatGuid
GuidThe container format GUID. List from ContainerFormatGuids
guidVendorRef
GuidThe 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
ImagingFactoryThe factory.
containerFormatGuid
GuidThe container format GUID. List from ContainerFormatGuids
guidVendorRef
GuidThe GUID vendor ref.
stream
WICStreamA 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
ImagingFactoryThe factory.
containerFormatGuid
GuidThe container format GUID. List from ContainerFormatGuids
guidVendorRef
GuidThe GUID vendor ref.
stream
StreamA 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
ImagingFactoryThe factory.
containerFormatGuid
GuidThe container format GUID. List from ContainerFormatGuids
stream
StreamA 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
EncoderInfo
Retrieves an BitmapEncoderInfo for the encoder.
public BitmapEncoderInfo EncoderInfo { get; }
Property Value
MetadataQueryWriter
Proxy function for the GetMetadataQueryWriter method.
public MetadataQueryWriter MetadataQueryWriter { get; }
Property Value
Palette
Proxy function for the SetPalette method.
public Palette Palette { set; }
Property Value
Preview
Sets the global preview for the image.
public BitmapSource Preview { set; }
Property Value
Thumbnail
Sets the global thumbnail for the image.
public BitmapSource Thumbnail { set; }
Property Value
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
IStreamThe stream to use for initialization.
Initialize(Stream)
Initializes the encoder with the provided stream.
public void Initialize(Stream stream)
Parameters
stream
StreamThe 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