D3DXSaveSurfaceToFile
Saves a surface to a file.
HRESULT D3DXSaveSurfaceToFile(
LPCTSTR pDestFile,
D3DXIMAGE_FILEFORMAT DestFormat,
LPDIRECT3DSURFACE9 pSrcSurface,
CONST PALETTEENTRY * pSrcPalette,
CONST RECT * pSrcRect
);
Parameters
- pDestFile
- [in] Pointer to a string that specifies the file name of the destination image. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
- DestFormat
- [in] D3DXIMAGE_FILEFORMAT specifying the file format to use when saving. This function supports saving to all D3DXIMAGE_FILEFORMAT formats except Portable Pixmap (.ppm) and Targa/Truevision Graphics Adapter (.tga).
- pSrcSurface
- [in] Pointer to IDirect3DSurface9 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
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to D3DXSaveSurfaceToFileW. Otherwise, the function call resolves to D3DXSaveSurfaceToFileA because ANSI strings are being used.
This function handles conversion to and from compressed texture formats.
Requirements
Header: Declared in D3dx9tex.h.
See Also
D3DXSaveTextureToFile, D3DXSaveVolumeToFile