Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function loads a surface from a file.

Syntax

HRESULT WINAPI D3DMXLoadSurfaceFromFileW(
  LPDIRECT3DMOBILESURFACE 
pDestSurface,
  CONST PALETTEENTRY*	 
pDestPalette,
  CONST RECT*			 
pDestRect,
  LPCWSTR				 
pSrcFile,
  CONST RECT*			 
pSrcRect,
  DWORD				 
Filter,
  D3DMCOLOR			 
ColorKey,
  D3DMXIMAGE_INFO*	
pSrcInfo
);
#define D3DMXLoadSurfaceFromFile D3DMXLoadSurfaceFromFileW

Parameters

pDestSurface

[in] Pointer to an IDirect3DMobileSurfaceinterface. Specifies the destination surface, which receives the image.

pDestPalette

[in] Pointer to a PALETTEENTRYstructure, the destination palette of 256 colors or NULL.

pDestRect

[in] Pointer to a RECTstructure. Specifies the destination rectangle. Set this parameter to NULL to specify the entire surface.

pSrcFile

[in] Pointer to a string that specifies the filename.

pSrcRect

[in] Pointer to a RECTstructure. Specifies the source rectangle. Set this parameter to NULL to specify the entire image.

Filter

[in] A combination of one or more flags from the D3DMX_FILTER Valuesto control how the image is filtered. Specifying D3DMX_DEFAULT for this parameter is the equivalent of specifying D3DMX_FILTER_TRIANGLE | D3DMX_FILTER_DITHER.

ColorKey

[in] A D3DMCOLORvalue 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] A pointer to a D3DMXIMAGE_INFOstructure to be filled with a description of the data in the source image file, or NULL.

Return Value

If the function succeeds, the return value is D3DM_OK (see D3DM Values).

If the function fails, the return value can be one of the following values.

Value Description

D3DERR_INVALIDCALL

The method call is invalid. For example, a method's parameter may have an invalid value.

D3DXERR_INVALIDDATA

The data is invalid.

Remarks

This function supports the following file formats: .bmp, .dds, .dib, .jpg, .png, and .tga.

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 D3DMXLoadSurfaceFromFileis called and the surface was not already dirty (this is unlikely under normal usage scenarios), the application needs to explicitly call IDirect3DMobileTexture::AddDirtyRecton the surface.

Requirements

Header d3dmx.h
Library D3dmx.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also