Windows apps
Collapse the table of content
Expand the table of content
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.

ID2D1Bitmap::CopyFromBitmap method

Copies the specified region from the specified bitmap into the current bitmap.


virtual HRESULT CopyFromBitmap(
  [in, optional] const D2D1_POINT_2U *destPoint,
  [in]                 ID2D1Bitmap   *bitmap,
  [in, optional] const D2D1_RECT_U   *srcRect
) = 0;


destPoint [in, optional]

Type: const D2D1_POINT_2U*

In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.

bitmap [in]

Type: ID2D1Bitmap*

The bitmap to copy from.

srcRect [in, optional]

Type: const D2D1_RECT_U*

The area of bitmap to copy.

Return value


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


This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap formats do not match.

Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing HRESULT and tag state will be returned at the next call to EndDraw or Flush.

Starting with Windows 8.1, this method supports block compressed bitmaps. If you are using a block compressed format, the end coordinates of the srcRect parameter must be multiples of 4 or the method returns E_INVALIDARG.


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]







See also




© 2017 Microsoft