Microsoft DirectX 8.1 (C++)

D3DXSaveSurfaceToFile

Saves a surface to a file.

HRESULT D3DXSaveSurfaceToFile(
  LPCTSTR              pDestFile,
  D3DXIMAGE_FILEFORMAT DestFormat,
  LPDIRECT3DSURFACE8   pSrcSurface,
  CONST PALETTEENTRY*  pSrcPalette,
  CONST RECT*          pSrcRect
);

Parameters

pDestFile
[in] File name to save the surface to.
DestFormat
[in] D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
pSrcSurface
[in] Pointer to IDirect3DSurface8 interface, containing the image to be saved.
pSrcPalette
[in] Pointer to a PALETTEENTRY structure containing a palette of 256 colors. This parameter can be NULL.
pSrcRect
[in] Pointer to a RECT structure. Specifies the source rectangle. Set this parameter to NULL to specify the entire image.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be the following.

D3DERR_INVALIDCALL

Remarks

This function supports the following file formats: .bmp and .dds.

This function handles conversion to and from compressed texture formats.

This function supports both Unicode and ANSI strings.

Requirements

Header: Declared in D3dx8tex.h.
Import Library: Use D3dx8.lib.

See Also

D3DXSaveTextureToFile, D3DXSaveVolumeToFile