ID2D1RenderTarget::CreateBitmapBrush(ID2D1Bitmap*,constD2D1_BITMAP_BRUSH_PROPERTIES&,constD2D1_BRUSH_PROPERTIES&,ID2D1BitmapBrush**) method (d2d1.h)

Creates an ID2D1BitmapBrush from the specified bitmap.


HRESULT CreateBitmapBrush(
  [in]           ID2D1Bitmap                          *bitmap,
  [in, optional] const D2D1_BITMAP_BRUSH_PROPERTIES & bitmapBrushProperties,
  [in, optional] const D2D1_BRUSH_PROPERTIES &        brushProperties,
  [out]          ID2D1BitmapBrush                     **bitmapBrush


[in] bitmap

Type: ID2D1Bitmap*

The bitmap contents of the new brush.

[in, optional] bitmapBrushProperties


The extend modes and interpolation mode of the new brush, or NULL. If you set this parameter to NULL, the brush defaults to the D2D1_EXTEND_MODE_CLAMP horizontal and vertical extend modes and the D2D1_BITMAP_INTERPOLATION_MODE_LINEAR interpolation mode.

[in, optional] brushProperties


A structure that contains the opacity and transform of the new brush, or NULL. If you set this parameter to NULL, the brush sets the opacity member to 1.0F and the transform member to the identity matrix.

[out] bitmapBrush

Type: ID2D1BitmapBrush**

When this method returns, this output parameter contains a pointer to a pointer to the new brush. Pass this parameter uninitialized.

Return value


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


Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1.h
Library D2d1.lib
DLL D2d1.dll

See also

Brushes Overview

How to Create a Bitmap Brush