D3DXLoadSurfaceFromResource function
Loads a surface from a resource.
Syntax
HRESULT D3DXLoadSurfaceFromResource(
_In_ LPDIRECT3DSURFACE9 pDestSurface,
_In_ const PALETTEENTRY *pDestPalette,
_In_ const RECT *pDestRect,
_In_ HMODULE hSrcModule,
_In_ LPCTSTR pSrcResource,
_In_ const RECT *pSrcRect,
_In_ DWORD Filter,
_In_ D3DCOLOR ColorKey,
_Inout_ D3DXIMAGE_INFO *pSrcInfo
);
Parameters
-
pDestSurface [in]
-
Type: LPDIRECT3DSURFACE9
Pointer to an IDirect3DSurface9 interface. Specifies the destination surface, which receives the image.
-
pDestPalette [in]
-
Type: const PALETTEENTRY*
Pointer to a PALETTEENTRY structure, the destination palette of 256 colors or NULL.
-
pDestRect [in]
-
Type: const RECT*
Pointer to a RECT structure. Specifies the destination rectangle. Set this parameter to NULL to specify the entire surface.
-
hSrcModule [in]
-
Type: HMODULE
Handle to the module where the resource is located, or NULL for module associated with the image the operating system used to create the current process.
-
pSrcResource [in]
-
Type: LPCTSTR
Pointer to a string that specifies the resource name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
-
pSrcRect [in]
-
Type: const RECT*
Pointer to a RECT structure. Specifies the source rectangle. Set this parameter to NULL to specify the entire image.
-
Filter [in]
-
Type: DWORD
Combination of one or more D3DX_FILTER 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]
-
Type: D3DCOLOR
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.
-
pSrcInfo [in, out]
-
Type: D3DXIMAGE_INFO*
Pointer to a D3DXIMAGE_INFO structure to be filled with a description of the data in the source image file, or NULL.
Return value
Type: HRESULT
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_INVALIDCALL, D3DXERR_INVALIDDATA.
Remarks
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to D3DXLoadSurfaceFromResourceW. Otherwise, the function call resolves to D3DXLoadSurfaceFromResourceA because ANSI strings are being used.
The resource being loaded must be of type RT_BITMAP or RT_RCDATA. Resource type RT_RCDATA is used to load formats other than bitmaps (such as .tga, .jpg, and .dds).
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 D3DXLoadSurfaceFromFile is called and the surface was not already dirty (this is unlikely under normal usage scenarios), the application needs to explicitly call AddDirtyRect on the surface.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|
See also