Microsoft DirectX 8.1 (Visual Basic)

Copying To Surfaces

When using the Direct3DDevice8.CopyRects method, you pass the first element of an array of rectangles on the source surface or Nothing to specify the entire surface. You also pass an array of points on the destination surface to which the top-left-position of each rectangle on the source image is copied. You can pass ByVal 0 to copy the rectangles with the same top-left position as the source. This method does not support clipping. The operation will fail unless all the source rectangles and their corresponding destination rectangles are completely contained within the source and destination surfaces respectively. This method does not support alpha blending, color keys, or format conversion. Note that the source and destination surfaces must be distinct.

CopyRects Example

The following example copies two rectangles from the source surface to a destination surface. The first rectangle is copied from (0, 0, 50, 50) on the source surface to the same location on the destination surface, and the second rectangle is copied from (50, 50, 100, 100) on the source surface to (150 ,150, 200, 200) on the destination surface.

'The following assumptions are made:
'-d3dDevice is a valid IDirect3DDevice8 object.
'-Source and Dest are valid Direct3DSurface8 objects.

Dim rcSource(1) As RECT
Dim ptDest(1) As Point

rcSource(0).left = 0
rcSource(0).top = 0
rcSource(0).right= 0
rcSource(0).bottom = 0

rcSource(1).left = 50
rcSource(1).top = 50
rcSource(1).right = 100
rcSource(1).bottom = 100

ptDest(0).x = 0
ptDest(0).y = 0

ptDest(1).x = 150
ptDest(1).y = 150

d3dDevice.CopyRects Source, rcSource, 2, Dest, ptDest

The following methods are also available in Microsoft® Visual Basic® for copying images to a Microsoft Direct3D® surface.