Subversion Repositories Games.Chess Giants

Rev

Details | Last modification | View Log | RSS feed

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