其他分享
首页 > 其他分享> > IDirect3DDevice9 StretchRect

IDirect3DDevice9 StretchRect

作者:互联网

 

IDirect3DDevice9::StretchRect

Copy the contents of the source rectangle to the destination rectangle. The source rectangle can be stretched and filtered by the copy. This function is often used to change the aspect ratio of a video stream.

HRESULT StretchRect(
  IDirect3DSurface9 * pSourceSurface,
  CONST RECT * pSourceRect,
  IDirect3DSurface9 * pDestSurface,
  CONST RECT * pDestRect,
  D3DTEXTUREFILTERTYPE Filter
);

Parameters

pSourceSurface
[in] Pointer to the source surface. See IDirect3DSurface9.
pSourceRect
[in] Pointer to the source rectangle. A NULL for this parameter causes the entire source surface to be used.
pDestSurface
[in] Pointer to the destination surface. See IDirect3DSurface9.
pDestRect
[in] Pointer to the destination rectangle. A NULL for this parameter causes the entire destination surface to be used.
Filter
[in] Filter type. Allowable values are D3DTEXF_NONE, D3DTEXF_POINT, or D3DTEXF_LINEAR. For more information, see D3DTEXTUREFILTERTYPE.

Return Values

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be: D3DERR_INVALIDCALL.

Remarks

StretchRect Restrictions

Additional Restrictions for Depth and Stencil Surfaces

Using StretchRect to downsample a Multisample Rendertarget

You can use StretchRect to copy from one rendertarget to another. If the source rendertarget is multisampled, this results in downsampling the source rendertarget. For instance you could:

Note that use of the extra surface involved in using StretchRect to downsample a Multisample Rendertarget will result in a performance hit.

Driver Support

There are many restrictions as to which surface combinations are valid for StretchRect. Factors include whether the driver is a Direct3D 9 driver or older, and whether the operation will result in stretching/shrinking. Since applications are not expected to recognize if the driver is a Direct3D 9 driver or not, the runtime will automatically set a new cap, D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES cap (see D3DDEVCAPS2), for Direct3D 9-level drivers and above.

DirectX 8 Driver (no stretching)     
  Dest formats   
  TextureRT textureRTOff-screen plain
Src formatsTexture No No No No
 RT texture No Yes Yes No
 RT No Yes Yes No
 Off-screen plain Yes Yes Yes Yes
DirectX 8 Driver (stretching)     
  Dest formats   
  TextureRT textureRTOff-screen plain
Src formatsTexture No No No No
 RT texture No No No No
 RT No Yes Yes No
 Off-screen plain No Yes Yes No
Direct3D 9 Driver (no stretching)     
  Dest formats   
  TextureRT textureRTOff-screen plain
Src formatsTexture No Yes Yes No
 RT texture No Yes Yes No
 RT No Yes Yes No
 Off-screen plain No Yes Yes Yes
Direct3D 9 Driver (stretching)     
  Dest formats   
  TextureRT textureRTOff-screen plain
Src formatsTexture No Yes Yes No
 RT texture No Yes Yes No
 RT No Yes Yes No
 Off-screen plain No Yes Yes No

Requirements

Header: Declared in D3D9.h.

Library: Use D3D9.lib.

See Also

IDirect3DDevice9::BeginScene, IDirect3DDevice9::EndScene

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

标签:IDirect3DDevice9,No,plain,destination,surface,source,Yes,StretchRect
来源: https://www.cnblogs.com/skiwnchiwns/p/10345555.html