2 * Copyright 2009 Vincent Povirk for CodeWeavers
3 * Copyright 2012 Dmitry Timoshkov
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wincodecsdk.h"
34 #include "wincodecs_private.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
41 IWICComponentFactory IWICComponentFactory_iface;
45 static inline ComponentFactory *impl_from_IWICComponentFactory(IWICComponentFactory *iface)
47 return CONTAINING_RECORD(iface, ComponentFactory, IWICComponentFactory_iface);
50 static HRESULT WINAPI ComponentFactory_QueryInterface(IWICComponentFactory *iface, REFIID iid,
53 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
54 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
56 if (!ppv) return E_INVALIDARG;
58 if (IsEqualIID(&IID_IUnknown, iid) ||
59 IsEqualIID(&IID_IWICImagingFactory, iid) ||
60 IsEqualIID(&IID_IWICComponentFactory, iid))
62 *ppv = &This->IWICComponentFactory_iface;
70 IUnknown_AddRef((IUnknown*)*ppv);
74 static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory *iface)
76 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
77 ULONG ref = InterlockedIncrement(&This->ref);
79 TRACE("(%p) refcount=%u\n", iface, ref);
84 static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory *iface)
86 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
87 ULONG ref = InterlockedDecrement(&This->ref);
89 TRACE("(%p) refcount=%u\n", iface, ref);
92 HeapFree(GetProcessHeap(), 0, This);
97 static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename(
98 IWICComponentFactory *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
99 DWORD dwDesiredAccess, WICDecodeOptions metadataOptions,
100 IWICBitmapDecoder **ppIDecoder)
105 TRACE("(%p,%s,%s,%u,%u,%p)\n", iface, debugstr_w(wzFilename),
106 debugstr_guid(pguidVendor), dwDesiredAccess, metadataOptions, ppIDecoder);
108 hr = StreamImpl_Create(&stream);
111 hr = IWICStream_InitializeFromFilename(stream, wzFilename, dwDesiredAccess);
115 hr = IWICComponentFactory_CreateDecoderFromStream(iface, (IStream*)stream,
116 pguidVendor, metadataOptions, ppIDecoder);
119 IWICStream_Release(stream);
125 static IWICBitmapDecoder *find_decoder(IStream *pIStream, const GUID *pguidVendor,
126 WICDecodeOptions metadataOptions)
128 IEnumUnknown *enumdecoders;
129 IUnknown *unkdecoderinfo;
130 IWICBitmapDecoderInfo *decoderinfo;
131 IWICBitmapDecoder *decoder = NULL;
137 res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
138 if (FAILED(res)) return NULL;
142 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
146 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void**)&decoderinfo);
152 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
153 if (FAILED(res) || !IsEqualIID(&vendor, pguidVendor))
155 IWICBitmapDecoderInfo_Release(decoderinfo);
156 IUnknown_Release(unkdecoderinfo);
161 res = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, pIStream, &matches);
163 if (SUCCEEDED(res) && matches)
165 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &decoder);
167 /* FIXME: should use QueryCapability to choose a decoder */
171 res = IWICBitmapDecoder_Initialize(decoder, pIStream, metadataOptions);
175 IWICBitmapDecoder_Release(decoder);
181 IWICBitmapDecoderInfo_Release(decoderinfo);
184 IUnknown_Release(unkdecoderinfo);
190 IEnumUnknown_Release(enumdecoders);
195 static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(
196 IWICComponentFactory *iface, IStream *pIStream, const GUID *pguidVendor,
197 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
200 IWICBitmapDecoder *decoder = NULL;
202 TRACE("(%p,%p,%s,%u,%p)\n", iface, pIStream, debugstr_guid(pguidVendor),
203 metadataOptions, ppIDecoder);
206 decoder = find_decoder(pIStream, pguidVendor, metadataOptions);
208 decoder = find_decoder(pIStream, NULL, metadataOptions);
212 *ppIDecoder = decoder;
217 if (WARN_ON(wincodecs))
223 WARN("failed to load from a stream\n");
226 res = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
228 res = IStream_Read(pIStream, data, 4, &bytesread);
230 WARN("first %i bytes of stream=%x %x %x %x\n", bytesread, data[0], data[1], data[2], data[3]);
233 return WINCODEC_ERR_COMPONENTNOTFOUND;
237 static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle(
238 IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *pguidVendor,
239 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
244 TRACE("(%p,%lx,%s,%u,%p)\n", iface, hFile, debugstr_guid(pguidVendor),
245 metadataOptions, ppIDecoder);
247 hr = StreamImpl_Create(&stream);
250 hr = stream_initialize_from_filehandle(stream, (HANDLE)hFile);
253 hr = IWICComponentFactory_CreateDecoderFromStream(iface, (IStream*)stream,
254 pguidVendor, metadataOptions, ppIDecoder);
256 IWICStream_Release(stream);
261 static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory *iface,
262 REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
264 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
265 return CreateComponentInfo(clsidComponent, ppIInfo);
268 static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface,
269 REFGUID guidContainerFormat, const GUID *pguidVendor,
270 IWICBitmapDecoder **ppIDecoder)
272 IEnumUnknown *enumdecoders;
273 IUnknown *unkdecoderinfo;
274 IWICBitmapDecoderInfo *decoderinfo;
275 IWICBitmapDecoder *decoder = NULL, *preferred_decoder = NULL;
280 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
281 debugstr_guid(pguidVendor), ppIDecoder);
283 if (!guidContainerFormat || !ppIDecoder) return E_INVALIDARG;
285 res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
286 if (FAILED(res)) return res;
288 while (!preferred_decoder)
290 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
291 if (res != S_OK) break;
293 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void **)&decoderinfo);
298 res = IWICBitmapDecoderInfo_GetContainerFormat(decoderinfo, &container_guid);
299 if (SUCCEEDED(res) && IsEqualIID(&container_guid, guidContainerFormat))
301 IWICBitmapDecoder *new_decoder;
303 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &new_decoder);
308 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
309 if (SUCCEEDED(res) && IsEqualIID(&vendor, pguidVendor))
311 preferred_decoder = new_decoder;
316 if (new_decoder && !decoder)
318 decoder = new_decoder;
322 if (new_decoder) IWICBitmapDecoder_Release(new_decoder);
326 IWICBitmapDecoderInfo_Release(decoderinfo);
329 IUnknown_Release(unkdecoderinfo);
332 IEnumUnknown_Release(enumdecoders);
334 if (preferred_decoder)
336 *ppIDecoder = preferred_decoder;
337 if (decoder) IWICBitmapDecoder_Release(decoder);
343 *ppIDecoder = decoder;
348 return WINCODEC_ERR_COMPONENTNOTFOUND;
351 static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface,
352 REFGUID guidContainerFormat, const GUID *pguidVendor,
353 IWICBitmapEncoder **ppIEncoder)
356 IEnumUnknown *enumencoders;
357 IUnknown *unkencoderinfo;
358 IWICBitmapEncoderInfo *encoderinfo;
359 IWICBitmapEncoder *encoder=NULL;
362 GUID actual_containerformat;
364 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
365 debugstr_guid(pguidVendor), ppIEncoder);
367 if (pguidVendor && !fixme++)
368 FIXME("ignoring vendor GUID\n");
370 res = CreateComponentEnumerator(WICEncoder, WICComponentEnumerateDefault, &enumencoders);
371 if (FAILED(res)) return res;
375 res = IEnumUnknown_Next(enumencoders, 1, &unkencoderinfo, &num_fetched);
379 res = IUnknown_QueryInterface(unkencoderinfo, &IID_IWICBitmapEncoderInfo, (void**)&encoderinfo);
383 res = IWICBitmapEncoderInfo_GetContainerFormat(encoderinfo, &actual_containerformat);
385 if (SUCCEEDED(res) && IsEqualGUID(guidContainerFormat, &actual_containerformat))
387 res = IWICBitmapEncoderInfo_CreateInstance(encoderinfo, &encoder);
392 IWICBitmapEncoderInfo_Release(encoderinfo);
395 IUnknown_Release(unkencoderinfo);
401 IEnumUnknown_Release(enumencoders);
405 *ppIEncoder = encoder;
410 WARN("failed to create encoder\n");
412 return WINCODEC_ERR_COMPONENTNOTFOUND;
416 static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface,
417 IWICPalette **ppIPalette)
419 TRACE("(%p,%p)\n", iface, ppIPalette);
420 return PaletteImpl_Create(ppIPalette);
423 static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface,
424 IWICFormatConverter **ppIFormatConverter)
426 return FormatConverter_CreateInstance(NULL, &IID_IWICFormatConverter, (void**)ppIFormatConverter);
429 static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface,
430 IWICBitmapScaler **ppIBitmapScaler)
432 TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
434 return BitmapScaler_Create(ppIBitmapScaler);
437 static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory *iface,
438 IWICBitmapClipper **ppIBitmapClipper)
440 FIXME("(%p,%p): stub\n", iface, ppIBitmapClipper);
444 static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory *iface,
445 IWICBitmapFlipRotator **ppIBitmapFlipRotator)
447 TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
448 return FlipRotator_Create(ppIBitmapFlipRotator);
451 static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface,
452 IWICStream **ppIWICStream)
454 TRACE("(%p,%p)\n", iface, ppIWICStream);
455 return StreamImpl_Create(ppIWICStream);
458 static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory *iface,
459 IWICColorContext **ppIColorContext)
461 TRACE("(%p,%p)\n", iface, ppIColorContext);
462 return ColorContext_Create(ppIColorContext);
465 static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface,
466 IWICColorTransform **ppIColorTransform)
468 TRACE("(%p,%p)\n", iface, ppIColorTransform);
469 return ColorTransform_Create(ppIColorTransform);
472 static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
473 UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat,
474 WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
476 TRACE("(%p,%u,%u,%s,%u,%p)\n", iface, uiWidth, uiHeight,
477 debugstr_guid(pixelFormat), option, ppIBitmap);
478 return BitmapImpl_Create(uiWidth, uiHeight, 0, 0, NULL, pixelFormat, option, ppIBitmap);
481 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory *iface,
482 IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option,
483 IWICBitmap **ppIBitmap)
486 IWICBitmapLock *lock;
487 IWICPalette *palette;
489 WICPixelFormatGUID pixelformat = {0};
493 IWICComponentInfo *info;
494 IWICPixelFormatInfo2 *formatinfo;
495 WICPixelFormatNumericRepresentation format_type;
497 TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
499 if (!piBitmapSource || !ppIBitmap)
502 hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height);
505 hr = IWICBitmapSource_GetPixelFormat(piBitmapSource, &pixelformat);
508 hr = CreateComponentInfo(&pixelformat, &info);
512 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void**)&formatinfo);
516 hr = IWICPixelFormatInfo2_GetNumericRepresentation(formatinfo, &format_type);
518 IWICPixelFormatInfo2_Release(formatinfo);
521 IWICComponentInfo_Release(info);
525 hr = BitmapImpl_Create(width, height, 0, 0, NULL, &pixelformat, option, &result);
529 hr = IWICBitmap_Lock(result, NULL, WICBitmapLockWrite, &lock);
532 UINT stride, buffersize;
538 hr = IWICBitmapLock_GetStride(lock, &stride);
541 hr = IWICBitmapLock_GetDataPointer(lock, &buffersize, &buffer);
544 hr = IWICBitmapSource_CopyPixels(piBitmapSource, &rc, stride,
547 IWICBitmapLock_Release(lock);
551 hr = PaletteImpl_Create(&palette);
553 if (SUCCEEDED(hr) && (format_type == WICPixelFormatNumericRepresentationUnspecified ||
554 format_type == WICPixelFormatNumericRepresentationIndexed))
556 hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
559 hr = IWICBitmap_SetPalette(result, palette);
563 IWICPalette_Release(palette);
568 hr = IWICBitmapSource_GetResolution(piBitmapSource, &dpix, &dpiy);
571 hr = IWICBitmap_SetResolution(result, dpix, dpiy);
579 IWICBitmap_Release(result);
585 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface,
586 IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height,
587 IWICBitmap **ppIBitmap)
589 FIXME("(%p,%p,%u,%u,%u,%u,%p): stub\n", iface, piBitmapSource, x, y, width,
594 static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory *iface,
595 UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride,
596 UINT size, BYTE *buffer, IWICBitmap **bitmap)
598 TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height,
599 debugstr_guid(format), stride, size, buffer, bitmap);
601 if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG;
603 return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap);
606 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface,
607 HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options,
608 IWICBitmap **ppIBitmap)
610 FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap);
614 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface,
615 HICON hicon, IWICBitmap **bitmap)
617 IWICBitmapLock *lock;
620 int width, height, x, y;
629 TRACE("(%p,%p,%p)\n", iface, hicon, bitmap);
631 if (!bitmap) return E_INVALIDARG;
633 if (!GetIconInfo(hicon, &info))
634 return HRESULT_FROM_WIN32(GetLastError());
636 GetObjectW(info.hbmColor ? info.hbmColor : info.hbmMask, sizeof(bm), &bm);
639 height = info.hbmColor ? abs(bm.bmHeight) : abs(bm.bmHeight) / 2;
641 size = stride * height;
643 hr = BitmapImpl_Create(width, height, stride, size, NULL,
644 &GUID_WICPixelFormat32bppBGRA, WICBitmapCacheOnLoad, bitmap);
645 if (hr != S_OK) goto failed;
647 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
650 IWICBitmap_Release(*bitmap);
653 IWICBitmapLock_GetDataPointer(lock, &size, &buffer);
655 hdc = CreateCompatibleDC(0);
657 memset(&bi, 0, sizeof(bi));
658 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
659 bi.bmiHeader.biWidth = width;
660 bi.bmiHeader.biHeight = info.hbmColor ? -height: -height * 2;
661 bi.bmiHeader.biPlanes = 1;
662 bi.bmiHeader.biBitCount = 32;
663 bi.bmiHeader.biCompression = BI_RGB;
669 GetDIBits(hdc, info.hbmColor, 0, height, buffer, &bi, DIB_RGB_COLORS);
671 if (bm.bmBitsPixel == 32)
673 /* If any pixel has a non-zero alpha, ignore hbmMask */
674 bits = (DWORD *)buffer;
675 for (x = 0; x < width && !has_alpha; x++, bits++)
677 for (y = 0; y < height; y++)
679 if (*bits & 0xff000000)
689 GetDIBits(hdc, info.hbmMask, 0, height, buffer, &bi, DIB_RGB_COLORS);
699 mask = HeapAlloc(GetProcessHeap(), 0, size);
702 IWICBitmapLock_Release(lock);
703 IWICBitmap_Release(*bitmap);
709 /* read alpha data from the mask */
710 GetDIBits(hdc, info.hbmMask, info.hbmColor ? 0 : height, height, mask, &bi, DIB_RGB_COLORS);
712 for (y = 0; y < height; y++)
714 rgba = (DWORD *)(buffer + y * stride);
715 bits = (DWORD *)(mask + y * stride);
717 for (x = 0; x < width; x++, rgba++, bits++)
726 HeapFree(GetProcessHeap(), 0, mask);
730 /* set constant alpha of 255 */
731 for (y = 0; y < height; y++)
733 rgba = (DWORD *)(buffer + y * stride);
734 for (x = 0; x < width; x++, rgba++)
741 IWICBitmapLock_Release(lock);
745 DeleteObject(info.hbmColor);
746 DeleteObject(info.hbmMask);
751 static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface,
752 DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
754 TRACE("(%p,%u,%u,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
755 return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
758 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder(
759 IWICComponentFactory *iface, IWICBitmapDecoder *pIDecoder,
760 IWICFastMetadataEncoder **ppIFastEncoder)
762 FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
766 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(
767 IWICComponentFactory *iface, IWICBitmapFrameDecode *pIFrameDecoder,
768 IWICFastMetadataEncoder **ppIFastEncoder)
770 FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
774 static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory *iface,
775 REFGUID guidMetadataFormat, const GUID *pguidVendor,
776 IWICMetadataQueryWriter **ppIQueryWriter)
778 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidMetadataFormat),
779 debugstr_guid(pguidVendor), ppIQueryWriter);
783 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface,
784 IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor,
785 IWICMetadataQueryWriter **ppIQueryWriter)
787 FIXME("(%p,%p,%s,%p): stub\n", iface, pIQueryReader, debugstr_guid(pguidVendor),
792 static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory *iface,
793 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
795 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
796 options, stream, reader);
800 static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer(IWICComponentFactory *iface,
801 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
803 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
804 options, stream, reader);
808 static HRESULT WINAPI ComponentFactory_CreateMetadataWriter(IWICComponentFactory *iface,
809 REFGUID format, const GUID *vendor, DWORD options, IWICMetadataWriter **writer)
811 FIXME("%p,%s,%s,%x,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, writer);
815 static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader(IWICComponentFactory *iface,
816 IWICMetadataReader *reader, const GUID *vendor, IWICMetadataWriter **writer)
818 FIXME("%p,%p,%s,%p: stub\n", iface, reader, debugstr_guid(vendor), writer);
822 static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComponentFactory *iface,
823 IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
825 FIXME("%p,%p,%p: stub\n", iface, block_reader, query_reader);
829 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,
830 IWICMetadataBlockWriter *block_writer, IWICMetadataQueryWriter **query_writer)
832 FIXME("%p,%p,%p: stub\n", iface, block_writer, query_writer);
836 static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag(IWICComponentFactory *iface,
837 PROPBAG2 *options, UINT count, IPropertyBag2 **property)
839 TRACE("(%p,%p,%u,%p)\n", iface, options, count, property);
840 return CreatePropertyBag2(options, count, property);
843 static const IWICComponentFactoryVtbl ComponentFactory_Vtbl = {
844 ComponentFactory_QueryInterface,
845 ComponentFactory_AddRef,
846 ComponentFactory_Release,
847 ComponentFactory_CreateDecoderFromFilename,
848 ComponentFactory_CreateDecoderFromStream,
849 ComponentFactory_CreateDecoderFromFileHandle,
850 ComponentFactory_CreateComponentInfo,
851 ComponentFactory_CreateDecoder,
852 ComponentFactory_CreateEncoder,
853 ComponentFactory_CreatePalette,
854 ComponentFactory_CreateFormatConverter,
855 ComponentFactory_CreateBitmapScaler,
856 ComponentFactory_CreateBitmapClipper,
857 ComponentFactory_CreateBitmapFlipRotator,
858 ComponentFactory_CreateStream,
859 ComponentFactory_CreateColorContext,
860 ComponentFactory_CreateColorTransformer,
861 ComponentFactory_CreateBitmap,
862 ComponentFactory_CreateBitmapFromSource,
863 ComponentFactory_CreateBitmapFromSourceRect,
864 ComponentFactory_CreateBitmapFromMemory,
865 ComponentFactory_CreateBitmapFromHBITMAP,
866 ComponentFactory_CreateBitmapFromHICON,
867 ComponentFactory_CreateComponentEnumerator,
868 ComponentFactory_CreateFastMetadataEncoderFromDecoder,
869 ComponentFactory_CreateFastMetadataEncoderFromFrameDecode,
870 ComponentFactory_CreateQueryWriter,
871 ComponentFactory_CreateQueryWriterFromReader,
872 ComponentFactory_CreateMetadataReader,
873 ComponentFactory_CreateMetadataReaderFromContainer,
874 ComponentFactory_CreateMetadataWriter,
875 ComponentFactory_CreateMetadataWriterFromReader,
876 ComponentFactory_CreateQueryReaderFromBlockReader,
877 ComponentFactory_CreateQueryWriterFromBlockWriter,
878 ComponentFactory_CreateEncoderPropertyBag
881 HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
883 ComponentFactory *This;
886 TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
890 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
892 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory));
893 if (!This) return E_OUTOFMEMORY;
895 This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
898 ret = IWICComponentFactory_QueryInterface(&This->IWICComponentFactory_iface, iid, ppv);
899 IWICComponentFactory_Release(&This->IWICComponentFactory_iface);