ID2D1RenderTarget::DrawBitmap(ID2D1Bitmap*,constD2D1_RECT_F&,FLOAT,D2D1_BITMAP_INTERPOLATION_MODE,constD2D1_RECT_F*) method (d2d1.h)

Draws the specified bitmap after scaling it to the size of the specified rectangle.

Syntax

void DrawBitmap(
  [in]           ID2D1Bitmap                    *bitmap,
  [ref]          const D2D1_RECT_F &            destinationRectangle,
                 FLOAT                          opacity,
                 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode,
  [in, optional] const D2D1_RECT_F              *sourceRectangle
);

Parameters

[in] bitmap

Type: ID2D1Bitmap*

The bitmap to render.

[ref] destinationRectangle

Type: const D2D1_RECT_F

The size and position, in device-independent pixels in the render target's coordinate space, of the area to which the bitmap is drawn. If the rectangle is not well-ordered, nothing is drawn, but the render target does not enter an error state.

opacity

Type: FLOAT

A value between 0.0f and 1.0f, inclusive, that specifies the opacity value to be applied to the bitmap; this value is multiplied against the alpha values of the bitmap's contents. Default is 1.0f.

interpolationMode

Type: D2D1_BITMAP_INTERPOLATION_MODE

The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. The default value is D2D1_BITMAP_INTERPOLATION_MODE_LINEAR.

[in, optional] sourceRectangle

Type: const D2D1_RECT_F*

The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to draw; NULL to draw the entire bitmap.

Return value

None

Remarks

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawBitmap) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods.

Examples

For an example, see How to Draw a Bitmap. For an example showing how to load a bitmap from a resource or a file, see How to Load a Bitmap from a Resource and How to Load a Bitmap from a File.

Requirements

Requirement Value
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

ID2D1RenderTarget