d3dx9tex.h 59 KB

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