D3DMXLoadSurfaceFromResource (Windows Embedded CE 6.0)

1/6/2010

This function loads a surface from a resource.

Syntax

HRESULT WINAPI D3DMXLoadSurfaceFromResourceW(
  LPDIRECT3DMOBILESURFACE pDestSurface,
  CONST PALETTEENTRY*     pDestPalette,
  CONST RECT*             pDestRect,
  HMODULE                 hSrcModule,
  LPCWSTR                 pSrcResource,
  CONST RECT*             pSrcRect,
  DWORD                   Filter,
  D3DMCOLOR               ColorKey,
  D3DMXIMAGE_INFO*        pSrcInfo
);
#define D3DMXLoadSurfaceFromResource D3DMXLoadSurfaceFromResourceW

Parameters

  • pDestSurface
    [in] Pointer to an IDirect3DMobileSurface 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.
  • pSrcModule
    [in] 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] Pointer to a string that specifies the resource name.
  • pSrcRect
    [in] Pointer to a RECT structure. 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 Values to 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 D3DMCOLOR 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] A pointer to a D3DMXIMAGE_INFO structure 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

The resource being loaded must be of type RT_BITMAP or RT_RCDATA (see FindResource). 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 D3DMXLoadSurfaceFromFile is called and the surface was not already dirty (this is unlikely under normal usage scenarios), the application needs to explicitly call IDirect3DMobileTexture::AddDirtyRect on the surface.

Requirements

Header d3dmx.h
Library D3dmx.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

D3DMX Functions
IDirect3DMobileSurface
D3DMX_FILTER Values
D3DMCOLOR
D3DMXIMAGE_INFO
D3DM Values
IDirect3DMobileTexture::AddDirtyRect

Other Resources

PALETTEENTRY
RECT
FindResource