A version of this page is also available for

Windows Embedded CE 6.0 R3


This method copies rectangular subsets of pixels from one surface to another.


HRESULT CopyRects(
  IDirect3DMobileSurface* pSourceSurface,
  CONST RECT* pSourceRectsArray,
  UINT cRects,
  IDirect3DMobileSurface* pDestinationSurface,
  CONST POINT* pDestPointsArray


  • pSourceSurface
    [in] Pointer to an IDirect3DMobileSurface interface, which represents the source surface. This parameter must point to a different surface than pDestinationSurface.
  • pSourceRectsArray
    [in] Pointer to an array of RECT structures, which represents the rectangles to be transferred. Each rectangle will be transferred to the destination surface, with its top-left pixel at the position identified by the corresponding element of pDestPointsArray. Specifying NULL for this parameter causes the entire surface to be copied.
  • cRects
    [in] Number of RECT structures contained in pSourceRectsArray.
  • pDestinationSurface
    [in] Pointer to an IDirect3DMobileSurface interface, which represents the destination surface. This parameter must point to a different surface than pSourceSurface.
  • pDestPointsArray
    [in] Pointer to an array of POINT structures, which identifies the top-left pixel position of each rectangle contained in pSourceRectsArray. If this parameter is NULL, the RECTs are copied to the same offset (same top/left location) as the source rectangle.

Return Value

If the method succeeds, the return value is D3DM_OK (see D3DM Values).

If the method fails, the return value can be one of the following D3DMERR Values.



This method does not support stretch, color key, alpha blend, format conversion, or clipping of either source or destination rectangles. Note that this method will fail unless all the source rectangles and their corresponding destination rectangles are completely contained within the source and destination surfaces respectively. The format of the two surfaces must match, but they can have different dimensions.

If the destination surface is level zero of a texture, then it will be marked dirty. For more information, see IDirect3DMobileDevice::UpdateTexture and IDirect3DMobileTexture::AddDirtyRect.

This method cannot be applied to surfaces whose formats are classified as depth stencil formats.


Header d3dm.h
Library D3dm.lib, D3dmguid.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also



Other Resources