windowscodecs: Silence fixme for IID_CMetaBitmapRenderTarget.
[wine.git] / dlls / windowscodecs / wincodecs_private.h
blob9da717fc3450d470aa9be9a88b4bfb731840ce50
1 /*
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
19 #ifndef WINCODECS_PRIVATE_H
20 #define WINCODECS_PRIVATE_H
22 #include "wincodec.h"
23 #include "wincodecsdk.h"
25 #include "wine/debug.h"
27 DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
29 DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22);
31 DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a);
33 extern IID IID_IMILBitmap;
34 extern IID IID_IMILBitmapSource;
35 extern IID IID_IMILBitmapLock;
36 extern IID IID_IMILBitmapScaler;
37 extern IID IID_IMILFormatConverter;
38 extern IID IID_IMILPalette;
40 #define INTERFACE IMILBitmapSource
41 DECLARE_INTERFACE_(IMILBitmapSource,IUnknown)
43 /*** IUnknown methods ***/
44 STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
45 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
46 STDMETHOD_(ULONG,Release)(THIS) PURE;
47 /*** IWICBitmapSource methods ***/
48 STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE;
49 STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE;
50 STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
51 STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
52 STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
54 #undef INTERFACE
56 #define INTERFACE IMILBitmap
57 DECLARE_INTERFACE_(IMILBitmap,IMILBitmapSource)
59 /*** IUnknown methods ***/
60 STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
61 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
62 STDMETHOD_(ULONG,Release)(THIS) PURE;
63 /*** IWICBitmapSource methods ***/
64 STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE;
65 STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE;
66 STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
67 STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
68 STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
69 /*** IMILBitmap methods ***/
70 STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE;
71 STDMETHOD_(HRESULT,Lock)(THIS_ const WICRect *,DWORD,IWICBitmapLock **) PURE;
72 STDMETHOD_(HRESULT,Unlock)(THIS_ IWICBitmapLock *) PURE;
73 STDMETHOD_(HRESULT,SetPalette)(THIS_ IWICPalette *) PURE;
74 STDMETHOD_(HRESULT,SetResolution)(THIS_ double,double) PURE;
75 STDMETHOD_(HRESULT,AddDirtyRect)(THIS_ const WICRect *) PURE;
77 #undef INTERFACE
79 #define INTERFACE IMILBitmapScaler
80 DECLARE_INTERFACE_(IMILBitmapScaler,IMILBitmapSource)
82 /*** IUnknown methods ***/
83 STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
84 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
85 STDMETHOD_(ULONG,Release)(THIS) PURE;
86 /*** IWICBitmapSource methods ***/
87 STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE;
88 STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE;
89 STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
90 STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
91 STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
92 /*** IMILBitmapScaler methods ***/
93 STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE;
94 STDMETHOD_(HRESULT,Initialize)(THIS_ IMILBitmapSource *,UINT,UINT,WICBitmapInterpolationMode) PURE;
96 #undef INTERFACE
98 #define THISCALLMETHOD_(type,method) type (__thiscall *method)
100 #define INTERFACE IMILUnknown1
101 DECLARE_INTERFACE_(IMILUnknown1,IUnknown)
103 /*** IUnknown methods ***/
104 STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
105 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
106 STDMETHOD_(ULONG,Release)(THIS) PURE;
107 THISCALLMETHOD_(void,unknown1)(THIS_ void*) PURE;
108 STDMETHOD_(HRESULT,unknown2)(THIS_ void*, void*) PURE;
109 THISCALLMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE;
110 STDMETHOD_(HRESULT,unknown4)(THIS_ void*) PURE;
111 STDMETHOD_(HRESULT,unknown5)(THIS_ void*) PURE;
112 STDMETHOD_(HRESULT,unknown6)(THIS_ DWORD64) PURE;
113 STDMETHOD_(HRESULT,unknown7)(THIS_ void*) PURE;
114 THISCALLMETHOD_(HRESULT,unknown8)(THIS) PURE;
116 #undef INTERFACE
118 #define INTERFACE IMILUnknown2
119 DECLARE_INTERFACE_(IMILUnknown2,IUnknown)
121 /*** IUnknown methods ***/
122 STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
123 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
124 STDMETHOD_(ULONG,Release)(THIS) PURE;
125 /*** unknown methods ***/
126 STDMETHOD_(HRESULT,unknown1)(THIS_ void *,void **) PURE;
127 STDMETHOD_(HRESULT,unknown2)(THIS_ void *,void *) PURE;
128 STDMETHOD_(HRESULT,unknown3)(THIS_ void *) PURE;
130 #undef INTERFACE
132 HRESULT create_instance(const CLSID *clsid, const IID *iid, void **ppv);
134 typedef HRESULT(*class_constructor)(REFIID,void**);
135 extern HRESULT FormatConverter_CreateInstance(REFIID riid, void** ppv);
136 extern HRESULT ImagingFactory_CreateInstance(REFIID riid, void** ppv);
137 extern HRESULT BmpDecoder_CreateInstance(REFIID riid, void** ppv);
138 extern HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv);
139 extern HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv);
140 extern HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv);
141 extern HRESULT DibDecoder_CreateInstance(REFIID iid, void** ppv);
142 extern HRESULT GifDecoder_CreateInstance(REFIID riid, void** ppv);
143 extern HRESULT GifEncoder_CreateInstance(REFIID iid, void** ppv);
144 extern HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv);
145 extern HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv);
146 extern HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv);
147 extern HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv);
148 extern HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv);
149 extern HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv);
150 extern HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv);
151 extern HRESULT DdsEncoder_CreateInstance(REFIID iid, void** ppv);
153 extern HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
154 UINT stride, UINT datasize, void *view, UINT offset,
155 REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option,
156 IWICBitmap **ppIBitmap);
157 extern HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler);
158 extern HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator);
159 extern HRESULT PaletteImpl_Create(IWICPalette **palette);
160 extern HRESULT StreamImpl_Create(IWICStream **stream);
161 extern HRESULT ColorContext_Create(IWICColorContext **context);
162 extern HRESULT ColorTransform_Create(IWICColorTransform **transform);
163 extern HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper);
165 extern HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
166 UINT srcwidth, UINT srcheight, INT srcstride,
167 const WICRect *rc, UINT dststride, UINT dstbuffersize, BYTE *dstbuffer);
169 extern HRESULT configure_write_source(IWICBitmapFrameEncode *iface,
170 IWICBitmapSource *source, const WICRect *prc,
171 const WICPixelFormatGUID *format,
172 INT width, INT height, double xres, double yres);
174 extern HRESULT write_source(IWICBitmapFrameEncode *iface,
175 IWICBitmapSource *source, const WICRect *prc,
176 const WICPixelFormatGUID *format, UINT bpp, BOOL need_palette,
177 INT width, INT height);
179 extern void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride);
181 extern HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp);
183 extern HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
184 IPropertyBag2 **property);
186 extern HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo);
187 extern void ReleaseComponentInfos(void);
188 extern HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown);
189 extern HRESULT get_decoder_info(REFCLSID clsid, IWICBitmapDecoderInfo **info);
191 typedef struct BmpDecoder BmpDecoder;
193 extern HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder);
194 extern void BmpDecoder_GetWICDecoder(BmpDecoder *This, IWICBitmapDecoder **ppDecoder);
195 extern void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown);
197 typedef struct _MetadataItem
199 PROPVARIANT schema;
200 PROPVARIANT id;
201 PROPVARIANT value;
202 } MetadataItem;
204 typedef struct _MetadataHandlerVtbl
206 int is_writer;
207 const CLSID *clsid;
208 HRESULT (*fnLoad)(IStream *stream, const GUID *preferred_vendor,
209 DWORD persist_options, MetadataItem **items, DWORD *item_count);
210 HRESULT (*fnSave)(IStream *stream, DWORD persist_options,
211 const MetadataItem *items, DWORD item_count);
212 HRESULT (*fnGetSizeMax)(const MetadataItem *items, DWORD item_count,
213 ULARGE_INTEGER *size);
214 } MetadataHandlerVtbl;
216 extern HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void** ppv);
218 extern HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void** ppv);
219 extern HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv);
220 extern HRESULT PngChrmReader_CreateInstance(REFIID iid, void** ppv);
221 extern HRESULT PngGamaReader_CreateInstance(REFIID iid, void** ppv);
222 extern HRESULT PngHistReader_CreateInstance(REFIID iid, void** ppv);
223 extern HRESULT PngTextReader_CreateInstance(REFIID iid, void** ppv);
224 extern HRESULT PngTimeReader_CreateInstance(REFIID iid, void** ppv);
225 extern HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv);
226 extern HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv);
227 extern HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv);
228 extern HRESULT APEReader_CreateInstance(REFIID iid, void **ppv);
229 extern HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv);
230 extern HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *, const WCHAR *, IWICMetadataQueryReader **);
231 extern HRESULT MetadataQueryWriter_CreateInstance(IWICMetadataBlockWriter *, const WCHAR *, IWICMetadataQueryWriter **);
232 extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile);
234 static inline const char *debug_wic_rect(const WICRect *rect)
236 if (!rect) return "(null)";
237 return wine_dbg_sprintf("(%u,%u)-(%u,%u)", rect->X, rect->Y, rect->Width, rect->Height);
240 extern HMODULE windowscodecs_module;
242 HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_size);
244 struct decoder_funcs;
246 struct decoder_info
248 GUID container_format;
249 GUID block_format;
250 CLSID clsid;
253 #define DECODER_FLAGS_CAPABILITY_MASK 0x1f
254 #define DECODER_FLAGS_UNSUPPORTED_COLOR_CONTEXT 0x80000000
256 struct decoder_stat
258 DWORD flags;
259 UINT frame_count;
262 struct decoder_frame
264 CLSID pixel_format;
265 UINT width, height;
266 UINT bpp;
267 DOUBLE dpix, dpiy;
268 DWORD num_color_contexts;
269 DWORD num_colors;
270 WICColor palette[256];
273 #define DECODER_BLOCK_OPTION_MASK 0x0001000F
274 #define DECODER_BLOCK_FULL_STREAM 0x80000000
275 #define DECODER_BLOCK_READER_CLSID 0x40000000
276 struct decoder_block
278 ULONGLONG offset;
279 ULONGLONG length;
280 DWORD options;
281 GUID reader_clsid;
284 struct decoder
286 const struct decoder_funcs *vtable;
289 struct decoder_funcs
291 HRESULT (CDECL *initialize)(struct decoder* This, IStream *stream, struct decoder_stat *st);
292 HRESULT (CDECL *get_frame_info)(struct decoder* This, UINT frame, struct decoder_frame *info);
293 HRESULT (CDECL *copy_pixels)(struct decoder* This, UINT frame, const WICRect *prc,
294 UINT stride, UINT buffersize, BYTE *buffer);
295 HRESULT (CDECL *get_metadata_blocks)(struct decoder* This, UINT frame, UINT *count,
296 struct decoder_block **blocks);
297 HRESULT (CDECL *get_color_context)(struct decoder* This, UINT frame, UINT num,
298 BYTE **data, DWORD *datasize);
299 void (CDECL *destroy)(struct decoder* This);
302 HRESULT CDECL stream_getsize(IStream *stream, ULONGLONG *size);
303 HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read);
304 HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position);
305 HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written);
307 HRESULT CDECL decoder_create(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result);
308 HRESULT CDECL decoder_initialize(struct decoder *This, IStream *stream, struct decoder_stat *st);
309 HRESULT CDECL decoder_get_frame_info(struct decoder* This, UINT frame, struct decoder_frame *info);
310 HRESULT CDECL decoder_copy_pixels(struct decoder* This, UINT frame, const WICRect *prc,
311 UINT stride, UINT buffersize, BYTE *buffer);
312 HRESULT CDECL decoder_get_metadata_blocks(struct decoder* This, UINT frame, UINT *count,
313 struct decoder_block **blocks);
314 HRESULT CDECL decoder_get_color_context(struct decoder* This, UINT frame, UINT num,
315 BYTE **data, DWORD *datasize);
316 void CDECL decoder_destroy(struct decoder *This);
318 struct encoder_funcs;
320 /* sync with encoder_option_properties */
321 enum encoder_option
323 ENCODER_OPTION_INTERLACE,
324 ENCODER_OPTION_FILTER,
325 ENCODER_OPTION_COMPRESSION_METHOD,
326 ENCODER_OPTION_COMPRESSION_QUALITY,
327 ENCODER_OPTION_IMAGE_QUALITY,
328 ENCODER_OPTION_BITMAP_TRANSFORM,
329 ENCODER_OPTION_LUMINANCE,
330 ENCODER_OPTION_CHROMINANCE,
331 ENCODER_OPTION_YCRCB_SUBSAMPLING,
332 ENCODER_OPTION_SUPPRESS_APP0,
333 ENCODER_OPTION_END
336 #define ENCODER_FLAGS_MULTI_FRAME 0x1
337 #define ENCODER_FLAGS_ICNS_SIZE 0x2
338 #define ENCODER_FLAGS_SUPPORTS_METADATA 0x4
340 struct encoder_info
342 DWORD flags;
343 GUID container_format;
344 CLSID clsid;
345 DWORD encoder_options[7];
348 struct encoder_frame
350 GUID pixel_format;
351 UINT width, height;
352 UINT bpp;
353 BOOL indexed;
354 DOUBLE dpix, dpiy;
355 UINT num_colors;
356 WICColor palette[256];
357 /* encoder options */
358 BOOL interlace;
359 DWORD filter;
362 struct encoder
364 const struct encoder_funcs *vtable;
367 struct encoder_funcs
369 HRESULT (CDECL *initialize)(struct encoder* This, IStream *stream);
370 HRESULT (CDECL *get_supported_format)(struct encoder* This, GUID *pixel_format, DWORD *bpp, BOOL *indexed);
371 HRESULT (CDECL *create_frame)(struct encoder* This, const struct encoder_frame *frame);
372 HRESULT (CDECL *write_lines)(struct encoder* This, BYTE *data, DWORD line_count, DWORD stride);
373 HRESULT (CDECL *commit_frame)(struct encoder* This);
374 HRESULT (CDECL *commit_file)(struct encoder* This);
375 void (CDECL *destroy)(struct encoder* This);
378 HRESULT CDECL encoder_initialize(struct encoder* This, IStream *stream);
379 HRESULT CDECL encoder_get_supported_format(struct encoder* This, GUID *pixel_format, DWORD *bpp, BOOL *indexed);
380 HRESULT CDECL encoder_create_frame(struct encoder* This, const struct encoder_frame *frame);
381 HRESULT CDECL encoder_write_lines(struct encoder* This, BYTE *data, DWORD line_count, DWORD stride);
382 HRESULT CDECL encoder_commit_frame(struct encoder* This);
383 HRESULT CDECL encoder_commit_file(struct encoder* This);
384 void CDECL encoder_destroy(struct encoder* This);
386 HRESULT CDECL png_decoder_create(struct decoder_info *info, struct decoder **result);
387 HRESULT CDECL tiff_decoder_create(struct decoder_info *info, struct decoder **result);
388 HRESULT CDECL jpeg_decoder_create(struct decoder_info *info, struct decoder **result);
390 HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **result);
391 HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **result);
392 HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **result);
393 HRESULT CDECL icns_encoder_create(struct encoder_info *info, struct encoder **result);
395 extern HRESULT CommonDecoder_CreateInstance(struct decoder *decoder,
396 const struct decoder_info *decoder_info, REFIID iid, void** ppv);
398 extern HRESULT CommonEncoder_CreateInstance(struct encoder *encoder,
399 const struct encoder_info *encoder_info, REFIID iid, void** ppv);
401 #endif /* WINCODECS_PRIVATE_H */