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 #define D3DX_FILTER_NONE             (1 << 0)
16 #define D3DX_FILTER_POINT            (2 << 0)
17 #define D3DX_FILTER_LINEAR           (3 << 0)
18 #define D3DX_FILTER_TRIANGLE         (4 << 0)
19 #define D3DX_FILTER_BOX              (5 << 0)
20 
21 #define D3DX_FILTER_MIRROR_U         (1 << 16)
22 #define D3DX_FILTER_MIRROR_V         (2 << 16)
23 #define D3DX_FILTER_MIRROR_W         (4 << 16)
24 #define D3DX_FILTER_MIRROR           (7 << 16)
25 
26 #define D3DX_FILTER_DITHER           (1 << 19)
27 #define D3DX_FILTER_DITHER_DIFFUSION (2 << 19)
28 
29 #define D3DX_FILTER_SRGB_IN          (1 << 21)
30 #define D3DX_FILTER_SRGB_OUT         (2 << 21)
31 #define D3DX_FILTER_SRGB             (3 << 21)
32 
33 #define D3DX_SKIP_DDS_MIP_LEVELS_MASK   0x1F
34 #define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT  26
35 #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)))
36 
37 #define D3DX_NORMALMAP_MIRROR_U     (1 << 16)
38 #define D3DX_NORMALMAP_MIRROR_V     (2 << 16)
39 #define D3DX_NORMALMAP_MIRROR       (3 << 16)
40 #define D3DX_NORMALMAP_INVERTSIGN   (8 << 16)
41 #define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16)
42 
43 #define D3DX_CHANNEL_RED            (1 << 0)
44 #define D3DX_CHANNEL_BLUE           (1 << 1)
45 #define D3DX_CHANNEL_GREEN          (1 << 2)
46 #define D3DX_CHANNEL_ALPHA          (1 << 3)
47 #define D3DX_CHANNEL_LUMINANCE      (1 << 4)
48 
49 typedef enum _D3DXIMAGE_FILEFORMAT
50 {
51     D3DXIFF_BMP         = 0,
52     D3DXIFF_JPG         = 1,
53     D3DXIFF_TGA         = 2,
54     D3DXIFF_PNG         = 3,
55     D3DXIFF_DDS         = 4,
56     D3DXIFF_PPM         = 5,
57     D3DXIFF_DIB         = 6,
58     D3DXIFF_HDR         = 7,       /* high dynamic range formats */
59     D3DXIFF_PFM         = 8,
60     D3DXIFF_FORCE_DWORD = 0x7fffffff
61 
62 } D3DXIMAGE_FILEFORMAT;
63 
64 typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut,
65     CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData);
66 
67 typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut,
68     CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData);
69 
70 typedef struct _D3DXIMAGE_INFO
71 {
72     UINT                    Width;
73     UINT                    Height;
74     UINT                    Depth;
75     UINT                    MipLevels;
76     D3DFORMAT               Format;
77     D3DRESOURCETYPE         ResourceType;
78     D3DXIMAGE_FILEFORMAT    ImageFileFormat;
79 
80 } D3DXIMAGE_INFO;
81 
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85 
86 HRESULT WINAPI
87     D3DXGetImageInfoFromFileA(
88         LPCSTR                    pSrcFile,
89         D3DXIMAGE_INFO*           pSrcInfo);
90 
91 HRESULT WINAPI
92     D3DXGetImageInfoFromFileW(
93         LPCWSTR                   pSrcFile,
94         D3DXIMAGE_INFO*           pSrcInfo);
95 
96 #ifdef UNICODE
97 #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW
98 #else
99 #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA
100 #endif
101 
102 HRESULT WINAPI
103     D3DXGetImageInfoFromResourceA(
104         HMODULE                   hSrcModule,
105         LPCSTR                    pSrcResource,
106         D3DXIMAGE_INFO*           pSrcInfo);
107 
108 HRESULT WINAPI
109     D3DXGetImageInfoFromResourceW(
110         HMODULE                   hSrcModule,
111         LPCWSTR                   pSrcResource,
112         D3DXIMAGE_INFO*           pSrcInfo);
113 
114 #ifdef UNICODE
115 #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW
116 #else
117 #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA
118 #endif
119 
120 HRESULT WINAPI
121     D3DXGetImageInfoFromFileInMemory(
122         LPCVOID                   pSrcData,
123         UINT                      SrcDataSize,
124         D3DXIMAGE_INFO*           pSrcInfo);
125 
126 HRESULT WINAPI
127     D3DXLoadSurfaceFromFileA(
128         LPDIRECT3DSURFACE9        pDestSurface,
129         CONST PALETTEENTRY*       pDestPalette,
130         CONST RECT*               pDestRect,
131         LPCSTR                    pSrcFile,
132         CONST RECT*               pSrcRect,
133         DWORD                     Filter,
134         D3DCOLOR                  ColorKey,
135         D3DXIMAGE_INFO*           pSrcInfo);
136 
137 HRESULT WINAPI
138     D3DXLoadSurfaceFromFileW(
139         LPDIRECT3DSURFACE9        pDestSurface,
140         CONST PALETTEENTRY*       pDestPalette,
141         CONST RECT*               pDestRect,
142         LPCWSTR                   pSrcFile,
143         CONST RECT*               pSrcRect,
144         DWORD                     Filter,
145         D3DCOLOR                  ColorKey,
146         D3DXIMAGE_INFO*           pSrcInfo);
147 
148 #ifdef UNICODE
149 #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW
150 #else
151 #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA
152 #endif
153 
154 HRESULT WINAPI
155     D3DXLoadSurfaceFromResourceA(
156         LPDIRECT3DSURFACE9        pDestSurface,
157         CONST PALETTEENTRY*       pDestPalette,
158         CONST RECT*               pDestRect,
159         HMODULE                   hSrcModule,
160         LPCSTR                    pSrcResource,
161         CONST RECT*               pSrcRect,
162         DWORD                     Filter,
163         D3DCOLOR                  ColorKey,
164         D3DXIMAGE_INFO*           pSrcInfo);
165 
166 HRESULT WINAPI
167     D3DXLoadSurfaceFromResourceW(
168         LPDIRECT3DSURFACE9        pDestSurface,
169         CONST PALETTEENTRY*       pDestPalette,
170         CONST RECT*               pDestRect,
171         HMODULE                   hSrcModule,
172         LPCWSTR                   pSrcResource,
173         CONST RECT*               pSrcRect,
174         DWORD                     Filter,
175         D3DCOLOR                  ColorKey,
176         D3DXIMAGE_INFO*           pSrcInfo);
177 
178 #ifdef UNICODE
179 #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW
180 #else
181 #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA
182 #endif
183 
184 HRESULT WINAPI
185     D3DXLoadSurfaceFromFileInMemory(
186         LPDIRECT3DSURFACE9        pDestSurface,
187         CONST PALETTEENTRY*       pDestPalette,
188         CONST RECT*               pDestRect,
189         LPCVOID                   pSrcData,
190         UINT                      SrcDataSize,
191         CONST RECT*               pSrcRect,
192         DWORD                     Filter,
193         D3DCOLOR                  ColorKey,
194         D3DXIMAGE_INFO*           pSrcInfo);
195 
196 HRESULT WINAPI
197     D3DXLoadSurfaceFromSurface(
198         LPDIRECT3DSURFACE9        pDestSurface,
199         CONST PALETTEENTRY*       pDestPalette,
200         CONST RECT*               pDestRect,
201         LPDIRECT3DSURFACE9        pSrcSurface,
202         CONST PALETTEENTRY*       pSrcPalette,
203         CONST RECT*               pSrcRect,
204         DWORD                     Filter,
205         D3DCOLOR                  ColorKey);
206 
207 HRESULT WINAPI
208     D3DXLoadSurfaceFromMemory(
209         LPDIRECT3DSURFACE9        pDestSurface,
210         CONST PALETTEENTRY*       pDestPalette,
211         CONST RECT*               pDestRect,
212         LPCVOID                   pSrcMemory,
213         D3DFORMAT                 SrcFormat,
214         UINT                      SrcPitch,
215         CONST PALETTEENTRY*       pSrcPalette,
216         CONST RECT*               pSrcRect,
217         DWORD                     Filter,
218         D3DCOLOR                  ColorKey);
219 
220 HRESULT WINAPI
221     D3DXSaveSurfaceToFileA(
222         LPCSTR                    pDestFile,
223         D3DXIMAGE_FILEFORMAT      DestFormat,
224         LPDIRECT3DSURFACE9        pSrcSurface,
225         CONST PALETTEENTRY*       pSrcPalette,
226         CONST RECT*               pSrcRect);
227 
228 HRESULT WINAPI
229     D3DXSaveSurfaceToFileW(
230         LPCWSTR                   pDestFile,
231         D3DXIMAGE_FILEFORMAT      DestFormat,
232         LPDIRECT3DSURFACE9        pSrcSurface,
233         CONST PALETTEENTRY*       pSrcPalette,
234         CONST RECT*               pSrcRect);
235 
236 #ifdef UNICODE
237 #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW
238 #else
239 #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA
240 #endif
241 
242 HRESULT WINAPI
243     D3DXSaveSurfaceToFileInMemory(
244         LPD3DXBUFFER*             ppDestBuf,
245         D3DXIMAGE_FILEFORMAT      DestFormat,
246         LPDIRECT3DSURFACE9        pSrcSurface,
247         CONST PALETTEENTRY*       pSrcPalette,
248         CONST RECT*               pSrcRect);
249 
250 /*
251  * Load/Save Volume APIs
252  */
253 
254 HRESULT WINAPI
255     D3DXLoadVolumeFromFileA(
256         LPDIRECT3DVOLUME9         pDestVolume,
257         CONST PALETTEENTRY*       pDestPalette,
258         CONST D3DBOX*             pDestBox,
259         LPCSTR                    pSrcFile,
260         CONST D3DBOX*             pSrcBox,
261         DWORD                     Filter,
262         D3DCOLOR                  ColorKey,
263         D3DXIMAGE_INFO*           pSrcInfo);
264 
265 HRESULT WINAPI
266     D3DXLoadVolumeFromFileW(
267         LPDIRECT3DVOLUME9         pDestVolume,
268         CONST PALETTEENTRY*       pDestPalette,
269         CONST D3DBOX*             pDestBox,
270         LPCWSTR                   pSrcFile,
271         CONST D3DBOX*             pSrcBox,
272         DWORD                     Filter,
273         D3DCOLOR                  ColorKey,
274         D3DXIMAGE_INFO*           pSrcInfo);
275 
276 #ifdef UNICODE
277 #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW
278 #else
279 #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA
280 #endif
281 
282 HRESULT WINAPI
283     D3DXLoadVolumeFromResourceA(
284         LPDIRECT3DVOLUME9         pDestVolume,
285         CONST PALETTEENTRY*       pDestPalette,
286         CONST D3DBOX*             pDestBox,
287         HMODULE                   hSrcModule,
288         LPCSTR                    pSrcResource,
289         CONST D3DBOX*             pSrcBox,
290         DWORD                     Filter,
291         D3DCOLOR                  ColorKey,
292         D3DXIMAGE_INFO*           pSrcInfo);
293 
294 HRESULT WINAPI
295     D3DXLoadVolumeFromResourceW(
296         LPDIRECT3DVOLUME9         pDestVolume,
297         CONST PALETTEENTRY*       pDestPalette,
298         CONST D3DBOX*             pDestBox,
299         HMODULE                   hSrcModule,
300         LPCWSTR                   pSrcResource,
301         CONST D3DBOX*             pSrcBox,
302         DWORD                     Filter,
303         D3DCOLOR                  ColorKey,
304         D3DXIMAGE_INFO*           pSrcInfo);
305 
306 #ifdef UNICODE
307 #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW
308 #else
309 #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA
310 #endif
311 
312 HRESULT WINAPI
313     D3DXLoadVolumeFromFileInMemory(
314         LPDIRECT3DVOLUME9         pDestVolume,
315         CONST PALETTEENTRY*       pDestPalette,
316         CONST D3DBOX*             pDestBox,
317         LPCVOID                   pSrcData,
318         UINT                      SrcDataSize,
319         CONST D3DBOX*             pSrcBox,
320         DWORD                     Filter,
321         D3DCOLOR                  ColorKey,
322         D3DXIMAGE_INFO*           pSrcInfo);
323 
324 HRESULT WINAPI
325     D3DXLoadVolumeFromVolume(
326         LPDIRECT3DVOLUME9         pDestVolume,
327         CONST PALETTEENTRY*       pDestPalette,
328         CONST D3DBOX*             pDestBox,
329         LPDIRECT3DVOLUME9         pSrcVolume,
330         CONST PALETTEENTRY*       pSrcPalette,
331         CONST D3DBOX*             pSrcBox,
332         DWORD                     Filter,
333         D3DCOLOR                  ColorKey);
334 
335 HRESULT WINAPI
336     D3DXLoadVolumeFromMemory(
337         LPDIRECT3DVOLUME9         pDestVolume,
338         CONST PALETTEENTRY*       pDestPalette,
339         CONST D3DBOX*             pDestBox,
340         LPCVOID                   pSrcMemory,
341         D3DFORMAT                 SrcFormat,
342         UINT                      SrcRowPitch,
343         UINT                      SrcSlicePitch,
344         CONST PALETTEENTRY*       pSrcPalette,
345         CONST D3DBOX*             pSrcBox,
346         DWORD                     Filter,
347         D3DCOLOR                  ColorKey);
348 
349 HRESULT WINAPI
350     D3DXSaveVolumeToFileA(
351         LPCSTR                    pDestFile,
352         D3DXIMAGE_FILEFORMAT      DestFormat,
353         LPDIRECT3DVOLUME9         pSrcVolume,
354         CONST PALETTEENTRY*       pSrcPalette,
355         CONST D3DBOX*             pSrcBox);
356 
357 HRESULT WINAPI
358     D3DXSaveVolumeToFileW(
359         LPCWSTR                   pDestFile,
360         D3DXIMAGE_FILEFORMAT      DestFormat,
361         LPDIRECT3DVOLUME9         pSrcVolume,
362         CONST PALETTEENTRY*       pSrcPalette,
363         CONST D3DBOX*             pSrcBox);
364 
365 #ifdef UNICODE
366 #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW
367 #else
368 #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA
369 #endif
370 
371 HRESULT WINAPI
372     D3DXSaveVolumeToFileInMemory(
373         LPD3DXBUFFER*             ppDestBuf,
374         D3DXIMAGE_FILEFORMAT      DestFormat,
375         LPDIRECT3DVOLUME9         pSrcVolume,
376         CONST PALETTEENTRY*       pSrcPalette,
377         CONST D3DBOX*             pSrcBox);
378 
379 /*
380  * Create/Save Texture APIs
381  */
382 
383 HRESULT WINAPI
384     D3DXCheckTextureRequirements(
385         LPDIRECT3DDEVICE9         pDevice,
386         UINT*                     pWidth,
387         UINT*                     pHeight,
388         UINT*                     pNumMipLevels,
389         DWORD                     Usage,
390         D3DFORMAT*                pFormat,
391         D3DPOOL                   Pool);
392 
393 HRESULT WINAPI
394     D3DXCheckCubeTextureRequirements(
395         LPDIRECT3DDEVICE9         pDevice,
396         UINT*                     pSize,
397         UINT*                     pNumMipLevels,
398         DWORD                     Usage,
399         D3DFORMAT*                pFormat,
400         D3DPOOL                   Pool);
401 
402 HRESULT WINAPI
403     D3DXCheckVolumeTextureRequirements(
404         LPDIRECT3DDEVICE9         pDevice,
405         UINT*                     pWidth,
406         UINT*                     pHeight,
407         UINT*                     pDepth,
408         UINT*                     pNumMipLevels,
409         DWORD                     Usage,
410         D3DFORMAT*                pFormat,
411         D3DPOOL                   Pool);
412 
413 HRESULT WINAPI
414     D3DXCreateTexture(
415         LPDIRECT3DDEVICE9         pDevice,
416         UINT                      Width,
417         UINT                      Height,
418         UINT                      MipLevels,
419         DWORD                     Usage,
420         D3DFORMAT                 Format,
421         D3DPOOL                   Pool,
422         LPDIRECT3DTEXTURE9*       ppTexture);
423 
424 HRESULT WINAPI
425     D3DXCreateCubeTexture(
426         LPDIRECT3DDEVICE9         pDevice,
427         UINT                      Size,
428         UINT                      MipLevels,
429         DWORD                     Usage,
430         D3DFORMAT                 Format,
431         D3DPOOL                   Pool,
432         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
433 
434 HRESULT WINAPI
435     D3DXCreateVolumeTexture(
436         LPDIRECT3DDEVICE9         pDevice,
437         UINT                      Width,
438         UINT                      Height,
439         UINT                      Depth,
440         UINT                      MipLevels,
441         DWORD                     Usage,
442         D3DFORMAT                 Format,
443         D3DPOOL                   Pool,
444         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
445 
446 HRESULT WINAPI
447     D3DXCreateTextureFromFileA(
448         LPDIRECT3DDEVICE9         pDevice,
449         LPCSTR                    pSrcFile,
450         LPDIRECT3DTEXTURE9*       ppTexture);
451 
452 HRESULT WINAPI
453     D3DXCreateTextureFromFileW(
454         LPDIRECT3DDEVICE9         pDevice,
455         LPCWSTR                   pSrcFile,
456         LPDIRECT3DTEXTURE9*       ppTexture);
457 
458 #ifdef UNICODE
459 #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW
460 #else
461 #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA
462 #endif
463 
464 HRESULT WINAPI
465     D3DXCreateCubeTextureFromFileA(
466         LPDIRECT3DDEVICE9         pDevice,
467         LPCSTR                    pSrcFile,
468         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
469 
470 HRESULT WINAPI
471     D3DXCreateCubeTextureFromFileW(
472         LPDIRECT3DDEVICE9         pDevice,
473         LPCWSTR                   pSrcFile,
474         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
475 
476 #ifdef UNICODE
477 #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW
478 #else
479 #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA
480 #endif
481 
482 HRESULT WINAPI
483     D3DXCreateVolumeTextureFromFileA(
484         LPDIRECT3DDEVICE9         pDevice,
485         LPCSTR                    pSrcFile,
486         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
487 
488 HRESULT WINAPI
489     D3DXCreateVolumeTextureFromFileW(
490         LPDIRECT3DDEVICE9         pDevice,
491         LPCWSTR                   pSrcFile,
492         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
493 
494 #ifdef UNICODE
495 #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW
496 #else
497 #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA
498 #endif
499 
500 HRESULT WINAPI
501     D3DXCreateTextureFromResourceA(
502         LPDIRECT3DDEVICE9         pDevice,
503         HMODULE                   hSrcModule,
504         LPCSTR                    pSrcResource,
505         LPDIRECT3DTEXTURE9*       ppTexture);
506 
507 HRESULT WINAPI
508     D3DXCreateTextureFromResourceW(
509         LPDIRECT3DDEVICE9         pDevice,
510         HMODULE                   hSrcModule,
511         LPCWSTR                   pSrcResource,
512         LPDIRECT3DTEXTURE9*       ppTexture);
513 
514 #ifdef UNICODE
515 #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW
516 #else
517 #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA
518 #endif
519 
520 HRESULT WINAPI
521     D3DXCreateCubeTextureFromResourceA(
522         LPDIRECT3DDEVICE9         pDevice,
523         HMODULE                   hSrcModule,
524         LPCSTR                    pSrcResource,
525         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
526 
527 HRESULT WINAPI
528     D3DXCreateCubeTextureFromResourceW(
529         LPDIRECT3DDEVICE9         pDevice,
530         HMODULE                   hSrcModule,
531         LPCWSTR                   pSrcResource,
532         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
533 
534 #ifdef UNICODE
535 #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW
536 #else
537 #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA
538 #endif
539 
540 HRESULT WINAPI
541     D3DXCreateVolumeTextureFromResourceA(
542         LPDIRECT3DDEVICE9         pDevice,
543         HMODULE                   hSrcModule,
544         LPCSTR                    pSrcResource,
545         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
546 
547 HRESULT WINAPI
548     D3DXCreateVolumeTextureFromResourceW(
549         LPDIRECT3DDEVICE9         pDevice,
550         HMODULE                   hSrcModule,
551         LPCWSTR                   pSrcResource,
552         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
553 
554 #ifdef UNICODE
555 #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW
556 #else
557 #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA
558 #endif
559 
560 /* FromFileEx */
561 
562 HRESULT WINAPI
563     D3DXCreateTextureFromFileExA(
564         LPDIRECT3DDEVICE9         pDevice,
565         LPCSTR                    pSrcFile,
566         UINT                      Width,
567         UINT                      Height,
568         UINT                      MipLevels,
569         DWORD                     Usage,
570         D3DFORMAT                 Format,
571         D3DPOOL                   Pool,
572         DWORD                     Filter,
573         DWORD                     MipFilter,
574         D3DCOLOR                  ColorKey,
575         D3DXIMAGE_INFO*           pSrcInfo,
576         PALETTEENTRY*             pPalette,
577         LPDIRECT3DTEXTURE9*       ppTexture);
578 
579 HRESULT WINAPI
580     D3DXCreateTextureFromFileExW(
581         LPDIRECT3DDEVICE9         pDevice,
582         LPCWSTR                   pSrcFile,
583         UINT                      Width,
584         UINT                      Height,
585         UINT                      MipLevels,
586         DWORD                     Usage,
587         D3DFORMAT                 Format,
588         D3DPOOL                   Pool,
589         DWORD                     Filter,
590         DWORD                     MipFilter,
591         D3DCOLOR                  ColorKey,
592         D3DXIMAGE_INFO*           pSrcInfo,
593         PALETTEENTRY*             pPalette,
594         LPDIRECT3DTEXTURE9*       ppTexture);
595 
596 #ifdef UNICODE
597 #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW
598 #else
599 #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA
600 #endif
601 
602 HRESULT WINAPI
603     D3DXCreateCubeTextureFromFileExA(
604         LPDIRECT3DDEVICE9         pDevice,
605         LPCSTR                    pSrcFile,
606         UINT                      Size,
607         UINT                      MipLevels,
608         DWORD                     Usage,
609         D3DFORMAT                 Format,
610         D3DPOOL                   Pool,
611         DWORD                     Filter,
612         DWORD                     MipFilter,
613         D3DCOLOR                  ColorKey,
614         D3DXIMAGE_INFO*           pSrcInfo,
615         PALETTEENTRY*             pPalette,
616         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
617 
618 HRESULT WINAPI
619     D3DXCreateCubeTextureFromFileExW(
620         LPDIRECT3DDEVICE9         pDevice,
621         LPCWSTR                   pSrcFile,
622         UINT                      Size,
623         UINT                      MipLevels,
624         DWORD                     Usage,
625         D3DFORMAT                 Format,
626         D3DPOOL                   Pool,
627         DWORD                     Filter,
628         DWORD                     MipFilter,
629         D3DCOLOR                  ColorKey,
630         D3DXIMAGE_INFO*           pSrcInfo,
631         PALETTEENTRY*             pPalette,
632         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
633 
634 #ifdef UNICODE
635 #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW
636 #else
637 #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA
638 #endif
639 
640 HRESULT WINAPI
641     D3DXCreateVolumeTextureFromFileExA(
642         LPDIRECT3DDEVICE9         pDevice,
643         LPCSTR                    pSrcFile,
644         UINT                      Width,
645         UINT                      Height,
646         UINT                      Depth,
647         UINT                      MipLevels,
648         DWORD                     Usage,
649         D3DFORMAT                 Format,
650         D3DPOOL                   Pool,
651         DWORD                     Filter,
652         DWORD                     MipFilter,
653         D3DCOLOR                  ColorKey,
654         D3DXIMAGE_INFO*           pSrcInfo,
655         PALETTEENTRY*             pPalette,
656         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
657 
658 HRESULT WINAPI
659     D3DXCreateVolumeTextureFromFileExW(
660         LPDIRECT3DDEVICE9         pDevice,
661         LPCWSTR                   pSrcFile,
662         UINT                      Width,
663         UINT                      Height,
664         UINT                      Depth,
665         UINT                      MipLevels,
666         DWORD                     Usage,
667         D3DFORMAT                 Format,
668         D3DPOOL                   Pool,
669         DWORD                     Filter,
670         DWORD                     MipFilter,
671         D3DCOLOR                  ColorKey,
672         D3DXIMAGE_INFO*           pSrcInfo,
673         PALETTEENTRY*             pPalette,
674         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
675 
676 #ifdef UNICODE
677 #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW
678 #else
679 #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA
680 #endif
681 
682 /* FromResourceEx */
683 
684 HRESULT WINAPI
685     D3DXCreateTextureFromResourceExA(
686         LPDIRECT3DDEVICE9         pDevice,
687         HMODULE                   hSrcModule,
688         LPCSTR                    pSrcResource,
689         UINT                      Width,
690         UINT                      Height,
691         UINT                      MipLevels,
692         DWORD                     Usage,
693         D3DFORMAT                 Format,
694         D3DPOOL                   Pool,
695         DWORD                     Filter,
696         DWORD                     MipFilter,
697         D3DCOLOR                  ColorKey,
698         D3DXIMAGE_INFO*           pSrcInfo,
699         PALETTEENTRY*             pPalette,
700         LPDIRECT3DTEXTURE9*       ppTexture);
701 
702 HRESULT WINAPI
703     D3DXCreateTextureFromResourceExW(
704         LPDIRECT3DDEVICE9         pDevice,
705         HMODULE                   hSrcModule,
706         LPCWSTR                   pSrcResource,
707         UINT                      Width,
708         UINT                      Height,
709         UINT                      MipLevels,
710         DWORD                     Usage,
711         D3DFORMAT                 Format,
712         D3DPOOL                   Pool,
713         DWORD                     Filter,
714         DWORD                     MipFilter,
715         D3DCOLOR                  ColorKey,
716         D3DXIMAGE_INFO*           pSrcInfo,
717         PALETTEENTRY*             pPalette,
718         LPDIRECT3DTEXTURE9*       ppTexture);
719 
720 #ifdef UNICODE
721 #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW
722 #else
723 #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA
724 #endif
725 
726 HRESULT WINAPI
727     D3DXCreateCubeTextureFromResourceExA(
728         LPDIRECT3DDEVICE9         pDevice,
729         HMODULE                   hSrcModule,
730         LPCSTR                    pSrcResource,
731         UINT                      Size,
732         UINT                      MipLevels,
733         DWORD                     Usage,
734         D3DFORMAT                 Format,
735         D3DPOOL                   Pool,
736         DWORD                     Filter,
737         DWORD                     MipFilter,
738         D3DCOLOR                  ColorKey,
739         D3DXIMAGE_INFO*           pSrcInfo,
740         PALETTEENTRY*             pPalette,
741         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
742 
743 HRESULT WINAPI
744     D3DXCreateCubeTextureFromResourceExW(
745         LPDIRECT3DDEVICE9         pDevice,
746         HMODULE                   hSrcModule,
747         LPCWSTR                   pSrcResource,
748         UINT                      Size,
749         UINT                      MipLevels,
750         DWORD                     Usage,
751         D3DFORMAT                 Format,
752         D3DPOOL                   Pool,
753         DWORD                     Filter,
754         DWORD                     MipFilter,
755         D3DCOLOR                  ColorKey,
756         D3DXIMAGE_INFO*           pSrcInfo,
757         PALETTEENTRY*             pPalette,
758         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
759 
760 #ifdef UNICODE
761 #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW
762 #else
763 #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA
764 #endif
765 
766 HRESULT WINAPI
767     D3DXCreateVolumeTextureFromResourceExA(
768         LPDIRECT3DDEVICE9         pDevice,
769         HMODULE                   hSrcModule,
770         LPCSTR                    pSrcResource,
771         UINT                      Width,
772         UINT                      Height,
773         UINT                      Depth,
774         UINT                      MipLevels,
775         DWORD                     Usage,
776         D3DFORMAT                 Format,
777         D3DPOOL                   Pool,
778         DWORD                     Filter,
779         DWORD                     MipFilter,
780         D3DCOLOR                  ColorKey,
781         D3DXIMAGE_INFO*           pSrcInfo,
782         PALETTEENTRY*             pPalette,
783         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
784 
785 HRESULT WINAPI
786     D3DXCreateVolumeTextureFromResourceExW(
787         LPDIRECT3DDEVICE9         pDevice,
788         HMODULE                   hSrcModule,
789         LPCWSTR                   pSrcResource,
790         UINT                      Width,
791         UINT                      Height,
792         UINT                      Depth,
793         UINT                      MipLevels,
794         DWORD                     Usage,
795         D3DFORMAT                 Format,
796         D3DPOOL                   Pool,
797         DWORD                     Filter,
798         DWORD                     MipFilter,
799         D3DCOLOR                  ColorKey,
800         D3DXIMAGE_INFO*           pSrcInfo,
801         PALETTEENTRY*             pPalette,
802         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
803 
804 #ifdef UNICODE
805 #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW
806 #else
807 #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA
808 #endif
809 
810 /* FromFileInMemory */
811 
812 HRESULT WINAPI
813     D3DXCreateTextureFromFileInMemory(
814         LPDIRECT3DDEVICE9         pDevice,
815         LPCVOID                   pSrcData,
816         UINT                      SrcDataSize,
817         LPDIRECT3DTEXTURE9*       ppTexture);
818 
819 HRESULT WINAPI
820     D3DXCreateCubeTextureFromFileInMemory(
821         LPDIRECT3DDEVICE9         pDevice,
822         LPCVOID                   pSrcData,
823         UINT                      SrcDataSize,
824         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
825 
826 HRESULT WINAPI
827     D3DXCreateVolumeTextureFromFileInMemory(
828         LPDIRECT3DDEVICE9         pDevice,
829         LPCVOID                   pSrcData,
830         UINT                      SrcDataSize,
831         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
832 
833 /* FromFileInMemoryEx */
834 
835 HRESULT WINAPI
836     D3DXCreateTextureFromFileInMemoryEx(
837         LPDIRECT3DDEVICE9         pDevice,
838         LPCVOID                   pSrcData,
839         UINT                      SrcDataSize,
840         UINT                      Width,
841         UINT                      Height,
842         UINT                      MipLevels,
843         DWORD                     Usage,
844         D3DFORMAT                 Format,
845         D3DPOOL                   Pool,
846         DWORD                     Filter,
847         DWORD                     MipFilter,
848         D3DCOLOR                  ColorKey,
849         D3DXIMAGE_INFO*           pSrcInfo,
850         PALETTEENTRY*             pPalette,
851         LPDIRECT3DTEXTURE9*       ppTexture);
852 
853 HRESULT WINAPI
854     D3DXCreateCubeTextureFromFileInMemoryEx(
855         LPDIRECT3DDEVICE9         pDevice,
856         LPCVOID                   pSrcData,
857         UINT                      SrcDataSize,
858         UINT                      Size,
859         UINT                      MipLevels,
860         DWORD                     Usage,
861         D3DFORMAT                 Format,
862         D3DPOOL                   Pool,
863         DWORD                     Filter,
864         DWORD                     MipFilter,
865         D3DCOLOR                  ColorKey,
866         D3DXIMAGE_INFO*           pSrcInfo,
867         PALETTEENTRY*             pPalette,
868         LPDIRECT3DCUBETEXTURE9*   ppCubeTexture);
869 
870 HRESULT WINAPI
871     D3DXCreateVolumeTextureFromFileInMemoryEx(
872         LPDIRECT3DDEVICE9         pDevice,
873         LPCVOID                   pSrcData,
874         UINT                      SrcDataSize,
875         UINT                      Width,
876         UINT                      Height,
877         UINT                      Depth,
878         UINT                      MipLevels,
879         DWORD                     Usage,
880         D3DFORMAT                 Format,
881         D3DPOOL                   Pool,
882         DWORD                     Filter,
883         DWORD                     MipFilter,
884         D3DCOLOR                  ColorKey,
885         D3DXIMAGE_INFO*           pSrcInfo,
886         PALETTEENTRY*             pPalette,
887         LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);
888 
889 HRESULT WINAPI
890     D3DXSaveTextureToFileA(
891         LPCSTR                    pDestFile,
892         D3DXIMAGE_FILEFORMAT      DestFormat,
893         LPDIRECT3DBASETEXTURE9    pSrcTexture,
894         CONST PALETTEENTRY*       pSrcPalette);
895 
896 HRESULT WINAPI
897     D3DXSaveTextureToFileW(
898         LPCWSTR                   pDestFile,
899         D3DXIMAGE_FILEFORMAT      DestFormat,
900         LPDIRECT3DBASETEXTURE9    pSrcTexture,
901         CONST PALETTEENTRY*       pSrcPalette);
902 
903 #ifdef UNICODE
904 #define D3DXSaveTextureToFile D3DXSaveTextureToFileW
905 #else
906 #define D3DXSaveTextureToFile D3DXSaveTextureToFileA
907 #endif
908 
909 HRESULT WINAPI
910     D3DXSaveTextureToFileInMemory(
911         LPD3DXBUFFER*             ppDestBuf,
912         D3DXIMAGE_FILEFORMAT      DestFormat,
913         LPDIRECT3DBASETEXTURE9    pSrcTexture,
914         CONST PALETTEENTRY*       pSrcPalette);
915 
916 /*
917  * Misc Texture APIs
918  */
919 
920 HRESULT WINAPI
921     D3DXFilterTexture(
922         LPDIRECT3DBASETEXTURE9    pBaseTexture,
923         CONST PALETTEENTRY*       pPalette,
924         UINT                      SrcLevel,
925         DWORD                     Filter);
926 
927 #define D3DXFilterCubeTexture D3DXFilterTexture
928 #define D3DXFilterVolumeTexture D3DXFilterTexture
929 
930 HRESULT WINAPI
931     D3DXFillTexture(
932         LPDIRECT3DTEXTURE9        pTexture,
933         LPD3DXFILL2D              pFunction,
934         LPVOID                    pData);
935 
936 HRESULT WINAPI
937     D3DXFillCubeTexture(
938         LPDIRECT3DCUBETEXTURE9    pCubeTexture,
939         LPD3DXFILL3D              pFunction,
940         LPVOID                    pData);
941 
942 HRESULT WINAPI
943     D3DXFillVolumeTexture(
944         LPDIRECT3DVOLUMETEXTURE9  pVolumeTexture,
945         LPD3DXFILL3D              pFunction,
946         LPVOID                    pData);
947 
948 HRESULT WINAPI
949     D3DXFillTextureTX(
950         LPDIRECT3DTEXTURE9        pTexture,
951         LPD3DXTEXTURESHADER       pTextureShader);
952 
953 HRESULT WINAPI
954     D3DXFillCubeTextureTX(
955         LPDIRECT3DCUBETEXTURE9    pCubeTexture,
956         LPD3DXTEXTURESHADER       pTextureShader);
957 
958 HRESULT WINAPI
959     D3DXFillVolumeTextureTX(
960         LPDIRECT3DVOLUMETEXTURE9  pVolumeTexture,
961         LPD3DXTEXTURESHADER       pTextureShader);
962 
963 HRESULT WINAPI
964     D3DXComputeNormalMap(
965         LPDIRECT3DTEXTURE9        pTexture,
966         LPDIRECT3DTEXTURE9        pSrcTexture,
967         CONST PALETTEENTRY*       pSrcPalette,
968         DWORD                     Flags,
969         DWORD                     Channel,
970         FLOAT                     Amplitude);
971 
972 #ifdef __cplusplus
973 }
974 #endif
975 
976 #endif /* __D3DX9TEX_H__ */
977