' ########################################################################################
' Microsoft Windows
' File: d3dx9tex.inc
' Contents: D3DX texturing APIs
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_d3dx9tex_PBI)
#DEFINE PBX_d3dx9tex_PBI
%EQUATE `D3DX9TEX_INC = 1
#INCLUDE ONCE "Legacy/Graphics/d3dx9.inc"
'//----------------------------------------------------------------------------
'// D3DX_FILTER flags:
'// ------------------
'//
'// A valid filter must contain one of these values:
'//
'// D3DX_FILTER_NONE
'// No scaling or filtering will take place. Pixels outside the bounds
'// of the source image are assumed to be transparent black.
'// D3DX_FILTER_POINT
'// Each destination pixel is computed by sampling the nearest pixel
'// from the source image.
'// D3DX_FILTER_LINEAR
'// Each destination pixel is computed by linearly interpolating between
'// the nearest pixels in the source image. This filter works best
'// when the scale on each axis is less than 2.
'// D3DX_FILTER_TRIANGLE
'// Every pixel in the source image contributes equally to the
'// destination image. This is the slowest of all the filters.
'// D3DX_FILTER_BOX
'// Each pixel is computed by averaging a 2x2(x2) box pixels from
'// the source image. Only works when the dimensions of the
'// destination are half those of the source. (as with mip maps)
'//
'// And can be OR'd with any of these optional flags:
'//
'// D3DX_FILTER_MIRROR_U
'// Indicates that pixels off the edge of the texture on the U-axis
'// should be mirrored, not wraped.
'// D3DX_FILTER_MIRROR_V
'// Indicates that pixels off the edge of the texture on the V-axis
'// should be mirrored, not wraped.
'// D3DX_FILTER_MIRROR_W
'// Indicates that pixels off the edge of the texture on the W-axis
'// should be mirrored, not wraped.
'// D3DX_FILTER_MIRROR
'// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V |
'// D3DX_FILTER_MIRROR_V
'// D3DX_FILTER_DITHER
'// Dithers the resulting image using a 4x4 order dither pattern.
'// D3DX_FILTER_SRGB_IN
'// Denotes that the input data is in sRGB (gamma 2.2) colorspace.
'// D3DX_FILTER_SRGB_OUT
'// Denotes that the output data is in sRGB (gamma 2.2) colorspace.
'// D3DX_FILTER_SRGB
'// Same as specifying D3DX_FILTER_SRGB_IN | D3DX_FILTER_SRGB_OUT
'//
'//----------------------------------------------------------------------------
%EQUATE `D3DX_FILTER_NONE = 1 ' (1 << 0)
%EQUATE `D3DX_FILTER_POINT = 2 ' (2 << 0)
%EQUATE `D3DX_FILTER_LINEAR = 3 ' (3 << 0)
%EQUATE `D3DX_FILTER_TRIANGLE = 4 ' (4 << 0)
%EQUATE `D3DX_FILTER_BOX = 5 ' (5 << 0)
%EQUATE `D3DX_FILTER_MIRROR_U = &H10000 ' (1 << 16)
%EQUATE `D3DX_FILTER_MIRROR_V = &H20000 ' (2 << 16)
%EQUATE `D3DX_FILTER_MIRROR_W = &H40000 ' (4 << 16)
%EQUATE `D3DX_FILTER_MIRROR = &H70000 ' (7 << 16)
%EQUATE `D3DX_FILTER_DITHER = &H80000 ' (1 << 19)
%EQUATE `D3DX_FILTER_DITHER_DIFFUSION = &H100000 ' (2 << 19)
%EQUATE `D3DX_FILTER_SRGB_IN = &H200000 ' (1 << 21)
%EQUATE `D3DX_FILTER_SRGB_OUT = &H400000 ' (2 << 21)
%EQUATE `D3DX_FILTER_SRGB = &H600000 ' (3 << 21)
'//-----------------------------------------------------------------------------
'// D3DX_SKIP_DDS_MIP_LEVELS is used to skip mip levels when loading a DDS file:
'//-----------------------------------------------------------------------------
%EQUATE `D3DX_SKIP_DDS_MIP_LEVELS_MASK = &H1F
%EQUATE `D3DX_SKIP_DDS_MIP_LEVELS_SHIFT = 26
'#define D3DX_SKIP_DDS_MIP_LEVELS(levels, filter) ((((levels) & D3DX_SKIP_DDS_MIP_LEVELS_MASK) << D3DX_SKIP_DDS_MIP_LEVELS_SHIFT) | ((filter) == D3DX_DEFAULT ? D3DX_FILTER_BOX : (filter)))
'//----------------------------------------------------------------------------
'// D3DX_NORMALMAP flags:
'// ---------------------
'// These flags are used to control how D3DXComputeNormalMap generates normal
'// maps. Any number of these flags may be OR'd together in any combination.
'//
'// D3DX_NORMALMAP_MIRROR_U
'// Indicates that pixels off the edge of the texture on the U-axis
'// should be mirrored, not wraped.
'// D3DX_NORMALMAP_MIRROR_V
'// Indicates that pixels off the edge of the texture on the V-axis
'// should be mirrored, not wraped.
'// D3DX_NORMALMAP_MIRROR
'// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V
'// D3DX_NORMALMAP_INVERTSIGN
'// Inverts the direction of each normal
'// D3DX_NORMALMAP_COMPUTE_OCCLUSION
'// Compute the per pixel Occlusion term and encodes it into the alpha.
'// An Alpha of 1 means that the pixel is not obscured in anyway, and
'// an alpha of 0 would mean that the pixel is completly obscured.
'//
'//----------------------------------------------------------------------------
%EQUATE `D3DX_NORMALMAP_MIRROR_U = &H10000 ' (1 << 16)
%EQUATE `D3DX_NORMALMAP_MIRROR_V = &H20000 ' (2 << 16)
%EQUATE `D3DX_NORMALMAP_MIRROR = &H30000 ' (3 << 16)
%EQUATE `D3DX_NORMALMAP_INVERTSIGN = &H80000 ' (8 << 16)
%EQUATE `D3DX_NORMALMAP_COMPUTE_OCCLUSION = &H100000 ' (16 << 16)
'//----------------------------------------------------------------------------
'// D3DX_CHANNEL flags:
'// -------------------
'// These flags are used by functions which operate on or more channels
'// in a texture.
'//
'// D3DX_CHANNEL_RED
'// Indicates the red channel should be used
'// D3DX_CHANNEL_BLUE
'// Indicates the blue channel should be used
'// D3DX_CHANNEL_GREEN
'// Indicates the green channel should be used
'// D3DX_CHANNEL_ALPHA
'// Indicates the alpha channel should be used
'// D3DX_CHANNEL_LUMINANCE
'// Indicates the luminaces of the red green and blue channels should be
'// used.
'//
'//----------------------------------------------------------------------------
%EQUATE `D3DX_CHANNEL_RED = 1 ' (1 << 0)
%EQUATE `D3DX_CHANNEL_BLUE = 2 ' (1 << 1)
%EQUATE `D3DX_CHANNEL_GREEN = 4 ' (1 << 2)
%EQUATE `D3DX_CHANNEL_ALPHA = 8 ' (1 << 3)
%EQUATE `D3DX_CHANNEL_LUMINANCE = 10 ' (1 << 4)
'//----------------------------------------------------------------------------
'// D3DXIMAGE_FILEFORMAT:
'// ---------------------
'// This enum is used to describe supported image file formats.
'//
'//----------------------------------------------------------------------------
%EQUATE `D3DXIFF_BMP = 0
%EQUATE `D3DXIFF_JPG = 1
%EQUATE `D3DXIFF_TGA = 2
%EQUATE `D3DXIFF_PNG = 3
%EQUATE `D3DXIFF_DDS = 4
%EQUATE `D3DXIFF_PPM = 5
%EQUATE `D3DXIFF_DIB = 6
%EQUATE `D3DXIFF_HDR = 7 ' //high dynamic range formats
%EQUATE `D3DXIFF_PFM = 8
%EQUATE `D3DXIFF_FORCE_DWORD = &H7FFFFFFF
'//----------------------------------------------------------------------------
'// LPD3DXFILL2D and LPD3DXFILL3D:
'// ------------------------------
'// Function types used by the texture fill functions.
'//
'// Parameters:
'// pOut
'// Pointer to a vector which the function uses to return its result.
'// X,Y,Z,W will be mapped to R,G,B,A respectivly.
'// pTexCoord
'// Pointer to a vector containing the coordinates of the texel currently
'// being evaluated. Textures and VolumeTexture texcoord components
'// range from 0 to 1. CubeTexture texcoord component range from -1 to 1.
'// pTexelSize
'// Pointer to a vector containing the dimensions of the current texel.
'// pData
'// Pointer to user data.
'//
'//----------------------------------------------------------------------------
'typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut,
' CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData);
' Prototype for the LPD3DXFILL2D callback function
' You need to declare a procedure like this one in your program and pass its address
' (with CODEPTR(LPD3DXFILL2D) to the function that requires it.
'SUB LPD3DXFILL2D ( ' BYREF pOut AS D3DXVECTOR4, ' BYREF pTexCoord AS D3DXVECTOR2, ' BYREF pTexelSize AS D3DXVECTOR2, ' BYVAL pData AS DWORD)
'END SUB
'typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut,
' CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData);
' Prototype for the LPD3DXFILL3D callback function
' You need to declare a procedure like this one in your program and pass its address
' (with CODEPTR(LPD3DXFILL3D) to the function that requires it.
'SUB LPD3DXFILL3D ( ' BYREF pOut AS D3DXVECTOR4, ' BYREF pTexCoord AS D3DXVECTOR3, ' BYREF pTexelSize AS D3DXVECTOR3, ' BYVAL pData AS DWORD)
'END SUB
'//----------------------------------------------------------------------------
'// D3DXIMAGE_INFO:
'// ---------------
'// This structure is used to return a rough description of what the
'// the original contents of an image file looked like.
'//
'// Width
'// Width of original image in pixels
'// Height
'// Height of original image in pixels
'// Depth
'// Depth of original image in pixels
'// MipLevels
'// Number of mip levels in original image
'// Format
'// D3D format which most closely describes the data in original image
'// ResourceType
'// D3DRESOURCETYPE representing the type of texture stored in the file.
'// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE.
'// ImageFileFormat
'// D3DXIMAGE_FILEFORMAT representing the format of the image file.
'//
'//----------------------------------------------------------------------------
' // Size = 28 bytes
TYPE D3DXIMAGE_INFO DWORD
 Width AS DWORD ' UINT
 Height AS DWORD ' UINT
 Depth AS DWORD ' UINT
 MipLevels AS DWORD ' UINT
 Format AS DWORD ' D3DFORMAT
 ResourceType AS DWORD ' D3DRESOURCETYPE
 ImageFileFormat AS DWORD ' D3DXIMAGE_FILEFORMAT
END TYPE
'//////////////////////////////////////////////////////////////////////////////
'// Image File APIs ///////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
';
'//----------------------------------------------------------------------------
'// GetImageInfoFromFile/Resource:
'// ------------------------------
'// Fills in a D3DXIMAGE_INFO struct with information about an image file.
'//
'// Parameters:
'// pSrcFile
'// File name of the source image.
'// pSrcModule
'// Module where resource is located, or NULL for module associated
'// with image the os used to create the current process.
'// pSrcResource
'// Resource name
'// pSrcData
'// Pointer to file in memory.
'// SrcDataSize
'// Size in bytes of file in memory.
'// pSrcInfo
'// Pointer to a D3DXIMAGE_INFO structure to be filled in with the
'// description of the data in the source image file.
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGetImageInfoFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXGetImageInfoFromFileA" (_
 BYREF pSrcFile AS ASCIIZ
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
DECLARE FUNCTION D3DXGetImageInfoFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXGetImageInfoFromFileW" (_
 BYREF pSrcFile AS WSTRINGZ
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXGetImageInfoFromFile = D3DXGetImageInfoFromFileW
#ELSE
 MACRO D3DXGetImageInfoFromFile = D3DXGetImageInfoFromFileA
#ENDIF
DECLARE FUNCTION D3DXGetImageInfoFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXGetImageInfoFromResourceA" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
DECLARE FUNCTION D3DXGetImageInfoFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXGetImageInfoFromResourceW" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXGetImageInfoFromResource = D3DXGetImageInfoFromResourceW
#ELSE
 MACRO D3DXGetImageInfoFromResource = D3DXGetImageInfoFromResourceA
#ENDIF
DECLARE FUNCTION D3DXGetImageInfoFromFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXGetImageInfoFromFileInMemory" (_
 BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
'//////////////////////////////////////////////////////////////////////////////
'// Load/Save Surface APIs ////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//----------------------------------------------------------------------------
'// D3DXLoadSurfaceFromFile/Resource:
'// ---------------------------------
'// Load surface from a file or resource
'//
'// Parameters:
'// pDestSurface
'// Destination surface, which will receive the image.
'// pDestPalette
'// Destination palette of 256 colors, or NULL
'// pDestRect
'// Destination rectangle, or NULL for entire surface
'// pSrcFile
'// File name of the source image.
'// pSrcModule
'// Module where resource is located, or NULL for module associated
'// with image the os used to create the current process.
'// pSrcResource
'// Resource name
'// pSrcData
'// Pointer to file in memory.
'// SrcDataSize
'// Size in bytes of file in memory.
'// pSrcRect
'// Source rectangle, or NULL for entire image
'// Filter
'// D3DX_FILTER flags controlling how the image is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
'// ColorKey
'// Color to replace with transparent black, or 0 to disable 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. (ex. Opaque black == 0xff000000)
'// pSrcInfo
'// Pointer to a D3DXIMAGE_INFO structure to be filled in with the
'// description of the data in the source image file, or NULL.
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXLoadSurfaceFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadSurfaceFromFileA" (_
 BYVAL pDestSurface AS IDirect3DSurface9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestRect AS RECT
 , BYREF pSrcFile AS ASCIIZ
 , BYREF pSrcRect AS RECT
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
DECLARE FUNCTION D3DXLoadSurfaceFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadSurfaceFromFileW" (_
 BYVAL pDestSurface AS IDirect3DSurface9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestRect AS RECT
 , BYREF pSrcFile AS WSTRINGZ
 , BYREF pSrcRect AS RECT
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXLoadSurfaceFromFile = D3DXLoadSurfaceFromFileW
#ELSE
 MACRO D3DXLoadSurfaceFromFile = D3DXLoadSurfaceFromFileA
#ENDIF
DECLARE FUNCTION D3DXLoadSurfaceFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadSurfaceFromResourceA" (_
 BYVAL pDestSurface AS IDirect3DSurface9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestRect AS RECT
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF pSrcRect AS RECT
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
DECLARE FUNCTION D3DXLoadSurfaceFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadSurfaceFromResourceW" (_
 BYVAL pDestSurface AS IDirect3DSurface9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestRect AS RECT
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF pSrcRect AS RECT
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXLoadSurfaceFromResource = D3DXLoadSurfaceFromResourceW
#ELSE
 MACRO D3DXLoadSurfaceFromResource = D3DXLoadSurfaceFromResourceA
#ENDIF
DECLARE FUNCTION D3DXLoadSurfaceFromFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadSurfaceFromFileInMemory" (_
 BYVAL pDestSurface AS IDirect3DSurface9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestRect AS RECT
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYREF pSrcRect AS RECT
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXLoadSurfaceFromSurface:
'// ---------------------------
'// Load surface from another surface (with color conversion)
'//
'// Parameters:
'// pDestSurface
'// Destination surface, which will receive the image.
'// pDestPalette
'// Destination palette of 256 colors, or NULL
'// pDestRect
'// Destination rectangle, or NULL for entire surface
'// pSrcSurface
'// Source surface
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcRect
'// Source rectangle, or NULL for entire surface
'// Filter
'// D3DX_FILTER flags controlling how the image is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
'// ColorKey
'// Color to replace with transparent black, or 0 to disable 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. (ex. Opaque black == 0xff000000)
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXLoadSurfaceFromSurface IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadSurfaceFromSurface" (_
 BYVAL pDestSurface AS IDirect3DSurface9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestRect AS RECT
 , BYVAL pSrcSurface AS IDirect3DSurface9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcRect AS RECT
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXLoadSurfaceFromMemory:
'// --------------------------
'// Load surface from memory.
'//
'// Parameters:
'// pDestSurface
'// Destination surface, which will receive the image.
'// pDestPalette
'// Destination palette of 256 colors, or NULL
'// pDestRect
'// Destination rectangle, or NULL for entire surface
'// pSrcMemory
'// Pointer to the top-left corner of the source image in memory
'// SrcFormat
'// Pixel format of the source image.
'// SrcPitch
'// Pitch of source image, in bytes. For DXT formats, this number
'// should represent the width of one row of cells, in bytes.
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcRect
'// Source rectangle.
'// Filter
'// D3DX_FILTER flags controlling how the image is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
'// ColorKey
'// Color to replace with transparent black, or 0 to disable 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. (ex. Opaque black == 0xff000000)
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXLoadSurfaceFromMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadSurfaceFromMemory" (_
 BYVAL pDestSurface AS IDirect3DSurface9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestRect AS RECT
 , BYVAL pSrcMemory AS DWORD
 , BYVAL SrcFormat AS DWORD
 , BYVAL SrcPitch AS DWORD
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcRect AS RECT
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXSaveSurfaceToFile:
'// ----------------------
'// Save a surface to a image file.
'//
'// Parameters:
'// pDestFile
'// File name of the destination file
'// DestFormat
'// D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
'// pSrcSurface
'// Source surface, containing the image to be saved
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcRect
'// Source rectangle, or NULL for the entire image
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXSaveSurfaceToFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveSurfaceToFileA" (_
 BYREF pDestFile AS ASCIIZ
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcSurface AS IDirect3DSurface9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcRect AS RECT
 ) AS LONG
DECLARE FUNCTION D3DXSaveSurfaceToFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveSurfaceToFileW" (_
 BYREF pDestFile AS WSTRINGZ
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcSurface AS IDirect3DSurface9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcRect AS RECT
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXSaveSurfaceToFile = D3DXSaveSurfaceToFileW
#ELSE
 MACRO D3DXSaveSurfaceToFile = D3DXSaveSurfaceToFileA
#ENDIF
'//----------------------------------------------------------------------------
'// D3DXSaveSurfaceToFileInMemory:
'// ----------------------
'// Save a surface to a image file.
'//
'// Parameters:
'// ppDestBuf
'// address of pointer to d3dxbuffer for returning data bits
'// DestFormat
'// D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
'// pSrcSurface
'// Source surface, containing the image to be saved
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcRect
'// Source rectangle, or NULL for the entire image
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXSaveSurfaceToFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveSurfaceToFileInMemory" (_
 BYREF ppDestBuf AS ID3DXBuffer
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcSurface AS IDirect3DSurface9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcRect AS RECT
 ) AS LONG
'//////////////////////////////////////////////////////////////////////////////
'// Load/Save Volume APIs /////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//----------------------------------------------------------------------------
'// D3DXLoadVolumeFromFile/Resource:
'// --------------------------------
'// Load volume from a file or resource
'//
'// Parameters:
'// pDestVolume
'// Destination volume, which will receive the image.
'// pDestPalette
'// Destination palette of 256 colors, or NULL
'// pDestBox
'// Destination box, or NULL for entire volume
'// pSrcFile
'// File name of the source image.
'// pSrcModule
'// Module where resource is located, or NULL for module associated
'// with image the os used to create the current process.
'// pSrcResource
'// Resource name
'// pSrcData
'// Pointer to file in memory.
'// SrcDataSize
'// Size in bytes of file in memory.
'// pSrcBox
'// Source box, or NULL for entire image
'// Filter
'// D3DX_FILTER flags controlling how the image is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
'// ColorKey
'// Color to replace with transparent black, or 0 to disable 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. (ex. Opaque black == 0xff000000)
'// pSrcInfo
'// Pointer to a D3DXIMAGE_INFO structure to be filled in with the
'// description of the data in the source image file, or NULL.
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXLoadVolumeFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadVolumeFromFileA" (_
 BYVAL pDestVolume AS IDirect3DVolume9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestBox AS D3DBOX
 , BYREF pSrcFile AS ASCIIZ
 , BYREF pSrcBox AS D3DBOX
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
DECLARE FUNCTION D3DXLoadVolumeFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadVolumeFromFileW" (_
 BYVAL pDestVolume AS IDirect3DVolume9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestBox AS D3DBOX
 , BYREF pSrcFile AS WSTRINGZ
 , BYREF pSrcBox AS D3DBOX
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXLoadVolumeFromFile = D3DXLoadVolumeFromFileW
#ELSE
 MACRO D3DXLoadVolumeFromFile = D3DXLoadVolumeFromFileA
#ENDIF
DECLARE FUNCTION D3DXLoadVolumeFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadVolumeFromResourceA" (_
 BYVAL pDestVolume AS IDirect3DVolume9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestBox AS D3DBOX
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF pSrcBox AS D3DBOX
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
DECLARE FUNCTION D3DXLoadVolumeFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadVolumeFromResourceW" (_
 BYVAL pDestVolume AS IDirect3DVolume9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestBox AS D3DBOX
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF pSrcBox AS D3DBOX
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXLoadVolumeFromResource = D3DXLoadVolumeFromResourceW
#ELSE
 MACRO D3DXLoadVolumeFromResource = D3DXLoadVolumeFromResourceA
#ENDIF
DECLARE FUNCTION D3DXLoadVolumeFromFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadVolumeFromFileInMemory" (_
 BYVAL pDestVolume AS IDirect3DVolume9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestBox AS D3DBOX
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYREF pSrcBox AS D3DBOX
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXLoadVolumeFromVolume:
'// -------------------------
'// Load volume from another volume (with color conversion)
'//
'// Parameters:
'// pDestVolume
'// Destination volume, which will receive the image.
'// pDestPalette
'// Destination palette of 256 colors, or NULL
'// pDestBox
'// Destination box, or NULL for entire volume
'// pSrcVolume
'// Source volume
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcBox
'// Source box, or NULL for entire volume
'// Filter
'// D3DX_FILTER flags controlling how the image is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
'// ColorKey
'// Color to replace with transparent black, or 0 to disable 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. (ex. Opaque black == 0xff000000)
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXLoadVolumeFromVolume IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadVolumeFromVolume" (_
 BYVAL pDestVolume AS IDirect3DVolume9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestBox AS D3DBOX
 , BYVAL pSrcVolume AS IUnknown
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcBox AS D3DBOX
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXLoadVolumeFromMemory:
'// -------------------------
'// Load volume from memory.
'//
'// Parameters:
'// pDestVolume
'// Destination volume, which will receive the image.
'// pDestPalette
'// Destination palette of 256 colors, or NULL
'// pDestBox
'// Destination box, or NULL for entire volume
'// pSrcMemory
'// Pointer to the top-left corner of the source volume in memory
'// SrcFormat
'// Pixel format of the source volume.
'// SrcRowPitch
'// Pitch of source image, in bytes. For DXT formats, this number
'// should represent the size of one row of cells, in bytes.
'// SrcSlicePitch
'// Pitch of source image, in bytes. For DXT formats, this number
'// should represent the size of one slice of cells, in bytes.
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcBox
'// Source box.
'// Filter
'// D3DX_FILTER flags controlling how the image is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
'// ColorKey
'// Color to replace with transparent black, or 0 to disable 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. (ex. Opaque black == 0xff000000)
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXLoadVolumeFromMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXLoadVolumeFromMemory" (_
 BYVAL pDestVolume AS IDirect3DVolume9
 , BYREF pDestPalette AS PALETTEENTRY
 , BYREF pDestBox AS D3DBOX
 , BYVAL pSrcMemory AS DWORD
 , BYVAL SrcFormat AS DWORD
 , BYVAL SrcRowPitch AS DWORD
 , BYVAL SrcSlicePitch AS DWORD
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcBox AS D3DBOX
 , BYVAL Filter AS DWORD
 , BYVAL ColorKey AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXSaveVolumeToFile:
'// ---------------------
'// Save a volume to a image file.
'//
'// Parameters:
'// pDestFile
'// File name of the destination file
'// DestFormat
'// D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
'// pSrcVolume
'// Source volume, containing the image to be saved
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcBox
'// Source box, or NULL for the entire volume
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXSaveVolumeToFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveVolumeToFileA" (_
 BYREF pDestFile AS ASCIIZ
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcVolume AS IDirect3DVolume9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcBox AS D3DBOX
 ) AS LONG
DECLARE FUNCTION D3DXSaveVolumeToFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveVolumeToFileW" (_
 BYREF pDestFile AS WSTRINGZ
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcVolume AS IDirect3DVolume9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcBox AS D3DBOX
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXSaveVolumeToFile = D3DXSaveVolumeToFileW
#ELSE
 MACRO D3DXSaveVolumeToFile = D3DXSaveVolumeToFileA
#ENDIF
'//----------------------------------------------------------------------------
'// D3DXSaveVolumeToFileInMemory:
'// ---------------------
'// Save a volume to a image file.
'//
'// Parameters:
'// pDestFile
'// File name of the destination file
'// DestFormat
'// D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
'// pSrcVolume
'// Source volume, containing the image to be saved
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// pSrcBox
'// Source box, or NULL for the entire volume
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXSaveVolumeToFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveVolumeToFileInMemory" (_
 BYREF ppDestBuf AS ID3DXBuffer
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcVolume AS IDirect3DVolume9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYREF pSrcBox AS D3DBOX
 ) AS LONG
'//////////////////////////////////////////////////////////////////////////////
'// Create/Save Texture APIs //////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//----------------------------------------------------------------------------
'// D3DXCheckTextureRequirements:
'// -----------------------------
'// Checks texture creation parameters. If parameters are invalid, this
'// function returns corrected parameters.
'//
'// Parameters:
'//
'// pDevice
'// The D3D device to be used
'// pWidth, pHeight, pDepth, pSize
'// Desired size in pixels, or NULL. Returns corrected size.
'// pNumMipLevels
'// Number of desired mipmap levels, or NULL. Returns corrected number.
'// Usage
'// Texture usage flags
'// pFormat
'// Desired pixel format, or NULL. Returns corrected format.
'// Pool
'// Memory pool to be used to create texture
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXCheckTextureRequirements IMPORT $D3DX_DLLNAME ALIAS "D3DXCheckTextureRequirements" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pWidth AS DWORD
 , BYREF pHeight AS DWORD
 , BYREF pNumMipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYREF pFormat AS DWORD
 , BYVAL Pool AS DWORD
 ) AS LONG
DECLARE FUNCTION D3DXCheckCubeTextureRequirements IMPORT $D3DX_DLLNAME ALIAS "D3DXCheckCubeTextureRequirements" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSize AS DWORD
 , BYREF pNumMipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYREF pFormat AS DWORD
 , BYVAL Pool AS DWORD
 ) AS LONG
DECLARE FUNCTION D3DXCheckVolumeTextureRequirements IMPORT $D3DX_DLLNAME ALIAS "D3DXCheckVolumeTextureRequirements" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pWidth AS DWORD
 , BYREF pHeight AS DWORD
 , BYREF pDepth AS DWORD
 , BYREF pNumMipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYREF pFormat AS DWORD
 , BYVAL Pool AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXCreateTexture:
'// ------------------
'// Create an empty texture
'//
'// Parameters:
'//
'// pDevice
'// The D3D device with which the texture is going to be used.
'// Width, Height, Depth, Size
'// size in pixels. these must be non-zero
'// MipLevels
'// number of mip levels desired. if zero or D3DX_DEFAULT, a complete
'// mipmap chain will be created.
'// Usage
'// Texture usage flags
'// Format
'// Pixel format.
'// Pool
'// Memory pool to be used to create texture
'// ppTexture, ppCubeTexture, ppVolumeTexture
'// The texture object that will be created
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXCreateTexture IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTexture" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateCubeTexture IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTexture" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL Size AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateVolumeTexture IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTexture" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL Depth AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXCreateTextureFromFile/Resource:
'// -----------------------------------
'// Create a texture object from a file or resource.
'//
'// Parameters:
'//
'// pDevice
'// The D3D device with which the texture is going to be used.
'// pSrcFile
'// File name.
'// hSrcModule
'// Module handle. if NULL, current module will be used.
'// pSrcResource
'// Resource name in module
'// pvSrcData
'// Pointer to file in memory.
'// SrcDataSize
'// Size in bytes of file in memory.
'// Width, Height, Depth, Size
'// Size in pixels. If zero or D3DX_DEFAULT, the size will be taken from
'// the file and rounded up to a power of two. If D3DX_DEFAULT_NONPOW2,
'// and the device supports NONPOW2 textures, the size will not be rounded.
'// If D3DX_FROM_FILE, the size will be taken exactly as it is in the file,
'// and the call will fail if this violates device capabilities.
'// MipLevels
'// Number of mip levels. If zero or D3DX_DEFAULT, a complete mipmap
'// chain will be created. If D3DX_FROM_FILE, the size will be taken
'// exactly as it is in the file, and the call will fail if this violates
'// device capabilities.
'// Usage
'// Texture usage flags
'// Format
'// Desired pixel format. If D3DFMT_UNKNOWN, the format will be
'// taken from the file. If D3DFMT_FROM_FILE, the format will be taken
'// exactly as it is in the file, and the call will fail if the device does
'// not support the given format.
'// Pool
'// Memory pool to be used to create texture
'// Filter
'// D3DX_FILTER flags controlling how the image is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
'// MipFilter
'// D3DX_FILTER flags controlling how each miplevel is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_BOX,
'// ColorKey
'// Color to replace with transparent black, or 0 to disable 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. (ex. Opaque black == 0xff000000)
'// pSrcInfo
'// Pointer to a D3DXIMAGE_INFO structure to be filled in with the
'// description of the data in the source image file, or NULL.
'// pPalette
'// 256 color palette to be filled in, or NULL
'// ppTexture, ppCubeTexture, ppVolumeTexture
'// The texture object that will be created
'//
'//----------------------------------------------------------------------------
'// FromFile
DECLARE FUNCTION D3DXCreateTextureFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromFileA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS ASCIIZ
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateTextureFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromFileW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS WSTRINGZ
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateTextureFromFile = D3DXCreateTextureFromFileW
#ELSE
 MACRO D3DXCreateTextureFromFile = D3DXCreateTextureFromFileA
#ENDIF
DECLARE FUNCTION D3DXCreateCubeTextureFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromFileA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS ASCIIZ
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateCubeTextureFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromFileW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS WSTRINGZ
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateCubeTextureFromFile = D3DXCreateCubeTextureFromFileW
#ELSE
 MACRO D3DXCreateCubeTextureFromFile = D3DXCreateCubeTextureFromFileA
#ENDIF
DECLARE FUNCTION D3DXCreateVolumeTextureFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromFileA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS ASCIIZ
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateVolumeTextureFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromFileW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS WSTRINGZ
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateVolumeTextureFromFile = D3DXCreateVolumeTextureFromFileW
#ELSE
 MACRO D3DXCreateVolumeTextureFromFile = D3DXCreateVolumeTextureFromFileA
#ENDIF
'// FromResource
DECLARE FUNCTION D3DXCreateTextureFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromResourceA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateTextureFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromResourceW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateTextureFromResource = D3DXCreateTextureFromResourceW
#ELSE
 MACRO D3DXCreateTextureFromResource = D3DXCreateTextureFromResourceA
#ENDIF
DECLARE FUNCTION D3DXCreateCubeTextureFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromResourceA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateCubeTextureFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromResourceW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateCubeTextureFromResource = D3DXCreateCubeTextureFromResourceW
#ELSE
 MACRO D3DXCreateCubeTextureFromResource = D3DXCreateCubeTextureFromResourceA
#ENDIF
DECLARE FUNCTION D3DXCreateVolumeTextureFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromResourceA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateVolumeTextureFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromResourceW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateVolumeTextureFromResource = D3DXCreateVolumeTextureFromResourceW
#ELSE
 MACRO D3DXCreateVolumeTextureFromResource = D3DXCreateVolumeTextureFromResourceA
#ENDIF
'// FromFileEx
DECLARE FUNCTION D3DXCreateTextureFromFileExA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromFileExA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS ASCIIZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateTextureFromFileExW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromFileExW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS WSTRINGZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateTextureFromFileEx = D3DXCreateTextureFromFileExW
#ELSE
 MACRO D3DXCreateTextureFromFileEx = D3DXCreateTextureFromFileExA
#ENDIF
DECLARE FUNCTION D3DXCreateCubeTextureFromFileExA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromFileExA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS ASCIIZ
 , BYVAL Size AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateCubeTextureFromFileExW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromFileExW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS WSTRINGZ
 , BYVAL Size AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateCubeTextureFromFileEx = D3DXCreateCubeTextureFromFileExW
#ELSE
 MACRO D3DXCreateCubeTextureFromFileEx = D3DXCreateCubeTextureFromFileExA
#ENDIF
DECLARE FUNCTION D3DXCreateVolumeTextureFromFileExA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromFileExA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS ASCIIZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL Depth AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateVolumeTextureFromFileExW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromFileExW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYREF pSrcFile AS WSTRINGZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL Depth AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateVolumeTextureFromFileEx = D3DXCreateVolumeTextureFromFileExW
#ELSE
 MACRO D3DXCreateVolumeTextureFromFileEx = D3DXCreateVolumeTextureFromFileExA
#ENDIF
'// FromResourceEx
DECLARE FUNCTION D3DXCreateTextureFromResourceExA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromResourceExA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateTextureFromResourceExW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromResourceExW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateTextureFromResourceEx = D3DXCreateTextureFromResourceExW
#ELSE
 MACRO D3DXCreateTextureFromResourceEx = D3DXCreateTextureFromResourceExA
#ENDIF
DECLARE FUNCTION D3DXCreateCubeTextureFromResourceExA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromResourceExA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYVAL Size AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateCubeTextureFromResourceExW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromResourceExW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYVAL Size AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateCubeTextureFromResourceEx = D3DXCreateCubeTextureFromResourceExW
#ELSE
 MACRO D3DXCreateCubeTextureFromResourceEx = D3DXCreateCubeTextureFromResourceExA
#ENDIF
DECLARE FUNCTION D3DXCreateVolumeTextureFromResourceExA IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromResourceExA" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL Depth AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateVolumeTextureFromResourceExW IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromResourceExW" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL Depth AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCreateVolumeTextureFromResourceEx = D3DXCreateVolumeTextureFromResourceExW
#ELSE
 MACRO D3DXCreateVolumeTextureFromResourceEx = D3DXCreateVolumeTextureFromResourceExA
#ENDIF
'// FromFileInMemory
DECLARE FUNCTION D3DXCreateTextureFromFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromFileInMemory" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateCubeTextureFromFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromFileInMemory" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateVolumeTextureFromFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromFileInMemory" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
'// FromFileInMemoryEx
DECLARE FUNCTION D3DXCreateTextureFromFileInMemoryEx IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureFromFileInMemoryEx" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppTexture AS IDirect3DTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateCubeTextureFromFileInMemoryEx IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateCubeTextureFromFileInMemoryEx" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYVAL Size AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppCubeTexture AS IDirect3DCubeTexture9
 ) AS LONG
DECLARE FUNCTION D3DXCreateVolumeTextureFromFileInMemoryEx IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateVolumeTextureFromFileInMemoryEx" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL pSrcData AS DWORD
 , BYVAL SrcDataSize AS DWORD
 , BYVAL Width AS DWORD
 , BYVAL Height AS DWORD
 , BYVAL Depth AS DWORD
 , BYVAL MipLevels AS DWORD
 , BYVAL Usage AS DWORD
 , BYVAL Format AS DWORD
 , BYVAL Pool AS DWORD
 , BYVAL Filter AS DWORD
 , BYVAL MipFilter AS DWORD
 , BYVAL ColorKey AS DWORD
 , BYREF pSrcInfo AS D3DXIMAGE_INFO
 , BYREF pPalette AS PALETTEENTRY
 , BYREF ppVolumeTexture AS IDirect3DVolumeTexture9
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXSaveTextureToFile:
'// ----------------------
'// Save a texture to a file.
'//
'// Parameters:
'// pDestFile
'// File name of the destination file
'// DestFormat
'// D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
'// pSrcTexture
'// Source texture, containing the image to be saved
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXSaveTextureToFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveTextureToFileA" (_
 BYREF pDestFile AS ASCIIZ
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcTexture AS IDirect3DBaseTexture9
 , BYREF pSrcPalette AS PALETTEENTRY
 ) AS LONG
DECLARE FUNCTION D3DXSaveTextureToFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveTextureToFileW" (_
 BYREF pDestFile AS WSTRINGZ
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcTexture AS IDirect3DBaseTexture9
 , BYREF pSrcPalette AS PALETTEENTRY
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXSaveTextureToFile = D3DXSaveTextureToFileW
#ELSE
 MACRO D3DXSaveTextureToFile = D3DXSaveTextureToFileA
#ENDIF
'//----------------------------------------------------------------------------
'// D3DXSaveTextureToFileInMemory:
'// ----------------------
'// Save a texture to a file.
'//
'// Parameters:
'// ppDestBuf
'// address of a d3dxbuffer pointer to return the image data
'// DestFormat
'// D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
'// pSrcTexture
'// Source texture, containing the image to be saved
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXSaveTextureToFileInMemory IMPORT $D3DX_DLLNAME ALIAS "D3DXSaveTextureToFileInMemory" (_
 BYREF ppDestBuf AS ID3DXBuffer
 , BYVAL DestFormat AS DWORD
 , BYVAL pSrcTexture AS IDirect3DBaseTexture9
 , BYREF pSrcPalette AS PALETTEENTRY
 ) AS LONG
'//////////////////////////////////////////////////////////////////////////////
'// Misc Texture APIs /////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//----------------------------------------------------------------------------
'// D3DXFilterTexture:
'// ------------------
'// Filters mipmaps levels of a texture.
'//
'// Parameters:
'// pBaseTexture
'// The texture object to be filtered
'// pPalette
'// 256 color palette to be used, or NULL for non-palettized formats
'// SrcLevel
'// The level whose image is used to generate the subsequent levels.
'// Filter
'// D3DX_FILTER flags controlling how each miplevel is filtered.
'// Or D3DX_DEFAULT for D3DX_FILTER_BOX,
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXFilterTexture IMPORT $D3DX_DLLNAME ALIAS "D3DXFilterTexture" (_
 BYVAL pBaseTexture AS IDirect3DBaseTexture9
 , BYREF pPalette AS PALETTEENTRY
 , BYVAL SrcLevel AS DWORD
 , BYVAL Filter AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXFillTexture:
'// ----------------
'// Uses a user provided function to fill each texel of each mip level of a
'// given texture.
'//
'// Paramters:
'// pTexture, pCubeTexture, pVolumeTexture
'// Pointer to the texture to be filled.
'// pFunction
'// Pointer to user provided evalutor function which will be used to
'// compute the value of each texel.
'// pData
'// Pointer to an arbitrary block of user defined data. This pointer
'// will be passed to the function provided in pFunction
'//-----------------------------------------------------------------------------
DECLARE FUNCTION D3DXFillTexture IMPORT $D3DX_DLLNAME ALIAS "D3DXFillTexture" (_
 BYVAL pTexture AS IDirect3DTexture9
 , BYVAL pFunction AS DWORD
 , BYVAL pData AS DWORD
 ) AS LONG
DECLARE FUNCTION D3DXFillCubeTexture IMPORT $D3DX_DLLNAME ALIAS "D3DXFillCubeTexture" (_
 BYVAL pCubeTexture AS IDirect3DCubeTexture9
 , BYVAL pFunction AS DWORD
 , BYVAL pData AS DWORD
 ) AS LONG
DECLARE FUNCTION D3DXFillVolumeTexture IMPORT $D3DX_DLLNAME ALIAS "D3DXFillVolumeTexture" (_
 BYVAL pVolumeTexture AS IDirect3DVolumeTexture9
 , BYVAL pFunction AS DWORD
 , BYVAL pData AS DWORD
 ) AS LONG
'//---------------------------------------------------------------------------
'// D3DXFillTextureTX:
'// ------------------
'// Uses a TX Shader target to function to fill each texel of each mip level
'// of a given texture. The TX Shader target should be a compiled function
'// taking 2 paramters and returning a float4 color.
'//
'// Paramters:
'// pTexture, pCubeTexture, pVolumeTexture
'// Pointer to the texture to be filled.
'// pTextureShader
'// Pointer to the texture shader to be used to fill in the texture
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXFillTextureTX IMPORT $D3DX_DLLNAME ALIAS "D3DXFillTextureTX" (_
 BYVAL pTexture AS IDirect3DTexture9
 , BYVAL pTextureShader AS ID3DXTextureShader
 ) AS LONG
DECLARE FUNCTION D3DXFillCubeTextureTX IMPORT $D3DX_DLLNAME ALIAS "D3DXFillCubeTextureTX" (_
 BYVAL pCubeTexture AS IDirect3DCubeTexture9
 , BYVAL pTextureShader AS ID3DXTextureShader
 ) AS LONG
DECLARE FUNCTION D3DXFillVolumeTextureTX IMPORT $D3DX_DLLNAME ALIAS "D3DXFillVolumeTextureTX" (_
 BYVAL pVolumeTexture AS IDirect3DVolumeTexture9
 , BYVAL pTextureShader AS ID3DXTextureShader
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXComputeNormalMap:
'// ---------------------
'// Converts a height map into a normal map. The (x,y,z) components of each
'// normal are mapped to the (r,g,b) channels of the output texture.
'//
'// Parameters
'// pTexture
'// Pointer to the destination texture
'// pSrcTexture
'// Pointer to the source heightmap texture
'// pSrcPalette
'// Source palette of 256 colors, or NULL
'// Flags
'// D3DX_NORMALMAP flags
'// Channel
'// D3DX_CHANNEL specifying source of height information
'// Amplitude
'// The constant value which the height information is multiplied by.
'//---------------------------------------------------------------------------
DECLARE FUNCTION D3DXComputeNormalMap IMPORT $D3DX_DLLNAME ALIAS "D3DXComputeNormalMap" (_
 BYVAL pTexture AS IDirect3DTexture9
 , BYVAL pSrcTexture AS IDirect3DTexture9
 , BYREF pSrcPalette AS PALETTEENTRY
 , BYVAL Flags AS DWORD
 , BYVAL Channel AS DWORD
 , BYVAL Amplitude AS SINGLE
 ) AS LONG
#ENDIF
