1 /***********************************************************************\
2 *                               d3dx10tex.d                             *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                       Placed into public domain                       *
7 \***********************************************************************/
8 module win32.directx.d3dx10tex;
9 version(Windows):
10 
11 private import win32.windows;
12 private import win32.directx.d3d10;
13 private import win32.directx.d3dx10core;
14 
15 enum D3DX10_FILTER_FLAG {
16 	D3DX10_FILTER_NONE             = 0x000001,
17 	D3DX10_FILTER_POINT            = 0x000002,
18 	D3DX10_FILTER_LINEAR           = 0x000003,
19 	D3DX10_FILTER_TRIANGLE         = 0x000004,
20 	D3DX10_FILTER_BOX              = 0x000005,
21 	D3DX10_FILTER_MIRROR_U         = 0x010000,
22 	D3DX10_FILTER_MIRROR_V         = 0x020000,
23 	D3DX10_FILTER_MIRROR_W         = 0x040000,
24 	D3DX10_FILTER_MIRROR           = 0x070000,
25 	D3DX10_FILTER_DITHER           = 0x080000,
26 	D3DX10_FILTER_DITHER_DIFFUSION = 0x100000,
27 	D3DX10_FILTER_SRGB_IN          = 0x200000,
28 	D3DX10_FILTER_SRGB_OUT         = 0x400000,
29 	D3DX10_FILTER_SRGB             = 0x600000
30 }
31 
32 enum D3DX10_NORMALMAP_FLAG {
33 	D3DX10_NORMALMAP_MIRROR_U          = 0x010000,
34 	D3DX10_NORMALMAP_MIRROR_V          = 0x020000,
35 	D3DX10_NORMALMAP_MIRROR            = 0x030000,
36 	D3DX10_NORMALMAP_INVERTSIGN        = 0x080000,
37 	D3DX10_NORMALMAP_COMPUTE_OCCLUSION = 0x100000
38 }
39 
40 enum D3DX10_CHANNEL_FLAG {
41 	D3DX10_CHANNEL_RED       =  1,
42 	D3DX10_CHANNEL_BLUE      =  2,
43 	D3DX10_CHANNEL_GREEN     =  4,
44 	D3DX10_CHANNEL_ALPHA     =  8,
45 	D3DX10_CHANNEL_LUMINANCE = 16
46 }
47 
48 enum D3DX10_IMAGE_FILE_FORMAT {
49 	D3DX10_IFF_BMP         =  0,
50 	D3DX10_IFF_JPG         =  1,
51 	D3DX10_IFF_PNG         =  3,
52 	D3DX10_IFF_DDS         =  4,
53 	D3DX10_IFF_TIFF        = 10,
54 	D3DX10_IFF_GIF         = 11,
55 	D3DX10_IFF_WMP         = 12,
56 	D3DX10_IFF_FORCE_DWORD = 0x7fffffff
57 }
58 
59 enum D3DX10_SAVE_TEXTURE_FLAG {
60 	D3DX10_STF_USEINPUTBLOB = 1
61 }
62 
63 struct D3DX10_IMAGE_INFO {
64 	UINT        Width;
65 	UINT        Height;
66 	UINT        Depth;
67 	UINT        ArraySize;
68 	UINT        MipLevels;
69 	UINT        MiscFlags;
70 	DXGI_FORMAT Format;
71 	D3D10_RESOURCE_DIMENSION ResourceDimension;
72 	D3DX10_IMAGE_FILE_FORMAT ImageFileFormat;
73 }
74 
75 struct D3DX10_IMAGE_LOAD_INFO {
76 	UINT               Width;
77 	UINT               Height;
78 	UINT               Depth;
79 	UINT               FirstMipLevel;
80 	UINT               MipLevels;
81 	D3D10_USAGE        Usage;
82 	UINT               BindFlags;
83 	UINT               CpuAccessFlags;
84 	UINT               MiscFlags;
85 	DXGI_FORMAT        Format;
86 	UINT               Filter;
87 	UINT               MipFilter;
88 	D3DX10_IMAGE_INFO* pSrcInfo;
89 }
90 
91 HRESULT D3DX10GetImageInfoFromFileA(LPCSTR pSrcFile, ID3DX10ThreadPump pPump,
92   D3DX10_IMAGE_INFO* pSrcInfo, HRESULT* pHResult);
93 HRESULT D3DX10GetImageInfoFromFileW(LPCWSTR pSrcFile, ID3DX10ThreadPump pPump,
94   D3DX10_IMAGE_INFO* pSrcInfo, HRESULT* pHResult);
95 
96 HRESULT D3DX10GetImageInfoFromResourceA(HMODULE hSrcModule,
97   LPCSTR pSrcResource, ID3DX10ThreadPump pPump, D3DX10_IMAGE_INFO* pSrcInfo,
98   HRESULT* pHResult);
99 HRESULT D3DX10GetImageInfoFromResourceW(HMODULE hSrcModule,
100   LPCWSTR pSrcResource, ID3DX10ThreadPump pPump, D3DX10_IMAGE_INFO* pSrcInfo,
101   HRESULT* pHResult);
102 
103 HRESULT D3DX10GetImageInfoFromMemory(LPCVOID pSrcData, SIZE_T SrcDataSize,
104   ID3DX10ThreadPump pPump, D3DX10_IMAGE_INFO* pSrcInfo, HRESULT* pHResult);
105 
106 HRESULT D3DX10CreateShaderResourceViewFromFileA(ID3D10Device pDevice,
107   LPCSTR pSrcFile, D3DX10_IMAGE_LOAD_INFO* pLoadInfo, ID3DX10ThreadPump pPump,
108   ID3D10ShaderResourceView* ppShaderResourceView, HRESULT* pHResult);
109 HRESULT D3DX10CreateShaderResourceViewFromFileW(ID3D10Device pDevice,
110   LPCWSTR pSrcFile, D3DX10_IMAGE_LOAD_INFO* pLoadInfo, ID3DX10ThreadPump pPump,
111   ID3D10ShaderResourceView* ppShaderResourceView, HRESULT* pHResult);
112 
113 HRESULT D3DX10CreateTextureFromFileA(ID3D10Device pDevice, LPCSTR pSrcFile,
114   D3DX10_IMAGE_LOAD_INFO* pLoadInfo, ID3DX10ThreadPump pPump,
115   ID3D10Resource* ppTexture, HRESULT* pHResult);
116 HRESULT D3DX10CreateTextureFromFileW(ID3D10Device pDevice, LPCWSTR pSrcFile,
117   D3DX10_IMAGE_LOAD_INFO* pLoadInfo, ID3DX10ThreadPump pPump,
118   ID3D10Resource* ppTexture, HRESULT* pHResult);
119 
120 HRESULT D3DX10CreateShaderResourceViewFromResourceA(ID3D10Device pDevice,
121   HMODULE hSrcModule, LPCSTR pSrcResource, D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
122   ID3DX10ThreadPump pPump, ID3D10ShaderResourceView* ppShaderResourceView,
123   HRESULT* pHResult);
124 HRESULT D3DX10CreateShaderResourceViewFromResourceW(ID3D10Device pDevice,
125   HMODULE hSrcModule, LPCWSTR pSrcResource, D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
126   ID3DX10ThreadPump pPump, ID3D10ShaderResourceView* ppShaderResourceView,
127   HRESULT* pHResult);
128 
129 HRESULT D3DX10CreateTextureFromResourceA(ID3D10Device pDevice,
130   HMODULE hSrcModule, LPCSTR pSrcResource, D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
131   ID3DX10ThreadPump pPump, ID3D10Resource* ppTexture, HRESULT* pHResult);
132 HRESULT D3DX10CreateTextureFromResourceW(ID3D10Device pDevice,
133   HMODULE hSrcModule, LPCWSTR pSrcResource, D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
134   ID3DX10ThreadPump pPump, ID3D10Resource* ppTexture, HRESULT* pHResult);
135 
136 HRESULT D3DX10CreateShaderResourceViewFromMemory(ID3D10Device pDevice,
137   LPCVOID pSrcData, SIZE_T SrcDataSize, D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
138   ID3DX10ThreadPump pPump, ID3D10ShaderResourceView* ppShaderResourceView,
139   HRESULT* pHResult);
140 
141 HRESULT D3DX10CreateTextureFromMemory(ID3D10Device pDevice, LPCVOID pSrcData,
142   SIZE_T SrcDataSize, D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
143   ID3DX10ThreadPump pPump, ID3D10Resource* ppTexture, HRESULT* pHResult);
144 
145 struct D3DX10_TEXTURE_LOAD_INFO {
146 	D3D10_BOX* pSrcBox;
147 	D3D10_BOX* pDstBox;
148 	UINT       SrcFirstMip;
149 	UINT       DstFirstMip;
150 	UINT       NumMips;
151 	UINT       SrcFirstElement;
152 	UINT       DstFirstElement;
153 	UINT       NumElements;
154 	UINT       Filter;
155 	UINT       MipFilter;
156 }
157 
158 HRESULT D3DX10LoadTextureFromTexture(ID3D10Resource pSrcTexture,
159   D3DX10_TEXTURE_LOAD_INFO* pLoadInfo, ID3D10Resource pDstTexture);
160 
161 HRESULT D3DX10FilterTexture(ID3D10Resource pTexture, UINT SrcLevel, UINT MipFilter);
162 
163 HRESULT D3DX10SaveTextureToFileA(ID3D10Resource pSrcTexture,
164   D3DX10_IMAGE_FILE_FORMAT DestFormat, LPCSTR pDestFile);
165 HRESULT D3DX10SaveTextureToFileW(ID3D10Resource pSrcTexture,
166   D3DX10_IMAGE_FILE_FORMAT DestFormat, LPCWSTR pDestFile);
167 
168 HRESULT D3DX10SaveTextureToMemory(ID3D10Resource pSrcTexture,
169   D3DX10_IMAGE_FILE_FORMAT DestFormat, ID3D10Blob* ppDestBuf, UINT Flags);
170 
171 HRESULT D3DX10ComputeNormalMap(ID3D10Texture2D pSrcTexture, UINT Flags,
172   UINT Channel, FLOAT Amplitude, ID3D10Texture2D pDestTexture);
173 
174 HRESULT D3DX10SHProjectCubeMap(UINT Order, ID3D10Texture2D pCubeMap,
175   FLOAT* pROut, FLOAT* pGOut, FLOAT* pBOut);
176 
177 version(Unicode) {
178 	alias D3DX10GetImageInfoFromFileW D3DX10GetImageInfoFromFile;
179 	alias D3DX10GetImageInfoFromResourceW D3DX10GetImageInfoFromResource;
180 	alias D3DX10CreateShaderResourceViewFromFileW D3DX10CreateShaderResourceViewFromFile;
181 	alias D3DX10CreateTextureFromFileW D3DX10CreateTextureFromFile;
182 	alias D3DX10CreateShaderResourceViewFromResourceW D3DX10CreateShaderResourceViewFromResource;
183 	alias D3DX10CreateTextureFromResourceW D3DX10CreateTextureFromResource;
184 	alias D3DX10SaveTextureToFileW D3DX10SaveTextureToFile;
185 } else {
186 	alias D3DX10GetImageInfoFromFileA D3DX10GetImageInfoFromFile;
187 	alias D3DX10GetImageInfoFromResourceA D3DX10GetImageInfoFromResource;
188 	alias D3DX10CreateShaderResourceViewFromFileA D3DX10CreateShaderResourceViewFromFile;
189 	alias D3DX10CreateTextureFromFileA D3DX10CreateTextureFromFile;
190 	alias D3DX10CreateShaderResourceViewFromResourceA D3DX10CreateShaderResourceViewFromResource;
191 	alias D3DX10CreateTextureFromResourceA D3DX10CreateTextureFromResource;
192 	alias D3DX10SaveTextureToFileA D3DX10SaveTextureToFile;
193 }