D3DXLoadSurfaceFromMemory
Loads a surface from memory.
HRESULT D3DXLoadSurfaceFromMemory(
LPDIRECT3DSURFACE8 pDestSurface,
CONST PALETTEENTRY* pDestPalette,
CONST RECT* pDestRect,
LPCVOID pSrcMemory,
D3DFORMAT SrcFormat,
UINT SrcPitch,
CONST PALETTEENTRY* pSrcPalette,
CONST RECT* pSrcRect,
DWORD Filter,
D3DCOLOR ColorKey
);
Parameters
- pDestSurface
- [in] Pointer to an IDirect3DSurface8 interface. Specifies the destination surface, which receives the image.
- pDestPalette
- [in] Pointer to a PALETTEENTRY structure, the destination palette of 256 colors or NULL.
- pDestRect
- [in] Pointer to a RECT structure. Specifies the destination rectangle. Set this parameter to NULL to specify the entire surface.
- pSrcMemory
- [in] Pointer to the top-left corner of the source image in memory.
- SrcFormat
- [in] Member of the D3DFORMAT enumerated type, the pixel format of the source image.
- SrcPitch
- [in] Pitch of source image, in bytes. For DXT formats, this number should represent the width of one row of cells, in bytes.
- pSrcPalette
- [in] Pointer to a PALETTEENTRY structure, the source palette of 256 colors or NULL. See Remarks.
- pSrcRect
- [in] Pointer to a RECT structure. Specifies the dimensions of the source image in memory. This value cannot be NULL.
- Filter
- [in] A combination of one or more D3DX_FILTER flags controlling how the image is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER.
- ColorKey
- [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 colorkeys. Thus, for opaque black, the value would be equal to 0xFF000000.
Return Values
If the function succeeds, the return value is D3D_OK.
If the function fails, the return value can be one of the following values.
Remarks
This function handles conversion to and from compressed texture formats.
Writing to a non-level-zero surface will not cause the dirty rectangle to be updated. If D3DXLoadSurfaceFromMemory is called and the surface was not already dirty (this is unlikely under normal usage scenarios), the application needs to explicitly call IDirect3DTexture8::AddDirtyRect on the surface.
Requirements
Header: Declared in D3dx8tex.h.
Import Library: Use D3dx8.lib.