2 * Copyright 2009 Vincent Povirk for CodeWeavers
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.
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.
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
24 #define CODEC_FORCE_DWORD
0x7fffffff
26 typedef enum WICDecodeOptions
{
27 WICDecodeMetadataCacheOnDemand
= 0x00000000,
28 WICDecodeMetadataCacheOnLoad
= 0x00000001,
29 WICMETADATACACHEOPTION_FORCE_DWORD
= CODEC_FORCE_DWORD
32 typedef enum WICBitmapCreateCacheOption
{
33 WICBitmapNoCache
= 0x00000000,
34 WICBitmapCacheOnDemand
= 0x00000001,
35 WICBitmapCacheOnLoad
= 0x00000002,
36 WICBITMAPCREATECACHEOPTION_FORCE_DWORD
= CODEC_FORCE_DWORD
37 } WICBitmapCreateCacheOption
;
39 typedef enum WICBitmapAlphaChannelOption
{
40 WICBitmapUseAlpha
= 0x00000000,
41 WICBitmapUsePremultipliedAlpha
= 0x00000001,
42 WICBitmapIgnoreAlpha
= 0x00000002,
43 WICBITMAPALPHACHANNELOPTIONS_FORCE_DWORD
= CODEC_FORCE_DWORD
44 } WICBitmapAlphaChannelOption
;
46 typedef enum WICBitmapDecoderCapabilities
{
47 WICBitmapDecoderCapabilitySameEncoder
= 0x00000001,
48 WICBitmapDecoderCapabilityCanDecodeAllImages
= 0x00000002,
49 WICBitmapDecoderCapabilityCanDecodeSomeImages
= 0x00000004,
50 WICBitmapDecoderCapabilityCanEnumerateMetadata
= 0x00000008,
51 WICBitmapDecoderCapabilityCanDecodeThumbnail
= 0x00000010,
52 } WICBitmapDecoderCapabilities
;
54 typedef enum WICBitmapPaletteType
{
55 WICBitmapPaletteTypeCustom
= 0x00000000,
56 WICBitmapPaletteTypeMedianCut
= 0x00000001,
57 WICBitmapPaletteTypeFixedBW
= 0x00000002,
58 WICBitmapPaletteTypeFixedHalftone8
= 0x00000003,
59 WICBitmapPaletteTypeFixedHalftone27
= 0x00000004,
60 WICBitmapPaletteTypeFixedHalftone64
= 0x00000005,
61 WICBitmapPaletteTypeFixedHalftone125
= 0x00000006,
62 WICBitmapPaletteTypeFixedHalftone216
= 0x00000007,
63 WICBitmapPaletteTypeFixedWebPalette
= WICBitmapPaletteTypeFixedHalftone216
,
64 WICBitmapPaletteTypeFixedHalftone252
= 0x00000008,
65 WICBitmapPaletteTypeFixedHalftone256
= 0x00000009,
66 WICBitmapPaletteTypeFixedGray4
= 0x0000000A,
67 WICBitmapPaletteTypeFixedGray16
= 0x0000000B,
68 WICBitmapPaletteTypeFixedGray256
= 0x0000000C,
69 WICBITMAPPALETTETYPE_FORCE_DWORD
= CODEC_FORCE_DWORD
70 } WICBitmapPaletteType
;
72 typedef GUID WICPixelFormatGUID
;
73 typedef REFGUID REFWICPixelFormatGUID
;
75 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormatDontCare, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x00);")
76 cpp_quote
("#define GUID_WICPixelFormatUndefined GUID_WICPixelFormatDontCare")
78 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormat1bppIndexed, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x01);")
79 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormat2bppIndexed, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x02);")
80 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormat4bppIndexed, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x03);")
81 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormat8bppIndexed, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x04);")
83 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormat16bppBGR555, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x09);")
84 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormat24bppBGR, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x0c);")
85 cpp_quote
("DEFINE_GUID(GUID_WICPixelFormat32bppBGR, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x0e);")
87 typedef struct WICRect
{
94 typedef UINT32 WICColor
;
96 cpp_quote
("#define WINCODEC_ERR_WRONGSTATE 0x88982f04")
97 cpp_quote
("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44")
98 cpp_quote
("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45")
99 cpp_quote
("#define WINCODEC_ERR_UNSUPPORTEDOPERATION 0x88982f81")
101 interface IWICBitmap
;
102 interface IWICComponentInfo
;
103 interface IWICBitmapEncoder
;
104 interface IWICPalette
;
105 interface IWICFormatConverter
;
106 interface IWICBitmapScaler
;
107 interface IWICBitmapClipper
;
108 interface IWICBitmapFlipRotator
;
109 interface IWICStream
;
110 interface IWICColorContext
;
111 interface IWICColorTransform
;
112 interface IWICFastMetadataEncoder
;
113 interface IWICMetadataQueryReader
;
114 interface IWICMetadataQueryWriter
;
115 interface IWICBitmapDecoderInfo
;
119 uuid(00000120-a8f2
-4877-ba0a
-fd2b6645fb94
)
121 interface IWICBitmapSource
: IUnknown
124 [out] UINT
*puiWidth
,
125 [out] UINT
*puiHeight
);
127 HRESULT GetPixelFormat
(
128 [out] WICPixelFormatGUID
*pPixelFormat
);
130 HRESULT GetResolution
(
132 [out] double *pDpiY
);
135 [in] IWICPalette
*pIPalette
);
138 [in] const WICRect
*prc
,
140 [in] UINT cbBufferSize
,
141 [out, size_is(cbBufferSize
)] BYTE *pbBuffer
);
146 uuid(00000040-a8f2
-4877-ba0a
-fd2b6645fb94
)
148 interface IWICPalette
: IUnknown
150 HRESULT InitializePredefined
(
151 [in] WICBitmapPaletteType ePaletteType
,
152 [in] BOOL fAddTransparentColor
);
154 HRESULT InitializeCustom
(
155 [in, size_is(colorCount
)] WICColor
*pColors
,
156 [in] UINT colorCount
);
158 HRESULT InitializeFromBitmap
(
159 [in] IWICBitmapSource
*pISurface
,
160 [in] UINT colorCount
,
161 [in] BOOL fAddTransparentColor
);
163 HRESULT InitializeFromPalette
(
164 [in] IWICPalette
*pIPalette
);
167 [out] WICBitmapPaletteType
*pePaletteType
);
169 HRESULT GetColorCount
(
170 [out] UINT
*pcCount
);
173 [in] UINT colorCount
,
174 [out, size_is(colorCount
)] WICColor
*pColors
,
175 [out] UINT
*pcActualColors
);
177 HRESULT IsBlackWhite
(
178 [out] BOOL
*pfIsBlackWhite
);
181 [out] BOOL
*pfIsGrayscale
);
184 [out] BOOL
*pfHasAlpha
);
189 uuid(3b16811b
-6a43
-4ec9
-a813
-3d930c13b940
)
191 interface IWICBitmapFrameDecode
: IWICBitmapSource
193 HRESULT GetMetadataQueryReader
(
194 [out] IWICMetadataQueryReader
**ppIMetadataQueryReader
);
196 HRESULT GetColorContexts
(
198 [in, out, unique, size_is(cCount
)] IWICColorContext
**ppIColorContexts
,
199 [out] UINT
*pcActualCount
);
201 HRESULT GetThumbnail
(
202 [out] IWICBitmapSource
**ppIThumbnail
);
207 uuid(9edde9e7
-8dee
-47ea
-99df
-e6faf2ed44bf
)
209 interface IWICBitmapDecoder
: IUnknown
211 HRESULT QueryCapability
(
212 [in] IStream
*pIStream
,
213 [out] DWORD
*pdwCapability
);
216 [in] IStream
*pIStream
,
217 [in] WICDecodeOptions cacheOptions
);
219 HRESULT GetContainerFormat
(
220 [out] GUID
*pguidContainerFormat
);
222 HRESULT GetDecoderInfo
(
223 [out] IWICBitmapDecoderInfo
**ppIDecoderInfo
);
226 [in] IWICPalette
*pIPalette
);
228 HRESULT GetMetadataQueryReader
(
229 [out] IWICMetadataQueryReader
**ppIMetadataQueryReader
);
232 [out] IWICBitmapSource
**ppIBitmapSource
);
234 HRESULT GetColorContexts
(
236 [in, out, unique, size_is(cCount
)] IWICColorContext
**ppIColorContexts
,
237 [out] UINT
*pcActualCount
);
239 HRESULT GetThumbnail
(
240 [out] IWICBitmapSource
**ppIThumbnail
);
242 HRESULT GetFrameCount
(
247 [out] IWICBitmapFrameDecode
**ppIBitmapFrame
);
250 cpp_quote
("DEFINE_GUID(CLSID_WICImagingFactory, 0xcacaf262,0x9370,0x4615,0xa1,0x3b,0x9f,0x55,0x39,0xda,0x4c,0x0a);")
254 uuid(ec5ec8a9
-c395
-4314-9c77
-54d7a935ff70
)
256 interface IWICImagingFactory
: IUnknown
258 HRESULT CreateDecoderFromFilename
(
259 [in] LPCWSTR wzFilename
,
260 [in, unique] const GUID
*pguidVendor
,
261 [in] DWORD dwDesiredAccess
,
262 [in] WICDecodeOptions metadataOptions
,
263 [out, retval] IWICBitmapDecoder
**ppIDecoder
);
265 HRESULT CreateDecoderFromStream
(
266 [in] IStream
*pIStream
,
267 [in, unique] const GUID
*pguidVendor
,
268 [in] WICDecodeOptions metadataOptions
,
269 [out, retval] IWICBitmapDecoder
**ppIDecoder
);
271 HRESULT CreateDecoderFromFileHandle
(
272 [in] ULONG_PTR hFile
,
273 [in, unique] const GUID
*pguidVendor
,
274 [in] WICDecodeOptions metadataOptions
,
275 [out, retval] IWICBitmapDecoder
**ppIDecoder
);
277 HRESULT CreateComponentInfo
(
278 [in] REFCLSID clsidComponent
,
279 [out] IWICComponentInfo
**ppIInfo
);
281 HRESULT CreateDecoder
(
282 [in] REFGUID guidContainerFormat
,
283 [in, unique] const GUID
*pguidVendor
,
284 [out, retval] IWICBitmapDecoder
**ppIDecoder
);
286 HRESULT CreateEncoder
(
287 [in] REFGUID guidContainerFormat
,
288 [in, unique] const GUID
*pguidVendor
,
289 [out, retval] IWICBitmapEncoder
**ppIEncoder
);
291 HRESULT CreatePalette
(
292 [out] IWICPalette
**ppIPalette
);
294 HRESULT CreateFormatConverter
(
295 [out] IWICFormatConverter
**ppIFormatConverter
);
297 HRESULT CreateBitmapScaler
(
298 [out] IWICBitmapScaler
**ppIBitmapScaler
);
300 HRESULT CreateBitmapClipper
(
301 [out] IWICBitmapClipper
**ppIBitmapClipper
);
303 HRESULT CreateBitmapFlipRotator
(
304 [out] IWICBitmapFlipRotator
**ppIBitmapFlipRotator
);
306 HRESULT CreateStream
(
307 [out] IWICStream
**ppIWICStream
);
309 HRESULT CreateColorContext
(
310 [out] IWICColorContext
**ppIWICColorContext
);
312 HRESULT CreateColorTransformer
(
313 [out] IWICColorTransform
**ppIWICColorTransform
);
315 HRESULT CreateBitmap
(
318 [in] REFWICPixelFormatGUID pixelFormat
,
319 [in] WICBitmapCreateCacheOption option
,
320 [out] IWICBitmap
**ppIBitmap
);
322 HRESULT CreateBitmapFromSource
(
323 [in] IWICBitmapSource
*piBitmapSource
,
324 [in] WICBitmapCreateCacheOption option
,
325 [out] IWICBitmap
**ppIBitmap
);
327 HRESULT CreateBitmapFromSourceRect
(
328 [in] IWICBitmapSource
*piBitmapSource
,
333 [out] IWICBitmap
**ppIBitmap
);
335 HRESULT CreateBitmapFromMemory
(
338 [in] REFWICPixelFormatGUID pixelFormat
,
340 [in] UINT cbBufferSize
,
341 [in, size_is(cbBufferSize
)] BYTE *pbBuffer
,
342 [out] IWICBitmap
**ppIBitmap
);
344 HRESULT CreateBitmapFromHBITMAP
(
345 [in] HBITMAP hBitmap,
346 [in, unique] HPALETTE hPalette,
347 [in] WICBitmapAlphaChannelOption options
,
348 [out] IWICBitmap
**ppIBitmap
);
350 HRESULT CreateBitmapFromHICON
(
352 [out] IWICBitmap
**ppIBitmap
);
354 HRESULT CreateComponentEnumerator
(
355 [in] DWORD componentTypes
,
357 [out] IEnumUnknown
**ppIEnumUnknown
);
359 HRESULT CreateFastMetadataEncoderFromDecoder
(
360 [in] IWICBitmapDecoder
*pIDecoder
,
361 [out] IWICFastMetadataEncoder
**ppIFastEncoder
);
363 HRESULT CreateFastMetadataEncoderFromFrameDecode
(
364 [in] IWICBitmapFrameDecode
*pIFrameDecoder
,
365 [out] IWICFastMetadataEncoder
**ppIFastEncoder
);
367 HRESULT CreateQueryWriter
(
368 [in] REFGUID guidMetadataFormat
,
369 [in, unique] const GUID
*pguidVendor
,
370 [out] IWICMetadataQueryWriter
**ppIQueryWriter
);
372 HRESULT CreateQueryWriterFromReader
(
373 [in] IWICMetadataQueryReader
*pIQueryReader
,
374 [in, unique] const GUID
*pguidVendor
,
375 [out] IWICMetadataQueryWriter
**ppIQueryWriter
);
378 cpp_quote
("DEFINE_GUID(CLSID_WICBmpDecoder, 0x6b462062,0x7cbf,0x400d,0x9f,0xdb,0x81,0x3d,0xd1,0x0f,0x27,0x78);")
379 cpp_quote
("DEFINE_GUID(CLSID_WICPngDecoder, 0x389ea17b,0x5078,0x4cde,0xb6,0xef,0x25,0xc1,0x51,0x75,0xc7,0x51);")
380 cpp_quote
("DEFINE_GUID(CLSID_WICIcoDecoder, 0xc61bfcdf,0x2e0f,0x4aad,0xa8,0xd7,0xe0,0x6b,0xaf,0xeb,0xcd,0xfe);")
381 cpp_quote
("DEFINE_GUID(CLSID_WICJpegDecoder, 0x9456a480,0xe88b,0x43ea,0x9e,0x73,0x0b,0x2d,0x9b,0x71,0xb1,0xca);")
382 cpp_quote
("DEFINE_GUID(CLSID_WICGifDecoder, 0x381dda3c,0x9ce9,0x4834,0xa2,0x3e,0x1f,0x98,0xf8,0xfc,0x52,0xbe);")
383 cpp_quote
("DEFINE_GUID(CLSID_WICTiffDecoder, 0xb54e85d9,0xfe23,0x499f,0x8b,0x88,0x6a,0xce,0xa7,0x13,0x75,0x2b);")
384 cpp_quote
("DEFINE_GUID(CLSID_WICWmpDecoder, 0xa26cec36,0x234c,0x4950,0xae,0x16,0xe3,0x4a,0xac,0xe7,0x1d,0x0d);")
386 cpp_quote
("DEFINE_GUID(GUID_ContainerFormatBmp, 0x0af1d87e,0xfcfe,0x4188,0xbd,0xeb,0xa7,0x90,0x64,0x71,0xcb,0xe3);")
387 cpp_quote
("DEFINE_GUID(GUID_ContainerFormatPng, 0x1b7cfaf4,0x713f,0x473c,0xbb,0xcd,0x61,0x37,0x42,0x5f,0xae,0xaf);")
388 cpp_quote
("DEFINE_GUID(GUID_ContainerFormatIco, 0xa3a860c4,0x338f,0x4c17,0x91,0x9a,0xfb,0xa4,0xb5,0x62,0x8f,0x21);")
389 cpp_quote
("DEFINE_GUID(GUID_ContainerFormatJpeg, 0x19e4a5aa,0x5662,0x4fc5,0xa0,0xc0,0x17,0x58,0x02,0x8e,0x10,0x57);")
390 cpp_quote
("DEFINE_GUID(GUID_ContainerFormatTiff, 0x163bcc30,0xe2e9,0x4f0b,0x96,0x1d,0xa3,0xe9,0xfd,0xb7,0x88,0xa3);")
391 cpp_quote
("DEFINE_GUID(GUID_ContainerFormatGif, 0x1f8a5601,0x7d4d,0x4cbd,0x9c,0x82,0x1b,0xc8,0xd4,0xee,0xb9,0xa5);")
392 cpp_quote
("DEFINE_GUID(GUID_ContainerFormatWmp, 0x57a37caa,0x367a,0x4540,0x91,0x6b,0xf1,0x83,0xc5,0x09,0x3a,0x4b);")