ID2D1DeviceContext::CreateBitmap method

Creates a bitmap that can be used as a target surface, for reading back to the CPU, or as a source for the DrawBitmap and ID2D1BitmapBrush APIs. In addition, color context information can be passed to the bitmap.

Syntax

HRESULT CreateBitmap(
  D2D1_SIZE_U                   size,
  const void                    *sourceData,
  UINT32                        pitch,
  const D2D1_BITMAP_PROPERTIES1 *bitmapProperties,
  ID2D1Bitmap1                  **bitmap
);

Parameters

size

Type: D2D1_SIZE_U

The pixel size of the bitmap to be created.

sourceData

Type: const void*

The initial data that will be loaded into the bitmap.

pitch

Type: UINT32

The pitch of the source data, if specified.

bitmapProperties

Type: const D2D1_BITMAP_PROPERTIES1

The properties of the bitmap to be created.

bitmap

Type: ID2D1Bitmap1**

When this method returns, contains the address of a pointer to a new 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 value was passed to the method.
D3DERR_OUTOFVIDEOMEMORY Direct3D does not have enough display memory to perform the operation.

Remarks

The new bitmap can be used as a target for SetTarget if it is created with D2D1_BITMAP_OPTIONS_TARGET.

Requirements

   
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

D2D1_BITMAP_PROPERTIES1

D2D1_SIZE_U

ID2D1Bitmap1

ID2D1DeviceContext