CopyRect method

Copies the specified number of samples from the specified rectangle in the source surface to the current position on the output surface.


void retVal = object.CopyRect(pScratchBuffer, pDestRect, pSrc, pSrcOrigin, bIsOpaque);


  • pScratchBuffer [in]
    Type: [DXBASESAMPLE](aa743779(v=vs.85).md)

    Pointer to a buffer that can be used by the method. The initial contents of the buffer are ignored, and the contents are undefined when the call returns the buffer. The buffer must be at least [ (pDestRect.right - pDestRect.left) * sizeof(DXBASESAMPLE) ] bytes in size. If the surface pixel format is either ARGB32 or PMARGB32, this buffer is not required and pScratchBuffer can be NULL.

  • pDestRect [in]
    Type: const RECT

    Pointer to the region to copy to, relative to the locked region in the output surface. If this parameter is NULL, the entire locked region is used.

  • pSrc [in]
    Type: [IDXARGBReadPtr](aa743694(v=vs.85).md)

    Pointer to an IDXARGBReadPtr interface for the source surface.

  • pSrcOrigin [in]
    Type: const POINT

    Pointer to the location at which the copy operation starts, relative to the locked source region. If this parameter is NULL, the point (0,0) relative to the locked source region is used.

  • bIsOpaque [in]
    Type: BOOL

    Value that specifies whether the samples are opaque or transparent. If TRUE, the caller guarantees that all the samples being copied have an alpha channel value of 255. In some cases this enables faster code performance. If you are not sure that all samples are opaque, specify FALSE.


After this call is made, the current positions of both pointer objects are undefined. You must call IDXARGBReadPtr::MoveToRow, IDXARGBReadPtr::MoveAndGetRunInfo, or IDXARGBReadPtr::MoveToXY to re-establish the pointer location before calling any of the following methods: IDXARGBReadPtr::Unpack, IDXARGBReadPtr::UnpackPremult, IDXARGBReadWritePtr::CopyAndMoveBoth, IDXARGBReadWritePtr::FillAndMove, IDXARGBReadWritePtr::PackAndMove, IDXARGBReadWritePtr::PackPremultAndMove, or IDXARGBReadWritePtr::OverArrayAndMove.