ID2D1RenderTarget::DrawBitmap method

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

Syntax


void DrawBitmap(
  [in]            ID2D1Bitmap *bitmap,
  const D2D1_RECT_F &destinationRectangle,
  FLOAT opacity = 1.0f,
  D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
  [in, optional]  const D2D1_RECT_F *sourceRectangle = NULL
);

Parameters

bitmap [in]

Type: ID2D1Bitmap*

The bitmap to render.

destinationRectangle [ref]

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.

sourceRectangle [in, optional]

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

This method does not return a value.

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

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1RenderTarget

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.