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 another surface, with color conversion.

Syntax

HRESULT WINAPI D3DMXLoadSurfaceFromSurface(
  LPDIRECT3DMOBILESURFACE 
pDestSurface,
  CONST PALETTEENTRY*	 
pDestPalette,
  CONST RECT*			 
pDestRect,
  LPDIRECT3DMOBILESURFACE 
pSrcSurface,
  CONST PALETTEENTRY*	 
pSrcPalette,
  CONST RECT*			 
pSrcRect,
  DWORD				 
Filter,
  D3DMCOLOR			 
ColorKey
);

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.

pSrcData

[in] An LPCVOID pointer to a file in memory.

SrcDataSize

[in] A UINT value that indicates the size, in bytes, of the file in memory.

pSrcSurface

[in] A pointer to an IDirect3DMobileSurface interface for the source surface.

pSrcPalette

[in] A pointer to a PALETTEENTRYstructure, the source palette of 256 colors or NULL.

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.

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 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