Microsoft DirectX 8.1 (C++)

D3DXSaveTextureToFile

Saves a texture to a file.

HRESULT D3DXSaveTextureToFile(
  LPCTSTR                  pDestFile,
  D3DXIMAGE_FILEFORMAT     DestFormat,
  LPDIRECT3DBASETEXTURE8   pSrcTexture,
  CONST PALETTEENTRY*      pSrcPalette
);

Parameters

pDestFile
[in] File name in which to save the texture.
DestFormat
[in] D3DXIMAGE_FILEFORMAT specifying the file format to use when saving.
pSrcTexture
[in] Pointer to IDirect3DTexture8 interface, containing the texture to be saved.
pSrcPalette
[in] Pointer to a PALETTEENTRY structure containing a palette of 256 colors. This parameter can be NULL.

Return Values

If the function succeeds, the return value is D3D_OK.

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

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.

If the volume is nondynamic (because of a usage parameter set to 0 at the creation) and located in video memory (the memory pool set to D3DPOOL_DEFAULT), D3DXSaveTextureToFile will fail because Direct3DX cannot lock nondynamic volumes located in video memory.

Requirements

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

See Also

D3DXSaveSurfaceToFile, D3DXSaveVolumeToFile