home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Include / d3dx9tex.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-12-04  |  56.9 KB  |  1,648 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx9tex.h
  6. //  Content:    D3DX texturing APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9.  
  10. #include "d3dx9.h"
  11.  
  12. #ifndef __D3DX9TEX_H__
  13. #define __D3DX9TEX_H__
  14.  
  15.  
  16. //----------------------------------------------------------------------------
  17. // D3DX_FILTER flags:
  18. // ------------------
  19. //
  20. // A valid filter must contain one of these values:
  21. //
  22. //  D3DX_FILTER_NONE
  23. //      No scaling or filtering will take place.  Pixels outside the bounds
  24. //      of the source image are assumed to be transparent black.
  25. //  D3DX_FILTER_POINT
  26. //      Each destination pixel is computed by sampling the nearest pixel
  27. //      from the source image.
  28. //  D3DX_FILTER_LINEAR
  29. //      Each destination pixel is computed by linearly interpolating between
  30. //      the nearest pixels in the source image.  This filter works best 
  31. //      when the scale on each axis is less than 2.
  32. //  D3DX_FILTER_TRIANGLE
  33. //      Every pixel in the source image contributes equally to the
  34. //      destination image.  This is the slowest of all the filters.
  35. //  D3DX_FILTER_BOX
  36. //      Each pixel is computed by averaging a 2x2(x2) box pixels from 
  37. //      the source image. Only works when the dimensions of the 
  38. //      destination are half those of the source. (as with mip maps)
  39. //
  40. // And can be OR'd with any of these optional flags:
  41. //
  42. //  D3DX_FILTER_MIRROR_U
  43. //      Indicates that pixels off the edge of the texture on the U-axis
  44. //      should be mirrored, not wraped.
  45. //  D3DX_FILTER_MIRROR_V
  46. //      Indicates that pixels off the edge of the texture on the V-axis
  47. //      should be mirrored, not wraped.
  48. //  D3DX_FILTER_MIRROR_W
  49. //      Indicates that pixels off the edge of the texture on the W-axis
  50. //      should be mirrored, not wraped.
  51. //  D3DX_FILTER_MIRROR
  52. //      Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V |
  53. //      D3DX_FILTER_MIRROR_V
  54. //  D3DX_FILTER_DITHER
  55. //      Dithers the resulting image using a 4x4 order dither pattern.
  56. //  D3DX_FILTER_SRGB_IN
  57. //      Denotes that the input data is in sRGB (gamma 2.2) colorspace.
  58. //  D3DX_FILTER_SRGB_OUT
  59. //      Denotes that the output data is in sRGB (gamma 2.2) colorspace.
  60. //  D3DX_FILTER_SRGB
  61. //      Same as specifying D3DX_FILTER_SRGB_IN | D3DX_FILTER_SRGB_OUT
  62. //
  63. //----------------------------------------------------------------------------
  64.  
  65. #define D3DX_FILTER_NONE            (1 << 0)
  66. #define D3DX_FILTER_POINT           (2 << 0)
  67. #define D3DX_FILTER_LINEAR          (3 << 0)
  68. #define D3DX_FILTER_TRIANGLE        (4 << 0)
  69. #define D3DX_FILTER_BOX             (5 << 0)
  70.  
  71. #define D3DX_FILTER_MIRROR_U        (1 << 16)
  72. #define D3DX_FILTER_MIRROR_V        (2 << 16)
  73. #define D3DX_FILTER_MIRROR_W        (4 << 16)
  74. #define D3DX_FILTER_MIRROR          (7 << 16)
  75. #define D3DX_FILTER_DITHER          (1 << 19)
  76. #define D3DX_FILTER_SRGB_IN         (1 << 20)
  77. #define D3DX_FILTER_SRGB_OUT        (2 << 20)
  78. #define D3DX_FILTER_SRGB            (3 << 20)
  79.  
  80.  
  81. //----------------------------------------------------------------------------
  82. // D3DX_NORMALMAP flags:
  83. // ---------------------
  84. // These flags are used to control how D3DXComputeNormalMap generates normal
  85. // maps.  Any number of these flags may be OR'd together in any combination.
  86. //
  87. //  D3DX_NORMALMAP_MIRROR_U
  88. //      Indicates that pixels off the edge of the texture on the U-axis
  89. //      should be mirrored, not wraped.
  90. //  D3DX_NORMALMAP_MIRROR_V
  91. //      Indicates that pixels off the edge of the texture on the V-axis
  92. //      should be mirrored, not wraped.
  93. //  D3DX_NORMALMAP_MIRROR
  94. //      Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V
  95. //  D3DX_NORMALMAP_INVERTSIGN
  96. //      Inverts the direction of each normal 
  97. //  D3DX_NORMALMAP_COMPUTE_OCCLUSION
  98. //      Compute the per pixel Occlusion term and encodes it into the alpha.
  99. //      An Alpha of 1 means that the pixel is not obscured in anyway, and
  100. //      an alpha of 0 would mean that the pixel is completly obscured.
  101. //
  102. //----------------------------------------------------------------------------
  103.  
  104. //----------------------------------------------------------------------------
  105.  
  106. #define D3DX_NORMALMAP_MIRROR_U     (1 << 16)
  107. #define D3DX_NORMALMAP_MIRROR_V     (2 << 16)
  108. #define D3DX_NORMALMAP_MIRROR       (3 << 16)
  109. #define D3DX_NORMALMAP_INVERTSIGN   (8 << 16)
  110. #define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16)
  111.  
  112.  
  113.  
  114.  
  115. //----------------------------------------------------------------------------
  116. // D3DX_CHANNEL flags:
  117. // -------------------
  118. // These flags are used by functions which operate on or more channels
  119. // in a texture.
  120. //
  121. // D3DX_CHANNEL_RED
  122. //     Indicates the red channel should be used
  123. // D3DX_CHANNEL_BLUE
  124. //     Indicates the blue channel should be used
  125. // D3DX_CHANNEL_GREEN
  126. //     Indicates the green channel should be used
  127. // D3DX_CHANNEL_ALPHA
  128. //     Indicates the alpha channel should be used
  129. // D3DX_CHANNEL_LUMINANCE
  130. //     Indicates the luminaces of the red green and blue channels should be 
  131. //     used.
  132. //
  133. //----------------------------------------------------------------------------
  134.  
  135. #define D3DX_CHANNEL_RED            (1 << 0)
  136. #define D3DX_CHANNEL_BLUE           (1 << 1)
  137. #define D3DX_CHANNEL_GREEN          (1 << 2)
  138. #define D3DX_CHANNEL_ALPHA          (1 << 3)
  139. #define D3DX_CHANNEL_LUMINANCE      (1 << 4)
  140.  
  141.  
  142.  
  143.  
  144. //----------------------------------------------------------------------------
  145. // D3DXIMAGE_FILEFORMAT:
  146. // ---------------------
  147. // This enum is used to describe supported image file formats.
  148. //
  149. //----------------------------------------------------------------------------
  150.  
  151. typedef enum _D3DXIMAGE_FILEFORMAT
  152. {
  153.     D3DXIFF_BMP         = 0,
  154.     D3DXIFF_JPG         = 1,
  155.     D3DXIFF_TGA         = 2,
  156.     D3DXIFF_PNG         = 3,
  157.     D3DXIFF_DDS         = 4,
  158.     D3DXIFF_PPM         = 5,
  159.     D3DXIFF_DIB         = 6,
  160.     D3DXIFF_FORCE_DWORD = 0x7fffffff
  161.  
  162. } D3DXIMAGE_FILEFORMAT;
  163.  
  164.  
  165. //----------------------------------------------------------------------------
  166. // LPD3DXFILL2D and LPD3DXFILL3D:
  167. // ------------------------------
  168. // Function types used by the texture fill functions.
  169. //
  170. // Parameters:
  171. //  pOut
  172. //      Pointer to a vector which the function uses to return its result.
  173. //      X,Y,Z,W will be mapped to R,G,B,A respectivly. 
  174. //  pTexCoord
  175. //      Pointer to a vector containing the coordinates of the texel currently 
  176. //      being evaluated.  Textures and VolumeTexture texcoord components 
  177. //      range from 0 to 1. CubeTexture texcoord component range from -1 to 1.
  178. //  pTexelSize
  179. //      Pointer to a vector containing the dimensions of the current texel.
  180. //  pData
  181. //      Pointer to user data.
  182. //
  183. //----------------------------------------------------------------------------
  184.  
  185. typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut, 
  186.     CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData);
  187.  
  188. typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut, 
  189.     CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData);
  190.  
  191.  
  192.  
  193. //----------------------------------------------------------------------------
  194. // D3DXIMAGE_INFO:
  195. // ---------------
  196. // This structure is used to return a rough description of what the
  197. // the original contents of an image file looked like.
  198. // 
  199. //  Width
  200. //      Width of original image in pixels
  201. //  Height
  202. //      Height of original image in pixels
  203. //  Depth
  204. //      Depth of original image in pixels
  205. //  MipLevels
  206. //      Number of mip levels in original image
  207. //  Format
  208. //      D3D format which most closely describes the data in original image
  209. //  ResourceType
  210. //      D3DRESOURCETYPE representing the type of texture stored in the file.
  211. //      D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE.
  212. //  ImageFileFormat
  213. //      D3DXIMAGE_FILEFORMAT representing the format of the image file.
  214. //
  215. //----------------------------------------------------------------------------
  216.  
  217. typedef struct _D3DXIMAGE_INFO
  218. {
  219.     UINT                    Width;
  220.     UINT                    Height;
  221.     UINT                    Depth;
  222.     UINT                    MipLevels;
  223.     D3DFORMAT               Format;
  224.     D3DRESOURCETYPE         ResourceType;
  225.     D3DXIMAGE_FILEFORMAT    ImageFileFormat;
  226.  
  227. } D3DXIMAGE_INFO;
  228.  
  229.  
  230.  
  231.  
  232.  
  233. #ifdef __cplusplus
  234. extern "C" {
  235. #endif //__cplusplus
  236.  
  237.  
  238.  
  239. //////////////////////////////////////////////////////////////////////////////
  240. // Image File APIs ///////////////////////////////////////////////////////////
  241. //////////////////////////////////////////////////////////////////////////////
  242. ;
  243. //----------------------------------------------------------------------------
  244. // GetImageInfoFromFile/Resource:
  245. // ------------------------------
  246. // Fills in a D3DXIMAGE_INFO struct with information about an image file.
  247. //
  248. // Parameters:
  249. //  pSrcFile
  250. //      File name of the source image.
  251. //  pSrcModule
  252. //      Module where resource is located, or NULL for module associated
  253. //      with image the os used to create the current process.
  254. //  pSrcResource
  255. //      Resource name
  256. //  pSrcData
  257. //      Pointer to file in memory.
  258. //  SrcDataSize
  259. //      Size in bytes of file in memory.
  260. //  pSrcInfo
  261. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  262. //      description of the data in the source image file.
  263. //
  264. //----------------------------------------------------------------------------
  265.  
  266. HRESULT WINAPI
  267.     D3DXGetImageInfoFromFileA(
  268.         LPCSTR                    pSrcFile,
  269.         D3DXIMAGE_INFO*           pSrcInfo);
  270.  
  271. HRESULT WINAPI
  272.     D3DXGetImageInfoFromFileW(
  273.         LPCWSTR                   pSrcFile,
  274.         D3DXIMAGE_INFO*           pSrcInfo);
  275.  
  276. #ifdef UNICODE
  277. #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW
  278. #else
  279. #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA
  280. #endif
  281.  
  282.  
  283. HRESULT WINAPI
  284.     D3DXGetImageInfoFromResourceA(
  285.         HMODULE                   hSrcModule,
  286.         LPCSTR                    pSrcResource,
  287.         D3DXIMAGE_INFO*           pSrcInfo);
  288.  
  289. HRESULT WINAPI
  290.     D3DXGetImageInfoFromResourceW(
  291.         HMODULE                   hSrcModule,
  292.         LPCWSTR                   pSrcResource,
  293.         D3DXIMAGE_INFO*           pSrcInfo);
  294.  
  295. #ifdef UNICODE
  296. #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW
  297. #else
  298. #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA
  299. #endif
  300.  
  301.  
  302. HRESULT WINAPI
  303.     D3DXGetImageInfoFromFileInMemory(
  304.         LPCVOID                   pSrcData,
  305.         UINT                      SrcDataSize,
  306.         D3DXIMAGE_INFO*           pSrcInfo);
  307.  
  308.  
  309.  
  310.  
  311. //////////////////////////////////////////////////////////////////////////////
  312. // Load/Save Surface APIs ////////////////////////////////////////////////////
  313. //////////////////////////////////////////////////////////////////////////////
  314.  
  315. //----------------------------------------------------------------------------
  316. // D3DXLoadSurfaceFromFile/Resource:
  317. // ---------------------------------
  318. // Load surface from a file or resource
  319. //
  320. // Parameters:
  321. //  pDestSurface
  322. //      Destination surface, which will receive the image.
  323. //  pDestPalette
  324. //      Destination palette of 256 colors, or NULL
  325. //  pDestRect
  326. //      Destination rectangle, or NULL for entire surface
  327. //  pSrcFile
  328. //      File name of the source image.
  329. //  pSrcModule
  330. //      Module where resource is located, or NULL for module associated
  331. //      with image the os used to create the current process.
  332. //  pSrcResource
  333. //      Resource name
  334. //  pSrcData
  335. //      Pointer to file in memory.
  336. //  SrcDataSize
  337. //      Size in bytes of file in memory.
  338. //  pSrcRect
  339. //      Source rectangle, or NULL for entire image
  340. //  Filter
  341. //      D3DX_FILTER flags controlling how the image is filtered.
  342. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  343. //  ColorKey
  344. //      Color to replace with transparent black, or 0 to disable colorkey.
  345. //      This is always a 32-bit ARGB color, independent of the source image
  346. //      format.  Alpha is significant, and should usually be set to FF for 
  347. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  348. //  pSrcInfo
  349. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  350. //      description of the data in the source image file, or NULL.
  351. //
  352. //----------------------------------------------------------------------------
  353.  
  354. HRESULT WINAPI
  355.     D3DXLoadSurfaceFromFileA(
  356.         LPDIRECT3DSURFACE9        pDestSurface,
  357.         CONST PALETTEENTRY*       pDestPalette,
  358.         CONST RECT*               pDestRect,
  359.         LPCSTR                    pSrcFile,
  360.         CONST RECT*               pSrcRect,
  361.         DWORD                     Filter,
  362.         D3DCOLOR                  ColorKey,
  363.         D3DXIMAGE_INFO*           pSrcInfo);
  364.  
  365. HRESULT WINAPI
  366.     D3DXLoadSurfaceFromFileW(
  367.         LPDIRECT3DSURFACE9        pDestSurface,
  368.         CONST PALETTEENTRY*       pDestPalette,
  369.         CONST RECT*               pDestRect,
  370.         LPCWSTR                   pSrcFile,
  371.         CONST RECT*               pSrcRect,
  372.         DWORD                     Filter,
  373.         D3DCOLOR                  ColorKey,
  374.         D3DXIMAGE_INFO*           pSrcInfo);
  375.  
  376. #ifdef UNICODE
  377. #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW
  378. #else
  379. #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA
  380. #endif
  381.  
  382.  
  383.  
  384. HRESULT WINAPI
  385.     D3DXLoadSurfaceFromResourceA(
  386.         LPDIRECT3DSURFACE9        pDestSurface,
  387.         CONST PALETTEENTRY*       pDestPalette,
  388.         CONST RECT*               pDestRect,
  389.         HMODULE                   hSrcModule,
  390.         LPCSTR                    pSrcResource,
  391.         CONST RECT*               pSrcRect,
  392.         DWORD                     Filter,
  393.         D3DCOLOR                  ColorKey,
  394.         D3DXIMAGE_INFO*           pSrcInfo);
  395.  
  396. HRESULT WINAPI
  397.     D3DXLoadSurfaceFromResourceW(
  398.         LPDIRECT3DSURFACE9        pDestSurface,
  399.         CONST PALETTEENTRY*       pDestPalette,
  400.         CONST RECT*               pDestRect,
  401.         HMODULE                   hSrcModule,
  402.         LPCWSTR                   pSrcResource,
  403.         CONST RECT*               pSrcRect,
  404.         DWORD                     Filter,
  405.         D3DCOLOR                  ColorKey,
  406.         D3DXIMAGE_INFO*           pSrcInfo);
  407.  
  408.  
  409. #ifdef UNICODE
  410. #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW
  411. #else
  412. #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA
  413. #endif
  414.  
  415.  
  416.  
  417. HRESULT WINAPI
  418.     D3DXLoadSurfaceFromFileInMemory(
  419.         LPDIRECT3DSURFACE9        pDestSurface,
  420.         CONST PALETTEENTRY*       pDestPalette,
  421.         CONST RECT*               pDestRect,
  422.         LPCVOID                   pSrcData,
  423.         UINT                      SrcDataSize,
  424.         CONST RECT*               pSrcRect,
  425.         DWORD                     Filter,
  426.         D3DCOLOR                  ColorKey,
  427.         D3DXIMAGE_INFO*           pSrcInfo);
  428.  
  429.  
  430.  
  431. //----------------------------------------------------------------------------
  432. // D3DXLoadSurfaceFromSurface:
  433. // ---------------------------
  434. // Load surface from another surface (with color conversion)
  435. //
  436. // Parameters:
  437. //  pDestSurface
  438. //      Destination surface, which will receive the image.
  439. //  pDestPalette
  440. //      Destination palette of 256 colors, or NULL
  441. //  pDestRect
  442. //      Destination rectangle, or NULL for entire surface
  443. //  pSrcSurface
  444. //      Source surface
  445. //  pSrcPalette
  446. //      Source palette of 256 colors, or NULL
  447. //  pSrcRect
  448. //      Source rectangle, or NULL for entire surface
  449. //  Filter
  450. //      D3DX_FILTER flags controlling how the image is filtered.
  451. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  452. //  ColorKey
  453. //      Color to replace with transparent black, or 0 to disable colorkey.
  454. //      This is always a 32-bit ARGB color, independent of the source image
  455. //      format.  Alpha is significant, and should usually be set to FF for 
  456. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  457. //
  458. //----------------------------------------------------------------------------
  459.  
  460. HRESULT WINAPI
  461.     D3DXLoadSurfaceFromSurface(
  462.         LPDIRECT3DSURFACE9        pDestSurface,
  463.         CONST PALETTEENTRY*       pDestPalette,
  464.         CONST RECT*               pDestRect,
  465.         LPDIRECT3DSURFACE9        pSrcSurface,
  466.         CONST PALETTEENTRY*       pSrcPalette,
  467.         CONST RECT*               pSrcRect,
  468.         DWORD                     Filter,
  469.         D3DCOLOR                  ColorKey);
  470.  
  471.  
  472. //----------------------------------------------------------------------------
  473. // D3DXLoadSurfaceFromMemory:
  474. // --------------------------
  475. // Load surface from memory.
  476. //
  477. // Parameters:
  478. //  pDestSurface
  479. //      Destination surface, which will receive the image.
  480. //  pDestPalette
  481. //      Destination palette of 256 colors, or NULL
  482. //  pDestRect
  483. //      Destination rectangle, or NULL for entire surface
  484. //  pSrcMemory
  485. //      Pointer to the top-left corner of the source image in memory
  486. //  SrcFormat
  487. //      Pixel format of the source image.
  488. //  SrcPitch
  489. //      Pitch of source image, in bytes.  For DXT formats, this number
  490. //      should represent the width of one row of cells, in bytes.
  491. //  pSrcPalette
  492. //      Source palette of 256 colors, or NULL
  493. //  pSrcRect
  494. //      Source rectangle.
  495. //  Filter
  496. //      D3DX_FILTER flags controlling how the image is filtered.
  497. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  498. //  ColorKey
  499. //      Color to replace with transparent black, or 0 to disable colorkey.
  500. //      This is always a 32-bit ARGB color, independent of the source image
  501. //      format.  Alpha is significant, and should usually be set to FF for 
  502. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  503. //
  504. //----------------------------------------------------------------------------
  505.  
  506. HRESULT WINAPI
  507.     D3DXLoadSurfaceFromMemory(
  508.         LPDIRECT3DSURFACE9        pDestSurface,
  509.         CONST PALETTEENTRY*       pDestPalette,
  510.         CONST RECT*               pDestRect,
  511.         LPCVOID                   pSrcMemory,
  512.         D3DFORMAT                 SrcFormat,
  513.         UINT                      SrcPitch,
  514.         CONST PALETTEENTRY*       pSrcPalette,
  515.         CONST RECT*               pSrcRect,
  516.         DWORD                     Filter,
  517.         D3DCOLOR                  ColorKey);
  518.  
  519.  
  520. //----------------------------------------------------------------------------
  521. // D3DXSaveSurfaceToFile:
  522. // ----------------------
  523. // Save a surface to a image file.
  524. //
  525. // Parameters:
  526. //  pDestFile
  527. //      File name of the destination file
  528. //  DestFormat
  529. //      D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  530. //  pSrcSurface
  531. //      Source surface, containing the image to be saved
  532. //  pSrcPalette
  533. //      Source palette of 256 colors, or NULL
  534. //  pSrcRect
  535. //      Source rectangle, or NULL for the entire image
  536. //
  537. //----------------------------------------------------------------------------
  538.  
  539. HRESULT WINAPI
  540.     D3DXSaveSurfaceToFileA(
  541.         LPCSTR                    pDestFile,
  542.         D3DXIMAGE_FILEFORMAT      DestFormat,
  543.         LPDIRECT3DSURFACE9        pSrcSurface,
  544.         CONST PALETTEENTRY*       pSrcPalette,
  545.         CONST RECT*               pSrcRect);
  546.  
  547. HRESULT WINAPI
  548.     D3DXSaveSurfaceToFileW(
  549.         LPCWSTR                   pDestFile,
  550.         D3DXIMAGE_FILEFORMAT      DestFormat,
  551.         LPDIRECT3DSURFACE9        pSrcSurface,
  552.         CONST PALETTEENTRY*       pSrcPalette,
  553.         CONST RECT*               pSrcRect);
  554.  
  555. #ifdef UNICODE
  556. #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW
  557. #else
  558. #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA
  559. #endif
  560.  
  561.  
  562.  
  563.  
  564. //////////////////////////////////////////////////////////////////////////////
  565. // Load/Save Volume APIs /////////////////////////////////////////////////////
  566. //////////////////////////////////////////////////////////////////////////////
  567.  
  568. //----------------------------------------------------------------------------
  569. // D3DXLoadVolumeFromFile/Resource:
  570. // --------------------------------
  571. // Load volume from a file or resource
  572. //
  573. // Parameters:
  574. //  pDestVolume
  575. //      Destination volume, which will receive the image.
  576. //  pDestPalette
  577. //      Destination palette of 256 colors, or NULL
  578. //  pDestBox
  579. //      Destination box, or NULL for entire volume
  580. //  pSrcFile
  581. //      File name of the source image.
  582. //  pSrcModule
  583. //      Module where resource is located, or NULL for module associated
  584. //      with image the os used to create the current process.
  585. //  pSrcResource
  586. //      Resource name
  587. //  pSrcData
  588. //      Pointer to file in memory.
  589. //  SrcDataSize
  590. //      Size in bytes of file in memory.
  591. //  pSrcBox
  592. //      Source box, or NULL for entire image
  593. //  Filter
  594. //      D3DX_FILTER flags controlling how the image is filtered.
  595. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  596. //  ColorKey
  597. //      Color to replace with transparent black, or 0 to disable colorkey.
  598. //      This is always a 32-bit ARGB color, independent of the source image
  599. //      format.  Alpha is significant, and should usually be set to FF for 
  600. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  601. //  pSrcInfo
  602. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  603. //      description of the data in the source image file, or NULL.
  604. //
  605. //----------------------------------------------------------------------------
  606.  
  607. HRESULT WINAPI
  608.     D3DXLoadVolumeFromFileA(
  609.         LPDIRECT3DVOLUME9         pDestVolume,
  610.         CONST PALETTEENTRY*       pDestPalette,
  611.         CONST D3DBOX*             pDestBox,
  612.         LPCSTR                    pSrcFile,
  613.         CONST D3DBOX*             pSrcBox,
  614.         DWORD                     Filter,
  615.         D3DCOLOR                  ColorKey,
  616.         D3DXIMAGE_INFO*           pSrcInfo);
  617.  
  618. HRESULT WINAPI
  619.     D3DXLoadVolumeFromFileW(
  620.         LPDIRECT3DVOLUME9         pDestVolume,
  621.         CONST PALETTEENTRY*       pDestPalette,
  622.         CONST D3DBOX*             pDestBox,
  623.         LPCWSTR                   pSrcFile,
  624.         CONST D3DBOX*             pSrcBox,
  625.         DWORD                     Filter,
  626.         D3DCOLOR                  ColorKey,
  627.         D3DXIMAGE_INFO*           pSrcInfo);
  628.  
  629. #ifdef UNICODE
  630. #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW
  631. #else
  632. #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA
  633. #endif
  634.  
  635.  
  636. HRESULT WINAPI
  637.     D3DXLoadVolumeFromResourceA(
  638.         LPDIRECT3DVOLUME9         pDestVolume,
  639.         CONST PALETTEENTRY*       pDestPalette,
  640.         CONST D3DBOX*             pDestBox,
  641.         HMODULE                   hSrcModule,
  642.         LPCSTR                    pSrcResource,
  643.         CONST D3DBOX*             pSrcBox,
  644.         DWORD                     Filter,
  645.         D3DCOLOR                  ColorKey,
  646.         D3DXIMAGE_INFO*           pSrcInfo);
  647.  
  648. HRESULT WINAPI
  649.     D3DXLoadVolumeFromResourceW(
  650.         LPDIRECT3DVOLUME9         pDestVolume,
  651.         CONST PALETTEENTRY*       pDestPalette,
  652.         CONST D3DBOX*             pDestBox,
  653.         HMODULE                   hSrcModule,
  654.         LPCWSTR                   pSrcResource,
  655.         CONST D3DBOX*             pSrcBox,
  656.         DWORD                     Filter,
  657.         D3DCOLOR                  ColorKey,
  658.         D3DXIMAGE_INFO*           pSrcInfo);
  659.  
  660. #ifdef UNICODE
  661. #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW
  662. #else
  663. #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA
  664. #endif
  665.  
  666.  
  667.  
  668. HRESULT WINAPI
  669.     D3DXLoadVolumeFromFileInMemory(
  670.         LPDIRECT3DVOLUME9         pDestVolume,
  671.         CONST PALETTEENTRY*       pDestPalette,
  672.         CONST D3DBOX*             pDestBox,
  673.         LPCVOID                   pSrcData,
  674.         UINT                      SrcDataSize,
  675.         CONST D3DBOX*             pSrcBox,
  676.         DWORD                     Filter,
  677.         D3DCOLOR                  ColorKey,
  678.         D3DXIMAGE_INFO*           pSrcInfo);
  679.  
  680.  
  681.  
  682. //----------------------------------------------------------------------------
  683. // D3DXLoadVolumeFromVolume:
  684. // -------------------------
  685. // Load volume from another volume (with color conversion)
  686. //
  687. // Parameters:
  688. //  pDestVolume
  689. //      Destination volume, which will receive the image.
  690. //  pDestPalette
  691. //      Destination palette of 256 colors, or NULL
  692. //  pDestBox
  693. //      Destination box, or NULL for entire volume
  694. //  pSrcVolume
  695. //      Source volume
  696. //  pSrcPalette
  697. //      Source palette of 256 colors, or NULL
  698. //  pSrcBox
  699. //      Source box, or NULL for entire volume
  700. //  Filter
  701. //      D3DX_FILTER flags controlling how the image is filtered.
  702. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  703. //  ColorKey
  704. //      Color to replace with transparent black, or 0 to disable colorkey.
  705. //      This is always a 32-bit ARGB color, independent of the source image
  706. //      format.  Alpha is significant, and should usually be set to FF for 
  707. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  708. //
  709. //----------------------------------------------------------------------------
  710.  
  711. HRESULT WINAPI
  712.     D3DXLoadVolumeFromVolume(
  713.         LPDIRECT3DVOLUME9         pDestVolume,
  714.         CONST PALETTEENTRY*       pDestPalette,
  715.         CONST D3DBOX*             pDestBox,
  716.         LPDIRECT3DVOLUME9         pSrcVolume,
  717.         CONST PALETTEENTRY*       pSrcPalette,
  718.         CONST D3DBOX*             pSrcBox,
  719.         DWORD                     Filter,
  720.         D3DCOLOR                  ColorKey);
  721.  
  722.  
  723.  
  724. //----------------------------------------------------------------------------
  725. // D3DXLoadVolumeFromMemory:
  726. // -------------------------
  727. // Load volume from memory.
  728. //
  729. // Parameters:
  730. //  pDestVolume
  731. //      Destination volume, which will receive the image.
  732. //  pDestPalette
  733. //      Destination palette of 256 colors, or NULL
  734. //  pDestBox
  735. //      Destination box, or NULL for entire volume
  736. //  pSrcMemory
  737. //      Pointer to the top-left corner of the source volume in memory
  738. //  SrcFormat
  739. //      Pixel format of the source volume.
  740. //  SrcRowPitch
  741. //      Pitch of source image, in bytes.  For DXT formats, this number
  742. //      should represent the size of one row of cells, in bytes.
  743. //  SrcSlicePitch
  744. //      Pitch of source image, in bytes.  For DXT formats, this number
  745. //      should represent the size of one slice of cells, in bytes.
  746. //  pSrcPalette
  747. //      Source palette of 256 colors, or NULL
  748. //  pSrcBox
  749. //      Source box.
  750. //  Filter
  751. //      D3DX_FILTER flags controlling how the image is filtered.
  752. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  753. //  ColorKey
  754. //      Color to replace with transparent black, or 0 to disable colorkey.
  755. //      This is always a 32-bit ARGB color, independent of the source image
  756. //      format.  Alpha is significant, and should usually be set to FF for 
  757. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  758. //
  759. //----------------------------------------------------------------------------
  760.  
  761. HRESULT WINAPI
  762.     D3DXLoadVolumeFromMemory(
  763.         LPDIRECT3DVOLUME9         pDestVolume,
  764.         CONST PALETTEENTRY*       pDestPalette,
  765.         CONST D3DBOX*             pDestBox,
  766.         LPCVOID                   pSrcMemory,
  767.         D3DFORMAT                 SrcFormat,
  768.         UINT                      SrcRowPitch,
  769.         UINT                      SrcSlicePitch,
  770.         CONST PALETTEENTRY*       pSrcPalette,
  771.         CONST D3DBOX*             pSrcBox,
  772.         DWORD                     Filter,
  773.         D3DCOLOR                  ColorKey);
  774.  
  775.  
  776.  
  777. //----------------------------------------------------------------------------
  778. // D3DXSaveVolumeToFile:
  779. // ---------------------
  780. // Save a volume to a image file.
  781. //
  782. // Parameters:
  783. //  pDestFile
  784. //      File name of the destination file
  785. //  DestFormat
  786. //      D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  787. //  pSrcVolume
  788. //      Source volume, containing the image to be saved
  789. //  pSrcPalette
  790. //      Source palette of 256 colors, or NULL
  791. //  pSrcBox
  792. //      Source box, or NULL for the entire volume
  793. //
  794. //----------------------------------------------------------------------------
  795.  
  796. HRESULT WINAPI
  797.     D3DXSaveVolumeToFileA(
  798.         LPCSTR                    pDestFile,
  799.         D3DXIMAGE_FILEFORMAT      DestFormat,
  800.         LPDIRECT3DVOLUME9         pSrcVolume,
  801.         CONST PALETTEENTRY*       pSrcPalette,
  802.         CONST D3DBOX*             pSrcBox);
  803.  
  804. HRESULT WINAPI
  805.     D3DXSaveVolumeToFileW(
  806.         LPCWSTR                   pDestFile,
  807.         D3DXIMAGE_FILEFORMAT      DestFormat,
  808.         LPDIRECT3DVOLUME9         pSrcVolume,
  809.         CONST PALETTEENTRY*       pSrcPalette,
  810.         CONST D3DBOX*             pSrcBox);
  811.  
  812. #ifdef UNICODE
  813. #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW
  814. #else
  815. #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA
  816. #endif
  817.  
  818.  
  819.  
  820.  
  821. //////////////////////////////////////////////////////////////////////////////
  822. // Create/Save Texture APIs //////////////////////////////////////////////////
  823. //////////////////////////////////////////////////////////////////////////////
  824.  
  825. //----------------------------------------------------------------------------
  826. // D3DXCheckTextureRequirements:
  827. // -----------------------------
  828. // Checks texture creation parameters.  If parameters are invalid, this
  829. // function returns corrected parameters.
  830. //
  831. // Parameters:
  832. //
  833. //  pDevice
  834. //      The D3D device to be used
  835. //  pWidth, pHeight, pDepth, pSize
  836. //      Desired size in pixels, or NULL.  Returns corrected size.
  837. //  pNumMipLevels
  838. //      Number of desired mipmap levels, or NULL.  Returns corrected number.
  839. //  Usage
  840. //      Texture usage flags
  841. //  pFormat
  842. //      Desired pixel format, or NULL.  Returns corrected format.
  843. //  Pool
  844. //      Memory pool to be used to create texture
  845. //
  846. //----------------------------------------------------------------------------
  847.  
  848. HRESULT WINAPI
  849.     D3DXCheckTextureRequirements(
  850.         LPDIRECT3DDEVICE9         pDevice,
  851.         UINT*                     pWidth,
  852.         UINT*                     pHeight,
  853.         UINT*                     pNumMipLevels,
  854.         DWORD                     Usage,
  855.         D3DFORMAT*                pFormat,
  856.         D3DPOOL                   Pool);
  857.  
  858. HRESULT WINAPI
  859.     D3DXCheckCubeTextureRequirements(
  860.         LPDIRECT3DDEVICE9         pDevice,
  861.         UINT*                     pSize,
  862.         UINT*                     pNumMipLevels,
  863.         DWORD                     Usage,
  864.         D3DFORMAT*                pFormat,
  865.         D3DPOOL                   Pool);
  866.  
  867. HRESULT WINAPI
  868.     D3DXCheckVolumeTextureRequirements(
  869.         LPDIRECT3DDEVICE9         pDevice,
  870.         UINT*                     pWidth,
  871.         UINT*                     pHeight,
  872.         UINT*                     pDepth,
  873.         UINT*                     pNumMipLevels,
  874.         DWORD                     Usage,
  875.         D3DFORMAT*                pFormat,
  876.         D3DPOOL                   Pool);
  877.  
  878.  
  879. //----------------------------------------------------------------------------
  880. // D3DXCreateTexture:
  881. // ------------------
  882. // Create an empty texture
  883. //
  884. // Parameters:
  885. //
  886. //  pDevice
  887. //      The D3D device with which the texture is going to be used.
  888. //  Width, Height, Depth, Size
  889. //      size in pixels. these must be non-zero
  890. //  MipLevels
  891. //      number of mip levels desired. if zero or D3DX_DEFAULT, a complete
  892. //      mipmap chain will be created.
  893. //  Usage
  894. //      Texture usage flags
  895. //  Format
  896. //      Pixel format.
  897. //  Pool
  898. //      Memory pool to be used to create texture
  899. //  ppTexture, ppCubeTexture, ppVolumeTexture
  900. //      The texture object that will be created
  901. //
  902. //----------------------------------------------------------------------------
  903.  
  904. HRESULT WINAPI
  905.     D3DXCreateTexture(
  906.         LPDIRECT3DDEVICE9         pDevice,
  907.         UINT                      Width,
  908.         UINT                      Height,
  909.         UINT                      MipLevels,
  910.         DWORD                     Usage,
  911.         D3DFORMAT                 Format,
  912.         D3DPOOL                   Pool,
  913.         LPDIRECT3DTEXTURE9*       ppTexture);
  914.  
  915. HRESULT WINAPI
  916.     D3DXCreateCubeTexture(
  917.         LPDIRECT3DDEVICE9         pDevice,
  918.         UINT                      Size,
  919.         UINT                      MipLevels,
  920.         DWORD                     Usage,
  921.         D3DFORMAT                 Format,
  922.         D3DPOOL                   Pool,
  923.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  924.  
  925. HRESULT WINAPI
  926.     D3DXCreateVolumeTexture(
  927.         LPDIRECT3DDEVICE9         pDevice,
  928.         UINT                      Width,
  929.         UINT                      Height,
  930.         UINT                      Depth,
  931.         UINT                      MipLevels,
  932.         DWORD                     Usage,
  933.         D3DFORMAT                 Format,
  934.         D3DPOOL                   Pool,
  935.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  936.  
  937.  
  938.  
  939. //----------------------------------------------------------------------------
  940. // D3DXCreateTextureFromFile/Resource:
  941. // -----------------------------------
  942. // Create a texture object from a file or resource.
  943. //
  944. // Parameters:
  945. //
  946. //  pDevice
  947. //      The D3D device with which the texture is going to be used.
  948. //  pSrcFile
  949. //      File name.
  950. //  hSrcModule
  951. //      Module handle. if NULL, current module will be used.
  952. //  pSrcResource
  953. //      Resource name in module
  954. //  pvSrcData
  955. //      Pointer to file in memory.
  956. //  SrcDataSize
  957. //      Size in bytes of file in memory.
  958. //  Width, Height, Depth, Size
  959. //      Size in pixels.  If zero or D3DX_DEFAULT, the size will be taken from 
  960. //      the file and rounded up to a power of two.  If D3DX_DEFAULT_NONPOW2, 
  961. //      the size will be not be rounded, if the device supports NONPOW2 textures.
  962. //  MipLevels
  963. //      Number of mip levels.  If zero or D3DX_DEFAULT, a complete mipmap
  964. //      chain will be created.
  965. //  Usage
  966. //      Texture usage flags
  967. //  Format
  968. //      Desired pixel format.  If D3DFMT_UNKNOWN, the format will be
  969. //      taken from the file.
  970. //  Pool
  971. //      Memory pool to be used to create texture
  972. //  Filter
  973. //      D3DX_FILTER flags controlling how the image is filtered.
  974. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  975. //  MipFilter
  976. //      D3DX_FILTER flags controlling how each miplevel is filtered.
  977. //      Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  978. //  ColorKey
  979. //      Color to replace with transparent black, or 0 to disable colorkey.
  980. //      This is always a 32-bit ARGB color, independent of the source image
  981. //      format.  Alpha is significant, and should usually be set to FF for 
  982. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  983. //  pSrcInfo
  984. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  985. //      description of the data in the source image file, or NULL.
  986. //  pPalette
  987. //      256 color palette to be filled in, or NULL
  988. //  ppTexture, ppCubeTexture, ppVolumeTexture
  989. //      The texture object that will be created
  990. //
  991. //----------------------------------------------------------------------------
  992.  
  993.  
  994. // FromFile
  995.  
  996. HRESULT WINAPI
  997.     D3DXCreateTextureFromFileA(
  998.         LPDIRECT3DDEVICE9         pDevice,
  999.         LPCSTR                    pSrcFile,
  1000.         LPDIRECT3DTEXTURE9*       ppTexture);
  1001.  
  1002. HRESULT WINAPI
  1003.     D3DXCreateTextureFromFileW(
  1004.         LPDIRECT3DDEVICE9         pDevice,
  1005.         LPCWSTR                   pSrcFile,
  1006.         LPDIRECT3DTEXTURE9*       ppTexture);
  1007.  
  1008. #ifdef UNICODE
  1009. #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW
  1010. #else
  1011. #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA
  1012. #endif
  1013.  
  1014.  
  1015. HRESULT WINAPI
  1016.     D3DXCreateCubeTextureFromFileA(
  1017.         LPDIRECT3DDEVICE9         pDevice,
  1018.         LPCSTR                    pSrcFile,
  1019.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1020.  
  1021. HRESULT WINAPI
  1022.     D3DXCreateCubeTextureFromFileW(
  1023.         LPDIRECT3DDEVICE9         pDevice,
  1024.         LPCWSTR                   pSrcFile,
  1025.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1026.  
  1027. #ifdef UNICODE
  1028. #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW
  1029. #else
  1030. #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA
  1031. #endif
  1032.  
  1033.  
  1034. HRESULT WINAPI
  1035.     D3DXCreateVolumeTextureFromFileA(
  1036.         LPDIRECT3DDEVICE9         pDevice,
  1037.         LPCSTR                    pSrcFile,
  1038.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1039.  
  1040. HRESULT WINAPI
  1041.     D3DXCreateVolumeTextureFromFileW(
  1042.         LPDIRECT3DDEVICE9         pDevice,
  1043.         LPCWSTR                   pSrcFile,
  1044.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1045.  
  1046. #ifdef UNICODE
  1047. #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW
  1048. #else
  1049. #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA
  1050. #endif
  1051.  
  1052.  
  1053. // FromResource
  1054.  
  1055. HRESULT WINAPI
  1056.     D3DXCreateTextureFromResourceA(
  1057.         LPDIRECT3DDEVICE9         pDevice,
  1058.         HMODULE                   hSrcModule,
  1059.         LPCSTR                    pSrcResource,
  1060.         LPDIRECT3DTEXTURE9*       ppTexture);
  1061.  
  1062. HRESULT WINAPI
  1063.     D3DXCreateTextureFromResourceW(
  1064.         LPDIRECT3DDEVICE9         pDevice,
  1065.         HMODULE                   hSrcModule,
  1066.         LPCWSTR                   pSrcResource,
  1067.         LPDIRECT3DTEXTURE9*       ppTexture);
  1068.  
  1069. #ifdef UNICODE
  1070. #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW
  1071. #else
  1072. #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA
  1073. #endif
  1074.  
  1075.  
  1076. HRESULT WINAPI
  1077.     D3DXCreateCubeTextureFromResourceA(
  1078.         LPDIRECT3DDEVICE9         pDevice,
  1079.         HMODULE                   hSrcModule,
  1080.         LPCSTR                    pSrcResource,
  1081.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1082.  
  1083. HRESULT WINAPI
  1084.     D3DXCreateCubeTextureFromResourceW(
  1085.         LPDIRECT3DDEVICE9         pDevice,
  1086.         HMODULE                   hSrcModule,
  1087.         LPCWSTR                   pSrcResource,
  1088.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1089.  
  1090. #ifdef UNICODE
  1091. #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW
  1092. #else
  1093. #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA
  1094. #endif
  1095.  
  1096.  
  1097. HRESULT WINAPI
  1098.     D3DXCreateVolumeTextureFromResourceA(
  1099.         LPDIRECT3DDEVICE9         pDevice,
  1100.         HMODULE                   hSrcModule,
  1101.         LPCSTR                    pSrcResource,
  1102.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1103.  
  1104. HRESULT WINAPI
  1105.     D3DXCreateVolumeTextureFromResourceW(
  1106.         LPDIRECT3DDEVICE9         pDevice,
  1107.         HMODULE                   hSrcModule,
  1108.         LPCWSTR                   pSrcResource,
  1109.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1110.  
  1111. #ifdef UNICODE
  1112. #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW
  1113. #else
  1114. #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA
  1115. #endif
  1116.  
  1117.  
  1118. // FromFileEx
  1119.  
  1120. HRESULT WINAPI
  1121.     D3DXCreateTextureFromFileExA(
  1122.         LPDIRECT3DDEVICE9         pDevice,
  1123.         LPCSTR                    pSrcFile,
  1124.         UINT                      Width,
  1125.         UINT                      Height,
  1126.         UINT                      MipLevels,
  1127.         DWORD                     Usage,
  1128.         D3DFORMAT                 Format,
  1129.         D3DPOOL                   Pool,
  1130.         DWORD                     Filter,
  1131.         DWORD                     MipFilter,
  1132.         D3DCOLOR                  ColorKey,
  1133.         D3DXIMAGE_INFO*           pSrcInfo,
  1134.         PALETTEENTRY*             pPalette,
  1135.         LPDIRECT3DTEXTURE9*       ppTexture);
  1136.  
  1137. HRESULT WINAPI
  1138.     D3DXCreateTextureFromFileExW(
  1139.         LPDIRECT3DDEVICE9         pDevice,
  1140.         LPCWSTR                   pSrcFile,
  1141.         UINT                      Width,
  1142.         UINT                      Height,
  1143.         UINT                      MipLevels,
  1144.         DWORD                     Usage,
  1145.         D3DFORMAT                 Format,
  1146.         D3DPOOL                   Pool,
  1147.         DWORD                     Filter,
  1148.         DWORD                     MipFilter,
  1149.         D3DCOLOR                  ColorKey,
  1150.         D3DXIMAGE_INFO*           pSrcInfo,
  1151.         PALETTEENTRY*             pPalette,
  1152.         LPDIRECT3DTEXTURE9*       ppTexture);
  1153.  
  1154. #ifdef UNICODE
  1155. #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW
  1156. #else
  1157. #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA
  1158. #endif
  1159.  
  1160.  
  1161. HRESULT WINAPI
  1162.     D3DXCreateCubeTextureFromFileExA(
  1163.         LPDIRECT3DDEVICE9         pDevice,
  1164.         LPCSTR                    pSrcFile,
  1165.         UINT                      Size,
  1166.         UINT                      MipLevels,
  1167.         DWORD                     Usage,
  1168.         D3DFORMAT                 Format,
  1169.         D3DPOOL                   Pool,
  1170.         DWORD                     Filter,
  1171.         DWORD                     MipFilter,
  1172.         D3DCOLOR                  ColorKey,
  1173.         D3DXIMAGE_INFO*           pSrcInfo,
  1174.         PALETTEENTRY*             pPalette,
  1175.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1176.  
  1177. HRESULT WINAPI
  1178.     D3DXCreateCubeTextureFromFileExW(
  1179.         LPDIRECT3DDEVICE9         pDevice,
  1180.         LPCWSTR                   pSrcFile,
  1181.         UINT                      Size,
  1182.         UINT                      MipLevels,
  1183.         DWORD                     Usage,
  1184.         D3DFORMAT                 Format,
  1185.         D3DPOOL                   Pool,
  1186.         DWORD                     Filter,
  1187.         DWORD                     MipFilter,
  1188.         D3DCOLOR                  ColorKey,
  1189.         D3DXIMAGE_INFO*           pSrcInfo,
  1190.         PALETTEENTRY*             pPalette,
  1191.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1192.  
  1193. #ifdef UNICODE
  1194. #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW
  1195. #else
  1196. #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA
  1197. #endif
  1198.  
  1199.  
  1200. HRESULT WINAPI
  1201.     D3DXCreateVolumeTextureFromFileExA(
  1202.         LPDIRECT3DDEVICE9         pDevice,
  1203.         LPCSTR                    pSrcFile,
  1204.         UINT                      Width,
  1205.         UINT                      Height,
  1206.         UINT                      Depth,
  1207.         UINT                      MipLevels,
  1208.         DWORD                     Usage,
  1209.         D3DFORMAT                 Format,
  1210.         D3DPOOL                   Pool,
  1211.         DWORD                     Filter,
  1212.         DWORD                     MipFilter,
  1213.         D3DCOLOR                  ColorKey,
  1214.         D3DXIMAGE_INFO*           pSrcInfo,
  1215.         PALETTEENTRY*             pPalette,
  1216.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1217.  
  1218. HRESULT WINAPI
  1219.     D3DXCreateVolumeTextureFromFileExW(
  1220.         LPDIRECT3DDEVICE9         pDevice,
  1221.         LPCWSTR                   pSrcFile,
  1222.         UINT                      Width,
  1223.         UINT                      Height,
  1224.         UINT                      Depth,
  1225.         UINT                      MipLevels,
  1226.         DWORD                     Usage,
  1227.         D3DFORMAT                 Format,
  1228.         D3DPOOL                   Pool,
  1229.         DWORD                     Filter,
  1230.         DWORD                     MipFilter,
  1231.         D3DCOLOR                  ColorKey,
  1232.         D3DXIMAGE_INFO*           pSrcInfo,
  1233.         PALETTEENTRY*             pPalette,
  1234.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1235.  
  1236. #ifdef UNICODE
  1237. #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW
  1238. #else
  1239. #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA
  1240. #endif
  1241.  
  1242.  
  1243. // FromResourceEx
  1244.  
  1245. HRESULT WINAPI
  1246.     D3DXCreateTextureFromResourceExA(
  1247.         LPDIRECT3DDEVICE9         pDevice,
  1248.         HMODULE                   hSrcModule,
  1249.         LPCSTR                    pSrcResource,
  1250.         UINT                      Width,
  1251.         UINT                      Height,
  1252.         UINT                      MipLevels,
  1253.         DWORD                     Usage,
  1254.         D3DFORMAT                 Format,
  1255.         D3DPOOL                   Pool,
  1256.         DWORD                     Filter,
  1257.         DWORD                     MipFilter,
  1258.         D3DCOLOR                  ColorKey,
  1259.         D3DXIMAGE_INFO*           pSrcInfo,
  1260.         PALETTEENTRY*             pPalette,
  1261.         LPDIRECT3DTEXTURE9*       ppTexture);
  1262.  
  1263. HRESULT WINAPI
  1264.     D3DXCreateTextureFromResourceExW(
  1265.         LPDIRECT3DDEVICE9         pDevice,
  1266.         HMODULE                   hSrcModule,
  1267.         LPCWSTR                   pSrcResource,
  1268.         UINT                      Width,
  1269.         UINT                      Height,
  1270.         UINT                      MipLevels,
  1271.         DWORD                     Usage,
  1272.         D3DFORMAT                 Format,
  1273.         D3DPOOL                   Pool,
  1274.         DWORD                     Filter,
  1275.         DWORD                     MipFilter,
  1276.         D3DCOLOR                  ColorKey,
  1277.         D3DXIMAGE_INFO*           pSrcInfo,
  1278.         PALETTEENTRY*             pPalette,
  1279.         LPDIRECT3DTEXTURE9*       ppTexture);
  1280.  
  1281. #ifdef UNICODE
  1282. #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW
  1283. #else
  1284. #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA
  1285. #endif
  1286.  
  1287.  
  1288. HRESULT WINAPI
  1289.     D3DXCreateCubeTextureFromResourceExA(
  1290.         LPDIRECT3DDEVICE9         pDevice,
  1291.         HMODULE                   hSrcModule,
  1292.         LPCSTR                    pSrcResource,
  1293.         UINT                      Size,
  1294.         UINT                      MipLevels,
  1295.         DWORD                     Usage,
  1296.         D3DFORMAT                 Format,
  1297.         D3DPOOL                   Pool,
  1298.         DWORD                     Filter,
  1299.         DWORD                     MipFilter,
  1300.         D3DCOLOR                  ColorKey,
  1301.         D3DXIMAGE_INFO*           pSrcInfo,
  1302.         PALETTEENTRY*             pPalette,
  1303.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1304.  
  1305. HRESULT WINAPI
  1306.     D3DXCreateCubeTextureFromResourceExW(
  1307.         LPDIRECT3DDEVICE9         pDevice,
  1308.         HMODULE                   hSrcModule,
  1309.         LPCWSTR                   pSrcResource,
  1310.         UINT                      Size,
  1311.         UINT                      MipLevels,
  1312.         DWORD                     Usage,
  1313.         D3DFORMAT                 Format,
  1314.         D3DPOOL                   Pool,
  1315.         DWORD                     Filter,
  1316.         DWORD                     MipFilter,
  1317.         D3DCOLOR                  ColorKey,
  1318.         D3DXIMAGE_INFO*           pSrcInfo,
  1319.         PALETTEENTRY*             pPalette,
  1320.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1321.  
  1322. #ifdef UNICODE
  1323. #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW
  1324. #else
  1325. #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA
  1326. #endif
  1327.  
  1328.  
  1329. HRESULT WINAPI
  1330.     D3DXCreateVolumeTextureFromResourceExA(
  1331.         LPDIRECT3DDEVICE9         pDevice,
  1332.         HMODULE                   hSrcModule,
  1333.         LPCSTR                    pSrcResource,
  1334.         UINT                      Width,
  1335.         UINT                      Height,
  1336.         UINT                      Depth,
  1337.         UINT                      MipLevels,
  1338.         DWORD                     Usage,
  1339.         D3DFORMAT                 Format,
  1340.         D3DPOOL                   Pool,
  1341.         DWORD                     Filter,
  1342.         DWORD                     MipFilter,
  1343.         D3DCOLOR                  ColorKey,
  1344.         D3DXIMAGE_INFO*           pSrcInfo,
  1345.         PALETTEENTRY*             pPalette,
  1346.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1347.  
  1348. HRESULT WINAPI
  1349.     D3DXCreateVolumeTextureFromResourceExW(
  1350.         LPDIRECT3DDEVICE9         pDevice,
  1351.         HMODULE                   hSrcModule,
  1352.         LPCWSTR                   pSrcResource,
  1353.         UINT                      Width,
  1354.         UINT                      Height,
  1355.         UINT                      Depth,
  1356.         UINT                      MipLevels,
  1357.         DWORD                     Usage,
  1358.         D3DFORMAT                 Format,
  1359.         D3DPOOL                   Pool,
  1360.         DWORD                     Filter,
  1361.         DWORD                     MipFilter,
  1362.         D3DCOLOR                  ColorKey,
  1363.         D3DXIMAGE_INFO*           pSrcInfo,
  1364.         PALETTEENTRY*             pPalette,
  1365.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1366.  
  1367. #ifdef UNICODE
  1368. #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW
  1369. #else
  1370. #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA
  1371. #endif
  1372.  
  1373.  
  1374. // FromFileInMemory
  1375.  
  1376. HRESULT WINAPI
  1377.     D3DXCreateTextureFromFileInMemory(
  1378.         LPDIRECT3DDEVICE9         pDevice,
  1379.         LPCVOID                   pSrcData,
  1380.         UINT                      SrcDataSize,
  1381.         LPDIRECT3DTEXTURE9*       ppTexture);
  1382.  
  1383. HRESULT WINAPI
  1384.     D3DXCreateCubeTextureFromFileInMemory(
  1385.         LPDIRECT3DDEVICE9         pDevice,
  1386.         LPCVOID                   pSrcData,
  1387.         UINT                      SrcDataSize,
  1388.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1389.  
  1390. HRESULT WINAPI
  1391.     D3DXCreateVolumeTextureFromFileInMemory(
  1392.         LPDIRECT3DDEVICE9         pDevice,
  1393.         LPCVOID                   pSrcData,
  1394.         UINT                      SrcDataSize,
  1395.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1396.  
  1397.  
  1398. // FromFileInMemoryEx
  1399.  
  1400. HRESULT WINAPI
  1401.     D3DXCreateTextureFromFileInMemoryEx(
  1402.         LPDIRECT3DDEVICE9         pDevice,
  1403.         LPCVOID                   pSrcData,
  1404.         UINT                      SrcDataSize,
  1405.         UINT                      Width,
  1406.         UINT                      Height,
  1407.         UINT                      MipLevels,
  1408.         DWORD                     Usage,
  1409.         D3DFORMAT                 Format,
  1410.         D3DPOOL                   Pool,
  1411.         DWORD                     Filter,
  1412.         DWORD                     MipFilter,
  1413.         D3DCOLOR                  ColorKey,
  1414.         D3DXIMAGE_INFO*           pSrcInfo,
  1415.         PALETTEENTRY*             pPalette,
  1416.         LPDIRECT3DTEXTURE9*       ppTexture);
  1417.  
  1418. HRESULT WINAPI
  1419.     D3DXCreateCubeTextureFromFileInMemoryEx(
  1420.         LPDIRECT3DDEVICE9         pDevice,
  1421.         LPCVOID                   pSrcData,
  1422.         UINT                      SrcDataSize,
  1423.         UINT                      Size,
  1424.         UINT                      MipLevels,
  1425.         DWORD                     Usage,
  1426.         D3DFORMAT                 Format,
  1427.         D3DPOOL                   Pool,
  1428.         DWORD                     Filter,
  1429.         DWORD                     MipFilter,
  1430.         D3DCOLOR                  ColorKey,
  1431.         D3DXIMAGE_INFO*           pSrcInfo,
  1432.         PALETTEENTRY*             pPalette,
  1433.         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
  1434.  
  1435. HRESULT WINAPI
  1436.     D3DXCreateVolumeTextureFromFileInMemoryEx(
  1437.         LPDIRECT3DDEVICE9         pDevice,
  1438.         LPCVOID                   pSrcData,
  1439.         UINT                      SrcDataSize,
  1440.         UINT                      Width,
  1441.         UINT                      Height,
  1442.         UINT                      Depth,
  1443.         UINT                      MipLevels,
  1444.         DWORD                     Usage,
  1445.         D3DFORMAT                 Format,
  1446.         D3DPOOL                   Pool,
  1447.         DWORD                     Filter,
  1448.         DWORD                     MipFilter,
  1449.         D3DCOLOR                  ColorKey,
  1450.         D3DXIMAGE_INFO*           pSrcInfo,
  1451.         PALETTEENTRY*             pPalette,
  1452.         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
  1453.  
  1454.  
  1455.  
  1456. //----------------------------------------------------------------------------
  1457. // D3DXSaveTextureToFile:
  1458. // ----------------------
  1459. // Save a texture to a file.
  1460. //
  1461. // Parameters:
  1462. //  pDestFile
  1463. //      File name of the destination file
  1464. //  DestFormat
  1465. //      D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  1466. //  pSrcTexture
  1467. //      Source texture, containing the image to be saved
  1468. //  pSrcPalette
  1469. //      Source palette of 256 colors, or NULL
  1470. //
  1471. //----------------------------------------------------------------------------
  1472.  
  1473.  
  1474. HRESULT WINAPI
  1475.     D3DXSaveTextureToFileA(
  1476.         LPCSTR                    pDestFile,
  1477.         D3DXIMAGE_FILEFORMAT      DestFormat,
  1478.         LPDIRECT3DBASETEXTURE9    pSrcTexture,
  1479.         CONST PALETTEENTRY*       pSrcPalette);
  1480.  
  1481. HRESULT WINAPI
  1482.     D3DXSaveTextureToFileW(
  1483.         LPCWSTR                   pDestFile,
  1484.         D3DXIMAGE_FILEFORMAT      DestFormat,
  1485.         LPDIRECT3DBASETEXTURE9    pSrcTexture,
  1486.         CONST PALETTEENTRY*       pSrcPalette);
  1487.  
  1488. #ifdef UNICODE
  1489. #define D3DXSaveTextureToFile D3DXSaveTextureToFileW
  1490. #else
  1491. #define D3DXSaveTextureToFile D3DXSaveTextureToFileA
  1492. #endif
  1493.  
  1494.  
  1495.  
  1496.  
  1497. //////////////////////////////////////////////////////////////////////////////
  1498. // Misc Texture APIs /////////////////////////////////////////////////////////
  1499. //////////////////////////////////////////////////////////////////////////////
  1500.  
  1501. //----------------------------------------------------------------------------
  1502. // D3DXFilterTexture:
  1503. // ------------------
  1504. // Filters mipmaps levels of a texture.
  1505. //
  1506. // Parameters:
  1507. //  pBaseTexture
  1508. //      The texture object to be filtered
  1509. //  pPalette
  1510. //      256 color palette to be used, or NULL for non-palettized formats
  1511. //  SrcLevel
  1512. //      The level whose image is used to generate the subsequent levels. 
  1513. //  Filter
  1514. //      D3DX_FILTER flags controlling how each miplevel is filtered.
  1515. //      Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  1516. //
  1517. //----------------------------------------------------------------------------
  1518.  
  1519. HRESULT WINAPI
  1520.     D3DXFilterTexture(
  1521.         LPDIRECT3DBASETEXTURE9    pBaseTexture,
  1522.         CONST PALETTEENTRY*       pPalette,
  1523.         UINT                      SrcLevel,
  1524.         DWORD                     Filter);
  1525.  
  1526. #define D3DXFilterCubeTexture D3DXFilterTexture
  1527. #define D3DXFilterVolumeTexture D3DXFilterTexture
  1528.  
  1529.  
  1530.  
  1531. //----------------------------------------------------------------------------
  1532. // D3DXFillTexture:
  1533. // ----------------
  1534. // Uses a user provided function to fill each texel of each mip level of a
  1535. // given texture.
  1536. //
  1537. // Paramters:
  1538. //  pTexture, pCubeTexture, pVolumeTexture
  1539. //      Pointer to the texture to be filled.
  1540. //  pFunction
  1541. //      Pointer to user provided evalutor function which will be used to 
  1542. //      compute the value of each texel.
  1543. //  pData
  1544. //      Pointer to an arbitrary block of user defined data.  This pointer 
  1545. //      will be passed to the function provided in pFunction
  1546. //-----------------------------------------------------------------------------
  1547.  
  1548. HRESULT WINAPI
  1549.     D3DXFillTexture(
  1550.         LPDIRECT3DTEXTURE9        pTexture,
  1551.         LPD3DXFILL2D              pFunction,
  1552.         LPVOID                    pData);
  1553.  
  1554. HRESULT WINAPI
  1555.     D3DXFillCubeTexture(
  1556.         LPDIRECT3DCUBETEXTURE9    pCubeTexture,
  1557.         LPD3DXFILL3D              pFunction,
  1558.         LPVOID                    pData);
  1559.  
  1560. HRESULT WINAPI
  1561.     D3DXFillVolumeTexture(
  1562.         LPDIRECT3DVOLUMETEXTURE9  pVolumeTexture,
  1563.         LPD3DXFILL3D              pFunction,
  1564.         LPVOID                    pData);
  1565.  
  1566. //----------------------------------------------------------------------------
  1567. // D3DXFillTextureTX:
  1568. // ----------------
  1569. // Uses a TX Shader target to function to fill each texel of each mip level of a
  1570. // given texture. The TX Shader target should be a compiled function taking 2
  1571. // 2 paramters and returning a float4 color.
  1572. //
  1573. // Paramters:
  1574. //  pTexture, pCubeTexture, pVolumeTexture
  1575. //      Pointer to the texture to be filled.
  1576. //  pFunction:
  1577. //      Pointer to the compiled function returned by D3DX
  1578. //  pConstants
  1579. //      Constants used by program. Should be filled by user by parsing constant
  1580. //      Table information
  1581. //  Constants
  1582. //      Number of Constants   
  1583. //-----------------------------------------------------------------------------
  1584.  
  1585. HRESULT WINAPI 
  1586.     D3DXFillTextureTX(
  1587.         LPDIRECT3DTEXTURE9        pTexture,
  1588.         CONST DWORD*              pFunction,
  1589.         CONST D3DXVECTOR4*        pConstants,
  1590.         UINT                      Constants);
  1591.  
  1592.  
  1593. HRESULT WINAPI
  1594.     D3DXFillCubeTextureTX(
  1595.         LPDIRECT3DCUBETEXTURE9    pCubeTexture,
  1596.         CONST DWORD*              pFunction,
  1597.         CONST D3DXVECTOR4*        pConstants,
  1598.         UINT                      Constants);
  1599.                                                 
  1600.                                                         
  1601. HRESULT WINAPI 
  1602.     D3DXFillVolumeTextureTX(
  1603.         LPDIRECT3DVOLUMETEXTURE9  pVolumeTexture,
  1604.         CONST DWORD*              pFunction,
  1605.         CONST D3DXVECTOR4*        pConstants,
  1606.         UINT                      Constants);
  1607.  
  1608.  
  1609. //----------------------------------------------------------------------------
  1610. // D3DXComputeNormalMap:
  1611. // ---------------------
  1612. // Converts a height map into a normal map.  The (x,y,z) components of each
  1613. // normal are mapped to the (r,g,b) channels of the output texture.
  1614. //
  1615. // Parameters
  1616. //  pTexture
  1617. //      Pointer to the destination texture
  1618. //  pSrcTexture
  1619. //      Pointer to the source heightmap texture 
  1620. //  pSrcPalette
  1621. //      Source palette of 256 colors, or NULL
  1622. //  Flags
  1623. //      D3DX_NORMALMAP flags
  1624. //  Channel
  1625. //      D3DX_CHANNEL specifying source of height information
  1626. //  Amplitude
  1627. //      The constant value which the height information is multiplied by.
  1628. //---------------------------------------------------------------------------
  1629.  
  1630. HRESULT WINAPI
  1631.     D3DXComputeNormalMap(
  1632.         LPDIRECT3DTEXTURE9        pTexture,
  1633.         LPDIRECT3DTEXTURE9        pSrcTexture,
  1634.         CONST PALETTEENTRY*       pSrcPalette,
  1635.         DWORD                     Flags,
  1636.         DWORD                     Channel,
  1637.         FLOAT                     Amplitude);
  1638.  
  1639.  
  1640.  
  1641.  
  1642. #ifdef __cplusplus
  1643. }
  1644. #endif //__cplusplus
  1645.  
  1646. #endif //__D3DX9TEX_H__
  1647.  
  1648.