Share via


D3DMXCreateTextureFromResourceEx (Windows Embedded CE 6.0)

1/6/2010

This function creates a texture object from a resource.

Syntax

HRESULT WINAPI D3DMXCreateTextureFromResourceExW(
  LPDIRECT3DMOBILEDEVICE   pDevice,
  HMODULE                  hSrcModule,
  LPCWSTR                  pSrcResource,
  UINT                     Width,
  UINT                     Height,
  UINT                     MipLevels,
  DWORD                    Usage,
  D3DMFORMAT               Format,
  D3DMPOOL                 Pool,
  DWORD                    Filter,
  DWORD                    MipFilter,
  D3DMCOLOR                ColorKey,
  D3DMXIMAGE_INFO*         pSrcInfo,
  PALETTEENTRY*            pPalette,
  LPDIRECT3DMOBILETEXTURE* ppTexture
);
#define D3DMXCreateTextureFromResourceEx
D3DMXCreateTextureFromResourceExW

Parameters

  • pDevice
    [in] Pointer to an IDirect3DMobileDevice interface, representing the device to be associated with the texture.
  • hSrcModule
    [in] An HMODULE value that is the 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.
  • Width
    [in] A UINT value that specifies the width of the texture in pixels. If this value is zero or D3DMX_DEFAULT, the dimensions are taken from the file.
  • Height
    [in] A UINT value that specifies the height of the texture in pixels. If this value is zero or D3DMX_DEFAULT, the dimensions are taken from the file.
  • MipLevels
    [in] A UINT value that specifies the number of mip levels requested. If this value is zero or D3DMX_DEFAULT, a complete mipmap chain is created.
  • Usage
    [in] A DWORD value that is either 0, D3DMUSAGE_RENDERTARGET, or D3DMUSAGE_DYNAMIC (see D3DMUSAGE Values). Setting this flag to D3DUSAGE_RENDERTARGET indicates that the surface is to be used as a render target. The resource can then be passed to the pNewRenderTarget parameter of the IDirect3DMobileDevice::SetRenderTarget method. If either D3DMUSAGE_RENDERTARGET or D3DMUSAGE_DYNAMIC is specified, the Pool parameter must be set to D3DMPOOL_DEFAULT, and the application should check that the device supports this operation by calling IDirect3DMobile::CheckDeviceFormat. D3DMUSAGE_DYNAMIC indicates that the surface should be handled dynamically.
  • Format
    [in] An element of the D3DMFORMAT enumerated type, describing the requested pixel format for the texture. The returned texture might have a different format from that specified by Format. Applications should check the format of the returned texture. If Format is D3DMFMT_UNKNOWN, the format is taken from the file.
  • Pool
    [in] An element of the D3DMPOOL enumerated type, describing the memory class into which the texture should be placed.
  • Filter
    [in] A combination of one or more D3DMX_FILTER Values controlling how the image is filtered. Specifying D3DMX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER.
  • MipFilter
    [in] A combination of one or more D3DMX_FILTER values controlling how the image is filtered. Specifying D3DMX_DEFAULT for this parameter is the equivalent of specifying D3DMX_FILTER_BOX.
  • 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] Pointer to a D3DMXIMAGE_INFO structure to be filled in with a description of the data in the source image file, or NULL.
  • pPalette
    [out] Pointer to a PALETTEENTRY structure, representing a 256-color palette to fill in, or NULL.
  • ppTexture
    [out] Address of a pointer to an IDirect3DMobileTexture interface, representing the created texture object.

Return Value

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

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

Value Description

D3DERR_NOTAVAILABLE

This device does not support the queried technique.

D3DERR_OUTOFVIDEOMEMORY

Microsoft® Direct3D® Mobile does not have enough display memory to perform the operation.

D3DERR_INVALIDCALL

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

D3DXERR_INVALIDDATA

The data is invalid.

E_OUTOFMEMORY

Direct3D Mobile could not allocate sufficient memory to complete the call.

Remarks

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

Requirements

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

See Also

Reference

D3DMX Functions
IDirect3DMobileDevice
D3DMUSAGE Values
IDirect3DMobileDevice::SetRenderTarget
IDirect3DMobile::CheckDeviceFormat
D3DMFORMAT
D3DMPOOL
D3DMX_FILTER Values
D3DMCOLOR
D3DMXIMAGE_INFO
IDirect3DMobileTexture
D3DM Values

Other Resources

PALETTEENTRY