Microsoft DirectX 8.1 (Visual Basic)

D3DX8.LoadSurfaceFromFileInMemory

Loads a surface from a file in memory.

object.LoadSurfaceFromFileInMemory( _ 
    DestSurface As Direct3DSurface8, _ 
    DestPalette As Any, _ 
    DestRect As Any, _ 
    SrcData As Any, _ 
    LengthInBytes As Long, _ 
    SrcRect As Any, _ 
    Filter As Long, _ 
    ColorKey As Long, _ 
    SrcInfo As Any)

Parts

object
Object expression that resolves to a D3DX8 object.
DestSurface
Direct3DSurface8 object. Specifies the destination surface, which receives the image.
DestPalette
The first element of an array of 256 PALETTEENTRY types, representing the destination palette, or ByVal 0.
DestRect
RECT type. Specifies the destination rectangle. Set this parameter to ByVal 0 to specify the entire surface.
SrcData
File in memory from which to load the surface.
LengthInBytes
Size of the file in memory, in bytes.
SrcRect
A RECT type. Specifies the source rectangle. Set this parameter to ByVal 0 to specify the entire image.
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.
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.

Error Codes

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

D3DERR_INVALIDCALL
D3DXERR_INVALIDDATA

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

Remarks

Writing to a non-level-zero surface of the texture does not cause the dirty rectangle to be updated. If D3DX8.LoadSurfaceFromFileInMemory is called and the surface was not already dirty—this is unlikely under normal use scenarios—the application must explicitly call Direct3DTexture8.AddDirtyRect on the texture.