windowscodecs: Implement GetSize for BMP decoder.
[wine] / include / wincodec.idl
1 /*
2  * Copyright 2009 Vincent Povirk for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 import "wtypes.idl";
20 import "propidl.idl";
21 import "objidl.idl";
22 import "ocidl.idl";
23
24 #define CODEC_FORCE_DWORD 0x7fffffff
25
26 typedef enum WICDecodeOptions {
27     WICDecodeMetadataCacheOnDemand = 0x00000000,
28     WICDecodeMetadataCacheOnLoad = 0x00000001,
29     WICMETADATACACHEOPTION_FORCE_DWORD = CODEC_FORCE_DWORD
30 } WICDecodeOptions;
31
32 typedef enum WICBitmapCreateCacheOption {
33     WICBitmapNoCache = 0x00000000,
34     WICBitmapCacheOnDemand = 0x00000001,
35     WICBitmapCacheOnLoad = 0x00000002,
36     WICBITMAPCREATECACHEOPTION_FORCE_DWORD = CODEC_FORCE_DWORD
37 } WICBitmapCreateCacheOption;
38
39 typedef enum WICBitmapAlphaChannelOption {
40     WICBitmapUseAlpha = 0x00000000,
41     WICBitmapUsePremultipliedAlpha = 0x00000001,
42     WICBitmapIgnoreAlpha = 0x00000002,
43     WICBITMAPALPHACHANNELOPTIONS_FORCE_DWORD = CODEC_FORCE_DWORD
44 } WICBitmapAlphaChannelOption;
45
46 typedef enum WICBitmapDecoderCapabilities {
47     WICBitmapDecoderCapabilitySameEncoder = 0x00000001,
48     WICBitmapDecoderCapabilityCanDecodeAllImages = 0x00000002,
49     WICBitmapDecoderCapabilityCanDecodeSomeImages = 0x00000004,
50     WICBitmapDecoderCapabilityCanEnumerateMetadata = 0x00000008,
51     WICBitmapDecoderCapabilityCanDecodeThumbnail = 0x00000010,
52 } WICBitmapDecoderCapabilities;
53
54 typedef GUID WICPixelFormatGUID;
55 typedef REFGUID REFWICPixelFormatGUID;
56
57 typedef struct WICRect {
58     INT X;
59     INT Y;
60     INT Width;
61     INT Height;
62 } WICRect;
63
64 cpp_quote("#define WINCODEC_ERR_WRONGSTATE 0x88982f04")
65 cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44")
66
67 interface IWICBitmap;
68 interface IWICComponentInfo;
69 interface IWICBitmapEncoder;
70 interface IWICPalette;
71 interface IWICFormatConverter;
72 interface IWICBitmapScaler;
73 interface IWICBitmapClipper;
74 interface IWICBitmapFlipRotator;
75 interface IWICStream;
76 interface IWICColorContext;
77 interface IWICColorTransform;
78 interface IWICFastMetadataEncoder;
79 interface IWICMetadataQueryReader;
80 interface IWICMetadataQueryWriter;
81 interface IWICBitmapDecoderInfo;
82
83 [
84     object,
85     uuid(00000120-a8f2-4877-ba0a-fd2b6645fb94)
86 ]
87 interface IWICBitmapSource : IUnknown
88 {
89     HRESULT GetSize(
90         [out] UINT *puiWidth,
91         [out] UINT *puiHeight);
92
93     HRESULT GetPixelFormat(
94         [out] WICPixelFormatGUID *pPixelFormat);
95
96     HRESULT GetResolution(
97         [out] double *pDpiX,
98         [out] double *pDpiY);
99
100     HRESULT CopyPalette(
101         [in] IWICPalette *pIPalette);
102
103     HRESULT CopyPixels(
104         [in] const WICRect *prc,
105         [in] UINT cbStride,
106         [in] UINT cbBufferSize,
107         [out, size_is(cbBufferSize)] BYTE *pbBuffer);
108 }
109
110 [
111     object,
112     uuid(3b16811b-6a43-4ec9-a813-3d930c13b940)
113 ]
114 interface IWICBitmapFrameDecode : IWICBitmapSource
115 {
116     HRESULT GetMetadataQueryReader(
117         [out] IWICMetadataQueryReader **ppIMetadataQueryReader);
118
119     HRESULT GetColorContexts(
120         [in] UINT cCount,
121         [in, out, unique, size_is(cCount)] IWICColorContext **ppIColorContexts,
122         [out] UINT *pcActualCount);
123
124     HRESULT GetThumbnail(
125         [out] IWICBitmapSource **ppIThumbnail);
126 }
127
128 [
129     object,
130     uuid(9edde9e7-8dee-47ea-99df-e6faf2ed44bf)
131 ]
132 interface IWICBitmapDecoder : IUnknown
133 {
134     HRESULT QueryCapability(
135         [in] IStream *pIStream,
136         [out] DWORD *pdwCapability);
137
138     HRESULT Initialize(
139         [in] IStream *pIStream,
140         [in] WICDecodeOptions cacheOptions);
141
142     HRESULT GetContainerFormat(
143         [out] GUID *pguidContainerFormat);
144
145     HRESULT GetDecoderInfo(
146         [out] IWICBitmapDecoderInfo **ppIDecoderInfo);
147
148     HRESULT CopyPalette(
149         [in] IWICPalette *pIPalette);
150
151     HRESULT GetMetadataQueryReader(
152         [out] IWICMetadataQueryReader **ppIMetadataQueryReader);
153
154     HRESULT GetPreview(
155         [out] IWICBitmapSource **ppIBitmapSource);
156
157     HRESULT GetColorContexts(
158         [in] UINT cCount,
159         [in, out, unique, size_is(cCount)] IWICColorContext **ppIColorContexts,
160         [out] UINT *pcActualCount);
161
162     HRESULT GetThumbnail(
163         [out] IWICBitmapSource **ppIThumbnail);
164
165     HRESULT GetFrameCount(
166         [out] UINT *pCount);
167
168     HRESULT GetFrame(
169         [in] UINT index,
170         [out] IWICBitmapFrameDecode **ppIBitmapFrame);
171 }
172
173 cpp_quote("DEFINE_GUID(CLSID_WICImagingFactory, 0xcacaf262,0x9370,0x4615,0xa1,0x3b,0x9f,0x55,0x39,0xda,0x4c,0x0a);")
174
175 [
176     object,
177     uuid(ec5ec8a9-c395-4314-9c77-54d7a935ff70)
178 ]
179 interface IWICImagingFactory : IUnknown
180 {
181     HRESULT CreateDecoderFromFilename(
182         [in] LPCWSTR wzFilename,
183         [in, unique] const GUID *pguidVendor,
184         [in] DWORD dwDesiredAccess,
185         [in] WICDecodeOptions metadataOptions,
186         [out, retval] IWICBitmapDecoder **ppIDecoder);
187
188     HRESULT CreateDecoderFromStream(
189         [in] IStream *pIStream,
190         [in, unique] const GUID *pguidVendor,
191         [in] WICDecodeOptions metadataOptions,
192         [out, retval] IWICBitmapDecoder **ppIDecoder);
193
194     HRESULT CreateDecoderFromFileHandle(
195         [in] ULONG_PTR hFile,
196         [in, unique] const GUID *pguidVendor,
197         [in] WICDecodeOptions metadataOptions,
198         [out, retval] IWICBitmapDecoder **ppIDecoder);
199
200     HRESULT CreateComponentInfo(
201         [in] REFCLSID clsidComponent,
202         [out] IWICComponentInfo **ppIInfo);
203
204     HRESULT CreateDecoder(
205         [in] REFGUID guidContainerFormat,
206         [in, unique] const GUID *pguidVendor,
207         [out, retval] IWICBitmapDecoder **ppIDecoder);
208
209     HRESULT CreateEncoder(
210         [in] REFGUID guidContainerFormat,
211         [in, unique] const GUID *pguidVendor,
212         [out, retval] IWICBitmapEncoder **ppIEncoder);
213
214     HRESULT CreatePalette(
215         [out] IWICPalette **ppIPalette);
216
217     HRESULT CreateFormatConverter(
218         [out] IWICFormatConverter **ppIFormatConverter);
219
220     HRESULT CreateBitmapScaler(
221         [out] IWICBitmapScaler **ppIBitmapScaler);
222
223     HRESULT CreateBitmapClipper(
224         [out] IWICBitmapClipper **ppIBitmapClipper);
225
226     HRESULT CreateBitmapFlipRotator(
227         [out] IWICBitmapFlipRotator **ppIBitmapFlipRotator);
228
229     HRESULT CreateStream(
230         [out] IWICStream **ppIWICStream);
231
232     HRESULT CreateColorContext(
233         [out] IWICColorContext **ppIWICColorContext);
234
235     HRESULT CreateColorTransformer(
236         [out] IWICColorTransform **ppIWICColorTransform);
237
238     HRESULT CreateBitmap(
239         [in] UINT uiWidth,
240         [in] UINT uiHeight,
241         [in] REFWICPixelFormatGUID pixelFormat,
242         [in] WICBitmapCreateCacheOption option,
243         [out] IWICBitmap **ppIBitmap);
244
245     HRESULT CreateBitmapFromSource(
246         [in] IWICBitmapSource *piBitmapSource,
247         [in] WICBitmapCreateCacheOption option,
248         [out] IWICBitmap **ppIBitmap);
249
250     HRESULT CreateBitmapFromSourceRect(
251         [in] IWICBitmapSource *piBitmapSource,
252         [in] UINT x,
253         [in] UINT y,
254         [in] UINT width,
255         [in] UINT height,
256         [out] IWICBitmap **ppIBitmap);
257
258     HRESULT CreateBitmapFromMemory(
259         [in] UINT uiWidth,
260         [in] UINT uiHeight,
261         [in] REFWICPixelFormatGUID pixelFormat,
262         [in] UINT cbStride,
263         [in] UINT cbBufferSize,
264         [in, size_is(cbBufferSize)] BYTE *pbBuffer,
265         [out] IWICBitmap **ppIBitmap);
266
267     HRESULT CreateBitmapFromHBITMAP(
268         [in] HBITMAP hBitmap,
269         [in, unique] HPALETTE hPalette,
270         [in] WICBitmapAlphaChannelOption options,
271         [out] IWICBitmap **ppIBitmap);
272
273     HRESULT CreateBitmapFromHICON(
274         [in] HICON hIcon,
275         [out] IWICBitmap **ppIBitmap);
276
277     HRESULT CreateComponentEnumerator(
278         [in] DWORD componentTypes,
279         [in] DWORD options,
280         [out] IEnumUnknown **ppIEnumUnknown);
281
282     HRESULT CreateFastMetadataEncoderFromDecoder(
283         [in] IWICBitmapDecoder *pIDecoder,
284         [out] IWICFastMetadataEncoder **ppIFastEncoder);
285
286     HRESULT CreateFastMetadataEncoderFromFrameDecode(
287         [in] IWICBitmapFrameDecode *pIFrameDecoder,
288         [out] IWICFastMetadataEncoder **ppIFastEncoder);
289
290     HRESULT CreateQueryWriter(
291         [in] REFGUID guidMetadataFormat,
292         [in, unique] const GUID *pguidVendor,
293         [out] IWICMetadataQueryWriter **ppIQueryWriter);
294
295     HRESULT CreateQueryWriterFromReader(
296         [in] IWICMetadataQueryReader *pIQueryReader,
297         [in, unique] const GUID *pguidVendor,
298         [out] IWICMetadataQueryWriter **ppIQueryWriter);
299 }
300
301 cpp_quote("DEFINE_GUID(CLSID_WICBmpDecoder, 0x6b462062,0x7cbf,0x400d,0x9f,0xdb,0x81,0x3d,0xd1,0x0f,0x27,0x78);")
302 cpp_quote("DEFINE_GUID(CLSID_WICPngDecoder, 0x389ea17b,0x5078,0x4cde,0xb6,0xef,0x25,0xc1,0x51,0x75,0xc7,0x51);")
303 cpp_quote("DEFINE_GUID(CLSID_WICIcoDecoder, 0xc61bfcdf,0x2e0f,0x4aad,0xa8,0xd7,0xe0,0x6b,0xaf,0xeb,0xcd,0xfe);")
304 cpp_quote("DEFINE_GUID(CLSID_WICJpegDecoder, 0x9456a480,0xe88b,0x43ea,0x9e,0x73,0x0b,0x2d,0x9b,0x71,0xb1,0xca);")
305 cpp_quote("DEFINE_GUID(CLSID_WICGifDecoder, 0x381dda3c,0x9ce9,0x4834,0xa2,0x3e,0x1f,0x98,0xf8,0xfc,0x52,0xbe);")
306 cpp_quote("DEFINE_GUID(CLSID_WICTiffDecoder, 0xb54e85d9,0xfe23,0x499f,0x8b,0x88,0x6a,0xce,0xa7,0x13,0x75,0x2b);")
307 cpp_quote("DEFINE_GUID(CLSID_WICWmpDecoder, 0xa26cec36,0x234c,0x4950,0xae,0x16,0xe3,0x4a,0xac,0xe7,0x1d,0x0d);")
308
309 cpp_quote("DEFINE_GUID(GUID_ContainerFormatBmp, 0x0af1d87e,0xfcfe,0x4188,0xbd,0xeb,0xa7,0x90,0x64,0x71,0xcb,0xe3);")
310 cpp_quote("DEFINE_GUID(GUID_ContainerFormatPng, 0x1b7cfaf4,0x713f,0x473c,0xbb,0xcd,0x61,0x37,0x42,0x5f,0xae,0xaf);")
311 cpp_quote("DEFINE_GUID(GUID_ContainerFormatIco, 0xa3a860c4,0x338f,0x4c17,0x91,0x9a,0xfb,0xa4,0xb5,0x62,0x8f,0x21);")
312 cpp_quote("DEFINE_GUID(GUID_ContainerFormatJpeg, 0x19e4a5aa,0x5662,0x4fc5,0xa0,0xc0,0x17,0x58,0x02,0x8e,0x10,0x57);")
313 cpp_quote("DEFINE_GUID(GUID_ContainerFormatTiff, 0x163bcc30,0xe2e9,0x4f0b,0x96,0x1d,0xa3,0xe9,0xfd,0xb7,0x88,0xa3);")
314 cpp_quote("DEFINE_GUID(GUID_ContainerFormatGif, 0x1f8a5601,0x7d4d,0x4cbd,0x9c,0x82,0x1b,0xc8,0xd4,0xee,0xb9,0xa5);")
315 cpp_quote("DEFINE_GUID(GUID_ContainerFormatWmp, 0x57a37caa,0x367a,0x4540,0x91,0x6b,0xf1,0x83,0xc5,0x09,0x3a,0x4b);")