Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ID2D1RenderTarget::DrawBitmap method

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

Syntax


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

Parameters

bitmap [in]

Type: ID2D1Bitmap*

The bitmap to render.

destinationRectangle [in, optional]

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; NULL to draw the selected portion of the bitmap at the origin of the render target. If the rectangle is specified but 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 an opacity value to apply to the bitmap; this value is multiplied against the alpha values of the bitmap's contents. The default value 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 be drawn; 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]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1RenderTarget
How to Draw a Bitmap
How to Load a Bitmap from a Resource
How to Load a Bitmap from a File

 

 

Show:
© 2017 Microsoft