ID2D1CommandSink::DrawBitmap method (d2d1_1.h)

Draws a bitmap to the render target.


HRESULT DrawBitmap(
  [in]           ID2D1Bitmap             *bitmap,
  [in, optional] const D2D1_RECT_F       *destinationRectangle,
                 FLOAT                   opacity,
                 D2D1_INTERPOLATION_MODE interpolationMode,
  [in, optional] const D2D1_RECT_F       *sourceRectangle,
  [in, optional] const D2D1_MATRIX_4X4_F *perspectiveTransform


[in] bitmap

Type: ID2D1Bitmap*

The bitmap to draw.

[in, optional] destinationRectangle

Type: D2D1_RECT_F

The destination rectangle. The default is the size of the bitmap and the location is the upper left corner of the render target.



The opacity of the bitmap.



The interpolation mode to use.

[in, optional] sourceRectangle

Type: const D2D1_RECT_F

An optional source rectangle.

[in, optional] perspectiveTransform

Type: const D2D1_MATRIX_4X4_F

An optional perspective transform.

Return value

This method does not return a value.


The destinationRectangle parameter defines the rectangle in the target where the bitmap will appear (in device-independent pixels (DIPs)). This is affected by the currently set transform and the perspective transform, if set. If you specify NULL, then the destination rectangle is (left=0, top=0, right = width(sourceRectangle), bottom = height(sourceRectangle).

The sourceRectangle defines the sub-rectangle of the source bitmap (in DIPs). DrawBitmap clips this rectangle to the size of the source bitmap, so it's impossible to sample outside of the bitmap. If you specify NULL, then the source rectangle is taken to be the size of the source bitmap.

The perspectiveTransform is specified in addition to the transform on device context.


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