IWICBitmapFrameEncode::WriteSource method (wincodec.h)

Encodes a bitmap source.

Syntax

HRESULT WriteSource(
  [in] IWICBitmapSource *pIBitmapSource,
  [in] WICRect          *prc
);

Parameters

[in] pIBitmapSource

Type: IWICBitmapSource*

The bitmap source to encode.

[in] prc

Type: WICRect*

The size rectangle of the bitmap source.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

If SetSize is not called prior to calling WriteSource, the size given in prc is used if not NULL. Otherwise, the size of the IWICBitmapSource given in pIBitmapSource is used.

If SetPixelFormat is not called prior to calling WriteSource, the pixel format of the IWICBitmapSource 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.

Starting with Windows Vista, repeated WriteSource calls can be made as long as the total accumulated source rect height is the same as set through SetSize.

Starting with Windows 8.1, the source rect must be at least the dimensions set through SetSize. If the source rect width exceeds the SetSize width, extra pixels on the right side are ignored. If the source rect height exceeds the remaining unfilled height, extra scan lines on the bottom are ignored.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincodec.h
Library Windowscodecs.lib
DLL Windowscodecs.dll

See also

Conceptual

How to Write a WIC-Enabled CODEC

IWICBitmapFrameEncode

Windows Imaging Component Overview