[]
IWICBitmapFrameEncode
[Guid("00000105-a8f2-4877-ba0a-fd2b6645fb94")]
public class BitmapFrameEncode : ComObject, IDisposable, IUnknown
Initializes a new instance of the BitmapFrameEncode class.
public BitmapFrameEncode(IntPtr nativePtr)
nativePtr System.IntPtrThe native pointer.
Gets the properties to setup before Initialize().
public BitmapEncoderOptions Options { get; }
HRESULT IWICBitmapFrameEncode::Commit()
public void Commit()
Initializes a new instance of the BitmapFrameEncode class.
public static BitmapFrameEncode Create(BitmapEncoder encoder)
encoder BitmapEncoderThe encoder.
Clean up any resources being used.
protected override void Dispose(bool disposing)
disposing boolHRESULT IWICBitmapFrameEncode::GetMetadataQueryWriter([Out] IWICMetadataQueryWriter** ppIMetadataQueryWriter)
public MetadataQueryWriter GetMetadataQueryWriter()
Initializes this instance.
public void Initialize()
HRESULT IWICBitmapFrameEncode::Initialize([In, Optional] IPropertyBag2* pIEncoderOptions)
public void Initialize(PropertyBag encoderOptionsRef)
encoderOptionsRef PropertyBagSets the ColorContext objects for this frame encoder.
public void SetColorContexts(ColorContext[] colorContextOut)
colorContextOut ColorContext[]The color contexts to set for the encoder.
HRESULT IWICBitmapFrameEncode::SetColorContexts([In] unsigned int cCount,[In, Buffer] IWICColorContext** ppIColorContext)
public void SetColorContexts(int count, ComArray<ColorContext> colorContextOut)
count intcolorContextOut ComArray<ColorContext>HRESULT IWICBitmapFrameEncode::SetColorContexts([In] unsigned int cCount,[In, Buffer] IWICColorContext** ppIColorContext)
public void SetColorContexts(int count, ColorContext[] colorContextOut)
count intcolorContextOut ColorContext[]HRESULT IWICBitmapFrameEncode::SetPalette([In, Optional] IWICPalette* pIPalette)
public void SetPalette(Palette paletteRef)
paletteRef PaletteHRESULT IWICBitmapFrameEncode::SetPixelFormat([InOut] GUID* pPixelFormat)
public void SetPixelFormat(ref Guid pixelFormatRef)
pixelFormatRef System.GuidHRESULT IWICBitmapFrameEncode::SetResolution([In] double dpiX,[In] double dpiY)
public void SetResolution(double dpiX, double dpiY)
dpiX doubledpiY doubleHRESULT IWICBitmapFrameEncode::SetSize([In] unsigned int uiWidth,[In] unsigned int uiHeight)
public void SetSize(int width, int height)
width intheight intHRESULT IWICBitmapFrameEncode::SetThumbnail([In, Optional] IWICBitmapSource* pIThumbnail)
public void SetThumbnail(BitmapSource thumbnailRef)
thumbnailRef BitmapSourceEncodes the frame scanlines.
public void WritePixels(int lineCount, DataRectangle buffer, int totalSizeInBytes = 0)
lineCount intThe number of lines to encode.
buffer DataRectangleA data buffer containing the pixels to copy from.
totalSizeInBytes intTotal size in bytes of pixels to write. If == 0, size is calculated with lineCount * rowStride.
Successive WritePixels calls are assumed to be sequential scanline access in the output image.
HRESULT IWICBitmapFrameEncode::WritePixels([In] unsigned int lineCount,[In] unsigned int cbStride,[In] unsigned int cbBufferSize,[In, Buffer] void* pbPixels)
public void WritePixels(int lineCount, int stride, int bufferSize, IntPtr pixelsRef)
lineCount intstride intbufferSize intpixelsRef System.IntPtrEncodes the frame scanlines.
public void WritePixels(int lineCount, IntPtr buffer, int rowStride, int totalSizeInBytes = 0)
lineCount intThe number of lines to encode.
buffer System.IntPtrA data buffer containing the pixels to copy from.
rowStride intThe stride of one row.
totalSizeInBytes intTotal size in bytes of pixels to write. If == 0, size is calculated with lineCount * rowStride.
Successive WritePixels calls are assumed to be sequential scanline access in the output image.
Encodes the frame scanlines.
public void WritePixels<T>(int lineCount, int stride, T[] pixelBuffer) where T : struct
lineCount intThe number of lines to encode.
stride intThe stride of the image pixels.
pixelBuffer T[]A reference to the pixel buffer.
TSuccessive WritePixels calls are assumed to be sequential scanline access in the output image.
Encodes a bitmap source.
public void WriteSource(BitmapSource bitmapSourceRef, RectL rectangleRef)
bitmapSourceRef BitmapSourceThe bitmap source to encode.
rectangleRef RectLThe size rectangle of the bitmap source.
If SetSize is not called prior to calling WriteSource, the size given in prc is used if not null. Otherwise, the size of the BitmapSource given in pIBitmapSource is used.
If SetPixelFormat is not called prior to calling WriteSource, the pixel format of the BitmapSource given in pIBitmapSource is used.
If SetResolution is not called prior to calling WriteSource, the pixel format of pIBitmapSource is used.
If SetPalette is not called prior to calling WriteSource, the target pixel format is indexed, and the pixel format of pIBitmapSource matches the encoder frame's pixel format, then the pIBitmapSource pixel format is used.
When encoding a GIF image, if the global palette is set and the frame level palette is not set directly by the user or by a custom independent software vendor (ISV) GIF codec, WriteSource will use the global palette to encode the frame even when pIBitmapSource has a frame level palette.
Windows Vista:The source rect width must match the width set through SetSize. Repeated WriteSource calls can be made as long as the total accumulated source rect height is the same as set through SetSize.
HRESULT IWICBitmapFrameEncode::WriteSource([In, Optional] IWICBitmapSource* pIBitmapSource,[In] void* prc)
public void WriteSource(BitmapSource bitmapSourceRef, IntPtr rectangleRef)
bitmapSourceRef BitmapSourcerectangleRef System.IntPtrEncodes a bitmap source.
public void WriteSource(BitmapSource bitmapSource)
bitmapSource BitmapSourceThe bitmap source to encode.
If SetSize is not called prior to calling WriteSource, the size given in prc is used if not null. Otherwise, the size of the BitmapSource given in pIBitmapSource is used.
If SetPixelFormat is not called prior to calling WriteSource, the pixel format of the BitmapSource given in pIBitmapSource is used.
If SetResolution is not called prior to calling WriteSource, the pixel format of pIBitmapSource is used.
If SetPalette is not called prior to calling WriteSource, the target pixel format is indexed, and the pixel format of pIBitmapSource matches the encoder frame's pixel format, then the pIBitmapSource pixel format is used.
When encoding a GIF image, if the global palette is set and the frame level palette is not set directly by the user or by a custom independent software vendor (ISV) GIF codec, WriteSource will use the global palette to encode the frame even when pIBitmapSource has a frame level palette.
Windows Vista:The source rect width must match the width set through SetSize. Repeated WriteSource calls can be made as long as the total accumulated source rect height is the same as set through SetSize.
Performs an explicit conversion from System.IntPtr to BitmapFrameEncode.
public static explicit operator BitmapFrameEncode(IntPtr nativePointer)
nativePointer System.IntPtr