|Microsoft DirectX 9.0|
Creates a texture from a file in memory. This is a more advanced function than D3DXCreateTextureFromFileInMemory.
LPDIRECT3DDEVICE9 pDevice, LPCVOID pSrcData, UINT SrcDataSize, UINT Width, UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DTEXTURE9 *ppTexture );
- [in] Pointer to an IDirect3DDevice9 interface, representing the device to be associated with the texture.
- [in] Pointer to the file in memory from which to create the texture.
- [in] Size of the file in memory, in bytes.
- [in] Width in pixels. If this value is zero or D3DX_DEFAULT, the dimensions are taken from the file.
- [in] Height, in pixels. If this value is zero or D3DX_DEFAULT, the dimensions are taken from the file.
- [in] Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created.
- [in] 0, D3DUSAGE_RENDERTARGET, or D3DUSAGE_DYNAMIC. Setting this flag to D3DUSAGE_RENDERTARGET indicates that the surface is to be used as a render target. The resource can then be passed to the pNewRenderTarget parameter of the IDirect3DDevice9::SetRenderTarget method. If either D3DUSAGE_RENDERTARGET or D3DUSAGE_DYNAMIC is specified, Pool must be set to D3DPOOL_DEFAULT, and the application should check that the device supports this operation by calling IDirect3D9::CheckDeviceFormat. For more information about using dynamic textures, see Using Dynamic Textures.
- [in] Member of the D3DFORMAT enumerated type, describing the requested pixel format for the texture. The returned texture might have a different format from that specified by Format. Applications should check the format of the returned texture. If Format is D3DFMT_UNKNOWN, the format is taken from the file.
- [in] Member of the D3DPOOL enumerated type, describing the memory class into which the texture should be placed.
- [in] Combination of one or more flags controlling how the image is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER. Each valid filter must contain one of the flags in D3DX_FILTER.
- [in] Combination of one or more flags controlling how the image is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_BOX. Each valid filter must contain one of the flags in D3DX_FILTER.
- [in] D3DCOLOR value to replace with transparent black, or 0 to disable the colorkey. This is always a 32-bit ARGB color, independent of the source image format. Alpha is significant and should usually be set to FF for opaque color keys. Thus, for opaque black, the value would be equal to 0xFF000000.
- [in, out] Pointer to a D3DXIMAGE_INFO structure to be filled with a description of the data in the source image file, or NULL.
- [out] Pointer to a PALETTEENTRY structure, representing a 256-color palette to fill in, or NULL. See Remarks.
- [out] Address of a pointer to an IDirect3DTexture9 interface, representing the created texture object.
If the function succeeds, the return value is D3D_OK.
If the function fails, the return value can be one of the following values.
D3DERR_NOTAVAILABLE This device does not support the queried technique. D3DERR_OUTOFVIDEOMEMORY Microsoft?Direct3D?does not have enough display memory to perform the operation. D3DERR_INVALIDCALL The method call is invalid. For example, a method's parameter may have an invalid value. D3DXERR_INVALIDDATA The data is invalid. E_OUTOFMEMORY Direct3D could not allocate sufficient memory to complete the call.
This function supports the following file formats: .bmp, .dds, .dib, .jpg, .png, and .tga.
For details about PALETTEENTRY, see the Microsoft Platform Software Development Kit (SDK). Note that as of Microsoft DirectX?8.0, the peFlags member of the PALETTEENTRY structure does not function as documented in the Platform SDK. The peFlags member is now the alpha channel for 8-bit palletized formats.
Header d3dx9tex.h Import library d3dx9.lib Minimum operating systems Windows 98