D3DX10SaveTextureToFile function

Save a texture to a file.

Syntax

HRESULT D3DX10SaveTextureToFile(
  _In_ ID3D10Resource           *pSrcTexture,
  _In_ D3DX10_IMAGE_FILE_FORMAT DestFormat,
  _In_ LPCTSTR                  pDestFile
);

Parameters

pSrcTexture [in]

Type: ID3D10Resource*

Pointer to the texture to be saved. See ID3D10Resource Interface.

DestFormat [in]

Type: D3DX10_IMAGE_FILE_FORMAT

The format the texture will be saved as (see D3DX10_IMAGE_FILE_FORMAT). D3DX10_IFF_DDS is the preferred format since it is the only option that supports all the formats in DXGI_FORMAT.

pDestFile [in]

Type: LPCTSTR

Name of the destination output file where the texture will be saved. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the data type resolves to LPCSTR.

Return value

Type: HRESULT

The return value is one of the values listed in Direct3D 10 Return Codes; use the return value to see if the DestFormat is supported.

Remarks

D3DX10SaveTextureToFile writes out the extra DDS_HEADER_DXT10 structure for the input texture only if necessary (for example, because the input texture is in standard RGB (sRGB) format). If D3DX10SaveTextureToFile writes out the DDS_HEADER_DXT10 structure, it sets the dwFourCC member of the DDS_PIXELFORMAT structure for the texture to DX10 to indicate the prescense of the DDS_HEADER_DXT10 extended header.

Requirements

Requirement Value
Header
D3DX10Tex.h
Library
D3DX10.lib

See also

Texture Functions in D3DX 10

General Purpose Functions