windowscodecs: Implement IWICImagingFactory::CreateBitmapFromSource.
[wine/multimedia.git] / dlls / windowscodecs / imgfactory.c
blob01ce03450da18378f46e4b88dba82a069b40d502
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 #include "config.h"
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winreg.h"
28 #include "objbase.h"
29 #include "shellapi.h"
30 #include "wincodec.h"
31 #include "wincodecsdk.h"
33 #include "wincodecs_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
39 typedef struct {
40 IWICComponentFactory IWICComponentFactory_iface;
41 LONG ref;
42 } ComponentFactory;
44 static inline ComponentFactory *impl_from_IWICComponentFactory(IWICComponentFactory *iface)
46 return CONTAINING_RECORD(iface, ComponentFactory, IWICComponentFactory_iface);
49 static HRESULT WINAPI ComponentFactory_QueryInterface(IWICComponentFactory *iface, REFIID iid,
50 void **ppv)
52 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
53 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
55 if (!ppv) return E_INVALIDARG;
57 if (IsEqualIID(&IID_IUnknown, iid) ||
58 IsEqualIID(&IID_IWICImagingFactory, iid) ||
59 IsEqualIID(&IID_IWICComponentFactory, iid))
61 *ppv = &This->IWICComponentFactory_iface;
63 else
65 *ppv = NULL;
66 return E_NOINTERFACE;
69 IUnknown_AddRef((IUnknown*)*ppv);
70 return S_OK;
73 static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory *iface)
75 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
76 ULONG ref = InterlockedIncrement(&This->ref);
78 TRACE("(%p) refcount=%u\n", iface, ref);
80 return ref;
83 static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory *iface)
85 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
86 ULONG ref = InterlockedDecrement(&This->ref);
88 TRACE("(%p) refcount=%u\n", iface, ref);
90 if (ref == 0)
91 HeapFree(GetProcessHeap(), 0, This);
93 return ref;
96 static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename(
97 IWICComponentFactory *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
98 DWORD dwDesiredAccess, WICDecodeOptions metadataOptions,
99 IWICBitmapDecoder **ppIDecoder)
101 IWICStream *stream;
102 HRESULT hr;
104 TRACE("(%p,%s,%s,%u,%u,%p)\n", iface, debugstr_w(wzFilename),
105 debugstr_guid(pguidVendor), dwDesiredAccess, metadataOptions, ppIDecoder);
107 hr = StreamImpl_Create(&stream);
108 if (SUCCEEDED(hr))
110 hr = IWICStream_InitializeFromFilename(stream, wzFilename, dwDesiredAccess);
112 if (SUCCEEDED(hr))
114 hr = IWICComponentFactory_CreateDecoderFromStream(iface, (IStream*)stream,
115 pguidVendor, metadataOptions, ppIDecoder);
118 IWICStream_Release(stream);
121 return hr;
124 static IWICBitmapDecoder *find_decoder(IStream *pIStream, const GUID *pguidVendor,
125 WICDecodeOptions metadataOptions)
127 IEnumUnknown *enumdecoders;
128 IUnknown *unkdecoderinfo;
129 IWICBitmapDecoderInfo *decoderinfo;
130 IWICBitmapDecoder *decoder = NULL;
131 GUID vendor;
132 HRESULT res;
133 ULONG num_fetched;
134 BOOL matches;
136 res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
137 if (FAILED(res)) return NULL;
139 while (!decoder)
141 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
143 if (res == S_OK)
145 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void**)&decoderinfo);
147 if (SUCCEEDED(res))
149 if (pguidVendor)
151 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
152 if (FAILED(res) || !IsEqualIID(&vendor, pguidVendor))
154 IWICBitmapDecoderInfo_Release(decoderinfo);
155 IUnknown_Release(unkdecoderinfo);
156 continue;
160 res = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, pIStream, &matches);
162 if (SUCCEEDED(res) && matches)
164 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &decoder);
166 /* FIXME: should use QueryCapability to choose a decoder */
168 if (SUCCEEDED(res))
170 res = IWICBitmapDecoder_Initialize(decoder, pIStream, metadataOptions);
172 if (FAILED(res))
174 IWICBitmapDecoder_Release(decoder);
175 decoder = NULL;
180 IWICBitmapDecoderInfo_Release(decoderinfo);
183 IUnknown_Release(unkdecoderinfo);
185 else
186 break;
189 IEnumUnknown_Release(enumdecoders);
191 return decoder;
194 static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(
195 IWICComponentFactory *iface, IStream *pIStream, const GUID *pguidVendor,
196 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
198 HRESULT res;
199 IWICBitmapDecoder *decoder = NULL;
201 TRACE("(%p,%p,%s,%u,%p)\n", iface, pIStream, debugstr_guid(pguidVendor),
202 metadataOptions, ppIDecoder);
204 if (pguidVendor)
205 decoder = find_decoder(pIStream, pguidVendor, metadataOptions);
206 if (!decoder)
207 decoder = find_decoder(pIStream, NULL, metadataOptions);
209 if (decoder)
211 *ppIDecoder = decoder;
212 return S_OK;
214 else
216 if (WARN_ON(wincodecs))
218 LARGE_INTEGER seek;
219 BYTE data[4];
220 ULONG bytesread;
222 WARN("failed to load from a stream\n");
224 seek.QuadPart = 0;
225 res = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
226 if (SUCCEEDED(res))
227 res = IStream_Read(pIStream, data, 4, &bytesread);
228 if (SUCCEEDED(res))
229 WARN("first %i bytes of stream=%x %x %x %x\n", bytesread, data[0], data[1], data[2], data[3]);
231 *ppIDecoder = NULL;
232 return WINCODEC_ERR_COMPONENTNOTFOUND;
236 static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle(
237 IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *pguidVendor,
238 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
240 FIXME("(%p,%lx,%s,%u,%p): stub\n", iface, hFile, debugstr_guid(pguidVendor),
241 metadataOptions, ppIDecoder);
242 return E_NOTIMPL;
245 static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory *iface,
246 REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
248 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
249 return CreateComponentInfo(clsidComponent, ppIInfo);
252 static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface,
253 REFGUID guidContainerFormat, const GUID *pguidVendor,
254 IWICBitmapDecoder **ppIDecoder)
256 IEnumUnknown *enumdecoders;
257 IUnknown *unkdecoderinfo;
258 IWICBitmapDecoderInfo *decoderinfo;
259 IWICBitmapDecoder *decoder = NULL, *preferred_decoder = NULL;
260 GUID vendor;
261 HRESULT res;
262 ULONG num_fetched;
264 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
265 debugstr_guid(pguidVendor), ppIDecoder);
267 if (!guidContainerFormat || !ppIDecoder) return E_INVALIDARG;
269 res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
270 if (FAILED(res)) return res;
272 while (!preferred_decoder)
274 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
275 if (res != S_OK) break;
277 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void **)&decoderinfo);
278 if (SUCCEEDED(res))
280 GUID container_guid;
282 res = IWICBitmapDecoderInfo_GetContainerFormat(decoderinfo, &container_guid);
283 if (SUCCEEDED(res) && IsEqualIID(&container_guid, guidContainerFormat))
285 IWICBitmapDecoder *new_decoder;
287 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &new_decoder);
288 if (SUCCEEDED(res))
290 if (pguidVendor)
292 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
293 if (SUCCEEDED(res) && IsEqualIID(&vendor, pguidVendor))
295 preferred_decoder = new_decoder;
296 new_decoder = NULL;
300 if (new_decoder && !decoder)
302 decoder = new_decoder;
303 new_decoder = NULL;
306 if (new_decoder) IWICBitmapDecoder_Release(new_decoder);
310 IWICBitmapDecoderInfo_Release(decoderinfo);
313 IUnknown_Release(unkdecoderinfo);
316 IEnumUnknown_Release(enumdecoders);
318 if (preferred_decoder)
320 *ppIDecoder = preferred_decoder;
321 if (decoder) IWICBitmapDecoder_Release(decoder);
322 return S_OK;
325 if (decoder)
327 *ppIDecoder = decoder;
328 return S_OK;
331 *ppIDecoder = NULL;
332 return WINCODEC_ERR_COMPONENTNOTFOUND;
335 static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface,
336 REFGUID guidContainerFormat, const GUID *pguidVendor,
337 IWICBitmapEncoder **ppIEncoder)
339 static int fixme=0;
340 IEnumUnknown *enumencoders;
341 IUnknown *unkencoderinfo;
342 IWICBitmapEncoderInfo *encoderinfo;
343 IWICBitmapEncoder *encoder=NULL;
344 HRESULT res=S_OK;
345 ULONG num_fetched;
346 GUID actual_containerformat;
348 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
349 debugstr_guid(pguidVendor), ppIEncoder);
351 if (pguidVendor && !fixme++)
352 FIXME("ignoring vendor GUID\n");
354 res = CreateComponentEnumerator(WICEncoder, WICComponentEnumerateDefault, &enumencoders);
355 if (FAILED(res)) return res;
357 while (!encoder)
359 res = IEnumUnknown_Next(enumencoders, 1, &unkencoderinfo, &num_fetched);
361 if (res == S_OK)
363 res = IUnknown_QueryInterface(unkencoderinfo, &IID_IWICBitmapEncoderInfo, (void**)&encoderinfo);
365 if (SUCCEEDED(res))
367 res = IWICBitmapEncoderInfo_GetContainerFormat(encoderinfo, &actual_containerformat);
369 if (SUCCEEDED(res) && IsEqualGUID(guidContainerFormat, &actual_containerformat))
371 res = IWICBitmapEncoderInfo_CreateInstance(encoderinfo, &encoder);
372 if (FAILED(res))
373 encoder = NULL;
376 IWICBitmapEncoderInfo_Release(encoderinfo);
379 IUnknown_Release(unkencoderinfo);
381 else
382 break;
385 IEnumUnknown_Release(enumencoders);
387 if (encoder)
389 *ppIEncoder = encoder;
390 return S_OK;
392 else
394 WARN("failed to create encoder\n");
395 *ppIEncoder = NULL;
396 return WINCODEC_ERR_COMPONENTNOTFOUND;
400 static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface,
401 IWICPalette **ppIPalette)
403 TRACE("(%p,%p)\n", iface, ppIPalette);
404 return PaletteImpl_Create(ppIPalette);
407 static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface,
408 IWICFormatConverter **ppIFormatConverter)
410 return FormatConverter_CreateInstance(NULL, &IID_IWICFormatConverter, (void**)ppIFormatConverter);
413 static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface,
414 IWICBitmapScaler **ppIBitmapScaler)
416 TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
418 return BitmapScaler_Create(ppIBitmapScaler);
421 static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory *iface,
422 IWICBitmapClipper **ppIBitmapClipper)
424 FIXME("(%p,%p): stub\n", iface, ppIBitmapClipper);
425 return E_NOTIMPL;
428 static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory *iface,
429 IWICBitmapFlipRotator **ppIBitmapFlipRotator)
431 TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
432 return FlipRotator_Create(ppIBitmapFlipRotator);
435 static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface,
436 IWICStream **ppIWICStream)
438 TRACE("(%p,%p)\n", iface, ppIWICStream);
439 return StreamImpl_Create(ppIWICStream);
442 static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory *iface,
443 IWICColorContext **ppIColorContext)
445 FIXME("(%p,%p): stub\n", iface, ppIColorContext);
446 return E_NOTIMPL;
449 static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface,
450 IWICColorTransform **ppIColorTransform)
452 FIXME("(%p,%p): stub\n", iface, ppIColorTransform);
453 return E_NOTIMPL;
456 static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
457 UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat,
458 WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
460 TRACE("(%p,%u,%u,%s,%u,%p)\n", iface, uiWidth, uiHeight,
461 debugstr_guid(pixelFormat), option, ppIBitmap);
462 return BitmapImpl_Create(uiWidth, uiHeight, pixelFormat, option, ppIBitmap);
465 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory *iface,
466 IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option,
467 IWICBitmap **ppIBitmap)
469 IWICBitmap *result;
470 IWICBitmapLock *lock;
471 IWICPalette *palette;
472 UINT width, height;
473 WICPixelFormatGUID pixelformat = {0};
474 HRESULT hr;
475 WICRect rc;
476 double dpix, dpiy;
478 TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
480 if (!piBitmapSource || !ppIBitmap)
481 return E_INVALIDARG;
483 hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height);
485 if (SUCCEEDED(hr))
486 hr = IWICBitmapSource_GetPixelFormat(piBitmapSource, &pixelformat);
488 if (SUCCEEDED(hr))
489 hr = BitmapImpl_Create(width, height, &pixelformat, option, &result);
491 if (SUCCEEDED(hr))
493 hr = IWICBitmap_Lock(result, NULL, WICBitmapLockWrite, &lock);
494 if (SUCCEEDED(hr))
496 UINT stride, buffersize;
497 BYTE *buffer;
498 rc.X = rc.Y = 0;
499 rc.Width = width;
500 rc.Height = height;
502 hr = IWICBitmapLock_GetStride(lock, &stride);
504 if (SUCCEEDED(hr))
505 hr = IWICBitmapLock_GetDataPointer(lock, &buffersize, &buffer);
507 if (SUCCEEDED(hr))
508 hr = IWICBitmapSource_CopyPixels(piBitmapSource, &rc, stride,
509 buffersize, buffer);
511 IWICBitmapLock_Release(lock);
514 if (SUCCEEDED(hr))
515 hr = PaletteImpl_Create(&palette);
517 if (SUCCEEDED(hr))
519 hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
521 if (SUCCEEDED(hr))
522 hr = IWICBitmap_SetPalette(result, palette);
523 else
524 hr = S_OK;
526 IWICPalette_Release(palette);
529 if (SUCCEEDED(hr))
531 hr = IWICBitmapSource_GetResolution(piBitmapSource, &dpix, &dpiy);
533 if (SUCCEEDED(hr))
534 hr = IWICBitmap_SetResolution(result, dpix, dpiy);
535 else
536 hr = S_OK;
539 if (SUCCEEDED(hr))
540 *ppIBitmap = result;
541 else
542 IWICBitmap_Release(result);
545 return hr;
548 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface,
549 IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height,
550 IWICBitmap **ppIBitmap)
552 FIXME("(%p,%p,%u,%u,%u,%u,%p): stub\n", iface, piBitmapSource, x, y, width,
553 height, ppIBitmap);
554 return E_NOTIMPL;
557 static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory *iface,
558 UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat, UINT cbStride,
559 UINT cbBufferSize, BYTE *pbBuffer, IWICBitmap **ppIBitmap)
561 FIXME("(%p,%u,%u,%s,%u,%u,%p,%p): stub\n", iface, uiWidth, uiHeight,
562 debugstr_guid(pixelFormat), cbStride, cbBufferSize, pbBuffer, ppIBitmap);
563 return E_NOTIMPL;
566 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface,
567 HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options,
568 IWICBitmap **ppIBitmap)
570 FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap);
571 return E_NOTIMPL;
574 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface,
575 HICON hIcon, IWICBitmap **ppIBitmap)
577 FIXME("(%p,%p,%p): stub\n", iface, hIcon, ppIBitmap);
578 return E_NOTIMPL;
581 static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface,
582 DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
584 TRACE("(%p,%u,%u,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
585 return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
588 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder(
589 IWICComponentFactory *iface, IWICBitmapDecoder *pIDecoder,
590 IWICFastMetadataEncoder **ppIFastEncoder)
592 FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
593 return E_NOTIMPL;
596 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(
597 IWICComponentFactory *iface, IWICBitmapFrameDecode *pIFrameDecoder,
598 IWICFastMetadataEncoder **ppIFastEncoder)
600 FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
601 return E_NOTIMPL;
604 static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory *iface,
605 REFGUID guidMetadataFormat, const GUID *pguidVendor,
606 IWICMetadataQueryWriter **ppIQueryWriter)
608 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidMetadataFormat),
609 debugstr_guid(pguidVendor), ppIQueryWriter);
610 return E_NOTIMPL;
613 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface,
614 IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor,
615 IWICMetadataQueryWriter **ppIQueryWriter)
617 FIXME("(%p,%p,%s,%p): stub\n", iface, pIQueryReader, debugstr_guid(pguidVendor),
618 ppIQueryWriter);
619 return E_NOTIMPL;
622 static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory *iface,
623 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
625 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
626 options, stream, reader);
627 return E_NOTIMPL;
630 static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer(IWICComponentFactory *iface,
631 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
633 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
634 options, stream, reader);
635 return E_NOTIMPL;
638 static HRESULT WINAPI ComponentFactory_CreateMetadataWriter(IWICComponentFactory *iface,
639 REFGUID format, const GUID *vendor, DWORD options, IWICMetadataWriter **writer)
641 FIXME("%p,%s,%s,%x,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, writer);
642 return E_NOTIMPL;
645 static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader(IWICComponentFactory *iface,
646 IWICMetadataReader *reader, const GUID *vendor, IWICMetadataWriter **writer)
648 FIXME("%p,%p,%s,%p: stub\n", iface, reader, debugstr_guid(vendor), writer);
649 return E_NOTIMPL;
652 static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComponentFactory *iface,
653 IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
655 FIXME("%p,%p,%p: stub\n", iface, block_reader, query_reader);
656 return E_NOTIMPL;
659 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,
660 IWICMetadataBlockWriter *block_writer, IWICMetadataQueryWriter **query_writer)
662 FIXME("%p,%p,%p: stub\n", iface, block_writer, query_writer);
663 return E_NOTIMPL;
666 static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag(IWICComponentFactory *iface,
667 PROPBAG2 *options, UINT count, IPropertyBag2 **property)
669 FIXME("%p,%p,%u,%p: stub\n", iface, options, count, property);
670 return E_NOTIMPL;
673 static const IWICComponentFactoryVtbl ComponentFactory_Vtbl = {
674 ComponentFactory_QueryInterface,
675 ComponentFactory_AddRef,
676 ComponentFactory_Release,
677 ComponentFactory_CreateDecoderFromFilename,
678 ComponentFactory_CreateDecoderFromStream,
679 ComponentFactory_CreateDecoderFromFileHandle,
680 ComponentFactory_CreateComponentInfo,
681 ComponentFactory_CreateDecoder,
682 ComponentFactory_CreateEncoder,
683 ComponentFactory_CreatePalette,
684 ComponentFactory_CreateFormatConverter,
685 ComponentFactory_CreateBitmapScaler,
686 ComponentFactory_CreateBitmapClipper,
687 ComponentFactory_CreateBitmapFlipRotator,
688 ComponentFactory_CreateStream,
689 ComponentFactory_CreateColorContext,
690 ComponentFactory_CreateColorTransformer,
691 ComponentFactory_CreateBitmap,
692 ComponentFactory_CreateBitmapFromSource,
693 ComponentFactory_CreateBitmapFromSourceRect,
694 ComponentFactory_CreateBitmapFromMemory,
695 ComponentFactory_CreateBitmapFromHBITMAP,
696 ComponentFactory_CreateBitmapFromHICON,
697 ComponentFactory_CreateComponentEnumerator,
698 ComponentFactory_CreateFastMetadataEncoderFromDecoder,
699 ComponentFactory_CreateFastMetadataEncoderFromFrameDecode,
700 ComponentFactory_CreateQueryWriter,
701 ComponentFactory_CreateQueryWriterFromReader,
702 ComponentFactory_CreateMetadataReader,
703 ComponentFactory_CreateMetadataReaderFromContainer,
704 ComponentFactory_CreateMetadataWriter,
705 ComponentFactory_CreateMetadataWriterFromReader,
706 ComponentFactory_CreateQueryReaderFromBlockReader,
707 ComponentFactory_CreateQueryWriterFromBlockWriter,
708 ComponentFactory_CreateEncoderPropertyBag
711 HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
713 ComponentFactory *This;
714 HRESULT ret;
716 TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
718 *ppv = NULL;
720 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
722 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory));
723 if (!This) return E_OUTOFMEMORY;
725 This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
726 This->ref = 1;
728 ret = IWICComponentFactory_QueryInterface(&This->IWICComponentFactory_iface, iid, ppv);
729 IWICComponentFactory_Release(&This->IWICComponentFactory_iface);
731 return ret;