ID2D1DeviceContext::CreateBitmapFromWicBitmap(IWICBitmapSource*,constD2D1_BITMAP_PROPERTIES1*,ID2D1Bitmap1**) method (d2d1_1.h)

Creates a Direct2D bitmap by copying a WIC bitmap.

Syntax

HRESULT CreateBitmapFromWicBitmap(
  [in]           IWICBitmapSource              *wicBitmapSource,
  [in, optional] const D2D1_BITMAP_PROPERTIES1 *bitmapProperties,
  [out]          ID2D1Bitmap1                  **bitmap
);

Parameters

[in] wicBitmapSource

Type: IWICBitmapSource*

The WIC bitmap source to copy from.

[in, optional] bitmapProperties

Type: const D2D1_BITMAP_PROPERTIES1*

A bitmap properties structure that specifies bitmap creation options.

[out] bitmap

Type: ID2D1Bitmap1**

The address of the newly created bitmap object.

Return value

Type: HRESULT

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

HRESULT Description
S_OK No error occurred.
E_OUTOFMEMORY Direct2D could not allocate sufficient memory to complete the call.
E_INVALIDARG An invalid parameter was passed to the returning function.

Remarks

Starting with Windows 8.1, the bitmapProperties parameter is optional. When it is not specified, the created bitmap inherits the pixel format and alpha mode from wicBitmapSource. For a list of supported pixel formats and alpha modes, see Supported Pixel Formats and Alpha Modes.

When the bitmapProperties parameter is specified, the value in bitmapProperties->pixelFormat must either be DXGI_FORMAT_UNKNOWN or must match the WIC pixel format in wicBitmapSource.

When bitmapProperties->pixelFormat.alphaMode is set to D2D1_ALPHA_MODE_UNKNOWN, the newly created bitmap inherits the alpha mode from wicBitmapSource. When bitmapProperties->pixelFormat.alphaMode is set to D2D1_ALPHA_MODE_PREMULTIPLIED, D2D1_ALPHA_MODE_STRAIGHT, or D2D1_ALPHA_MODE_IGNORE, this forces the newly created bitmap to use the specified alpha mode.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1_1.h
DLL D2d1.dll

See also

ID2D1DeviceContext