Microsoft DirectX 8.1 (Visual Basic)

D3DX8.CreateTextureFromFileInMemoryEx

Creates a texture from a file in memory. This is a more advanced method than D3DX8.CreateTextureFromFileInMemory.

object.CreateTextureFromFileInMemoryEx( _ 
    Device As Direct3DDevice8, _ 
    SrcData As Any, _ 
    LengthInBytes As Long, _ 
    Width As Long, _ 
    Height As Long, _ 
    MipLevels As Long, _ 
    Usage As Long, _ 
    Format As CONST_D3DFORMAT, _ 
    Pool As CONST_D3DPOOL, _ 
    Filter As Long, _ 
    MipFilter As Long, _ 
    ColorKey As Long, _ 
    SrcInfo As Any, _ 
    Palette As Any) As Direct3DTexture8

Parts

object
Object expression that resolves to a D3DX8 object.
Device
Direct3DDevice8 object representing the device to be associated with the texture.
SrcData
File in memory from which to create the texture.
LengthInBytes
Size of the file in memory, in bytes.
Width
Width in pixels. If this value is zero or D3DX_DEFAULT as defined by the CONST_D3DXENUM enumeration, the dimensions are taken from the file.
Height
Height, in pixels. If this value is zero or D3DX_DEFAULT as defined by the CONST_D3DXENUM enumeration, the dimensions are taken from the file.
MipLevels
Number of mip levels requested. If this value is zero or D3DX_DEFAULT as defined by the CONST_D3DXENUM enumeration, a complete mipmap chain is created.
Usage
0 or the D3DUSAGE_RENDERTARGET member of the CONST_D3DUSAGEFLAGS enumeration. Specifying D3DUSAGE_RENDERTARGET indicates that the surface is to be used as a render target. The resource can be passed to the NewRenderTarget parameter of the SetRenderTarget method. If D3DUSAGE_RENDERTARGET is specified, the application should check that the device supports this operation by calling Direct3D8.CheckDeviceFormat.
Format
Member of the CONST_D3DFORMAT enumeration, describing the requested pixel format for the texture. The returned texture might have a format different from that specified by Format. Applications should check the format of the returned texture. If Format is D3DFMT_UNKNOWN, the format is taken from the file.
Pool
Member of the CONST_D3DPOOL enumeration, describing the memory class into which the texture should be placed.
Filter
A combination of one or more filter flags defined by the CONST_D3DXENUM enumeration, controlling how the image is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_DITHER Or D3DX_FILTER_TRIANGLE.
MipFilter
A combination of one or more mip filter flags defined by the CONST_D3DXENUM enumeration, controlling how the image is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_BOX.
ColorKey
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 colorkeys. Thus, for opaque black, the value would be equal to &HFF000000.
SrcInfo
A D3DXIMAGE_INFO structure to be filled with a description of the data in the source image file, or ByVal 0.
Palette
The first element of an array of 256 PALETTEENTRY types to fill in, or ByVal 0.

Return Values

Direct3DTexture8 object representing the created texture.

Error Codes

If the method fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
D3DERR_NOTAVAILABLE
D3DERR_OUTOFVIDEOMEMORY
D3DXERR_INVALIDDATA
E_OUTOFMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

This method is designed to be used for loading image files stored as RT_RCDATA, which is an application-defined resource (raw data). Otherwise this method fails.