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)
241 FIXME("(%p,%lx,%s,%u,%p): stub\n", iface, hFile, debugstr_guid(pguidVendor),
242 metadataOptions, ppIDecoder);
246 static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory *iface,
247 REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
249 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
250 return CreateComponentInfo(clsidComponent, ppIInfo);
253 static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface,
254 REFGUID guidContainerFormat, const GUID *pguidVendor,
255 IWICBitmapDecoder **ppIDecoder)
257 IEnumUnknown *enumdecoders;
258 IUnknown *unkdecoderinfo;
259 IWICBitmapDecoderInfo *decoderinfo;
260 IWICBitmapDecoder *decoder = NULL, *preferred_decoder = NULL;
265 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
266 debugstr_guid(pguidVendor), ppIDecoder);
268 if (!guidContainerFormat || !ppIDecoder) return E_INVALIDARG;
270 res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
271 if (FAILED(res)) return res;
273 while (!preferred_decoder)
275 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
276 if (res != S_OK) break;
278 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void **)&decoderinfo);
283 res = IWICBitmapDecoderInfo_GetContainerFormat(decoderinfo, &container_guid);
284 if (SUCCEEDED(res) && IsEqualIID(&container_guid, guidContainerFormat))
286 IWICBitmapDecoder *new_decoder;
288 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &new_decoder);
293 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
294 if (SUCCEEDED(res) && IsEqualIID(&vendor, pguidVendor))
296 preferred_decoder = new_decoder;
301 if (new_decoder && !decoder)
303 decoder = new_decoder;
307 if (new_decoder) IWICBitmapDecoder_Release(new_decoder);
311 IWICBitmapDecoderInfo_Release(decoderinfo);
314 IUnknown_Release(unkdecoderinfo);
317 IEnumUnknown_Release(enumdecoders);
319 if (preferred_decoder)
321 *ppIDecoder = preferred_decoder;
322 if (decoder) IWICBitmapDecoder_Release(decoder);
328 *ppIDecoder = decoder;
333 return WINCODEC_ERR_COMPONENTNOTFOUND;
336 static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface,
337 REFGUID guidContainerFormat, const GUID *pguidVendor,
338 IWICBitmapEncoder **ppIEncoder)
341 IEnumUnknown *enumencoders;
342 IUnknown *unkencoderinfo;
343 IWICBitmapEncoderInfo *encoderinfo;
344 IWICBitmapEncoder *encoder=NULL;
347 GUID actual_containerformat;
349 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
350 debugstr_guid(pguidVendor), ppIEncoder);
352 if (pguidVendor && !fixme++)
353 FIXME("ignoring vendor GUID\n");
355 res = CreateComponentEnumerator(WICEncoder, WICComponentEnumerateDefault, &enumencoders);
356 if (FAILED(res)) return res;
360 res = IEnumUnknown_Next(enumencoders, 1, &unkencoderinfo, &num_fetched);
364 res = IUnknown_QueryInterface(unkencoderinfo, &IID_IWICBitmapEncoderInfo, (void**)&encoderinfo);
368 res = IWICBitmapEncoderInfo_GetContainerFormat(encoderinfo, &actual_containerformat);
370 if (SUCCEEDED(res) && IsEqualGUID(guidContainerFormat, &actual_containerformat))
372 res = IWICBitmapEncoderInfo_CreateInstance(encoderinfo, &encoder);
377 IWICBitmapEncoderInfo_Release(encoderinfo);
380 IUnknown_Release(unkencoderinfo);
386 IEnumUnknown_Release(enumencoders);
390 *ppIEncoder = encoder;
395 WARN("failed to create encoder\n");
397 return WINCODEC_ERR_COMPONENTNOTFOUND;
401 static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface,
402 IWICPalette **ppIPalette)
404 TRACE("(%p,%p)\n", iface, ppIPalette);
405 return PaletteImpl_Create(ppIPalette);
408 static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface,
409 IWICFormatConverter **ppIFormatConverter)
411 return FormatConverter_CreateInstance(NULL, &IID_IWICFormatConverter, (void**)ppIFormatConverter);
414 static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface,
415 IWICBitmapScaler **ppIBitmapScaler)
417 TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
419 return BitmapScaler_Create(ppIBitmapScaler);
422 static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory *iface,
423 IWICBitmapClipper **ppIBitmapClipper)
425 FIXME("(%p,%p): stub\n", iface, ppIBitmapClipper);
429 static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory *iface,
430 IWICBitmapFlipRotator **ppIBitmapFlipRotator)
432 TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
433 return FlipRotator_Create(ppIBitmapFlipRotator);
436 static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface,
437 IWICStream **ppIWICStream)
439 TRACE("(%p,%p)\n", iface, ppIWICStream);
440 return StreamImpl_Create(ppIWICStream);
443 static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory *iface,
444 IWICColorContext **ppIColorContext)
446 TRACE("(%p,%p)\n", iface, ppIColorContext);
447 return ColorContext_Create(ppIColorContext);
450 static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface,
451 IWICColorTransform **ppIColorTransform)
453 TRACE("(%p,%p)\n", iface, ppIColorTransform);
454 return ColorTransform_Create(ppIColorTransform);
457 static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
458 UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat,
459 WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
461 TRACE("(%p,%u,%u,%s,%u,%p)\n", iface, uiWidth, uiHeight,
462 debugstr_guid(pixelFormat), option, ppIBitmap);
463 return BitmapImpl_Create(uiWidth, uiHeight, 0, 0, NULL, pixelFormat, option, ppIBitmap);
466 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory *iface,
467 IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option,
468 IWICBitmap **ppIBitmap)
471 IWICBitmapLock *lock;
472 IWICPalette *palette;
474 WICPixelFormatGUID pixelformat = {0};
478 IWICComponentInfo *info;
479 IWICPixelFormatInfo2 *formatinfo;
480 WICPixelFormatNumericRepresentation format_type;
482 TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
484 if (!piBitmapSource || !ppIBitmap)
487 hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height);
490 hr = IWICBitmapSource_GetPixelFormat(piBitmapSource, &pixelformat);
493 hr = CreateComponentInfo(&pixelformat, &info);
497 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void**)&formatinfo);
501 hr = IWICPixelFormatInfo2_GetNumericRepresentation(formatinfo, &format_type);
503 IWICPixelFormatInfo2_Release(formatinfo);
506 IWICComponentInfo_Release(info);
510 hr = BitmapImpl_Create(width, height, 0, 0, NULL, &pixelformat, option, &result);
514 hr = IWICBitmap_Lock(result, NULL, WICBitmapLockWrite, &lock);
517 UINT stride, buffersize;
523 hr = IWICBitmapLock_GetStride(lock, &stride);
526 hr = IWICBitmapLock_GetDataPointer(lock, &buffersize, &buffer);
529 hr = IWICBitmapSource_CopyPixels(piBitmapSource, &rc, stride,
532 IWICBitmapLock_Release(lock);
536 hr = PaletteImpl_Create(&palette);
538 if (SUCCEEDED(hr) && (format_type == WICPixelFormatNumericRepresentationUnspecified ||
539 format_type == WICPixelFormatNumericRepresentationIndexed))
541 hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
544 hr = IWICBitmap_SetPalette(result, palette);
548 IWICPalette_Release(palette);
553 hr = IWICBitmapSource_GetResolution(piBitmapSource, &dpix, &dpiy);
556 hr = IWICBitmap_SetResolution(result, dpix, dpiy);
564 IWICBitmap_Release(result);
570 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface,
571 IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height,
572 IWICBitmap **ppIBitmap)
574 FIXME("(%p,%p,%u,%u,%u,%u,%p): stub\n", iface, piBitmapSource, x, y, width,
579 static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory *iface,
580 UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride,
581 UINT size, BYTE *buffer, IWICBitmap **bitmap)
583 TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height,
584 debugstr_guid(format), stride, size, buffer, bitmap);
586 if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG;
588 return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap);
591 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface,
592 HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options,
593 IWICBitmap **ppIBitmap)
595 FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap);
599 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface,
600 HICON hicon, IWICBitmap **bitmap)
602 IWICBitmapLock *lock;
605 int width, height, x, y;
614 TRACE("(%p,%p,%p)\n", iface, hicon, bitmap);
616 if (!bitmap) return E_INVALIDARG;
618 if (!GetIconInfo(hicon, &info))
619 return HRESULT_FROM_WIN32(GetLastError());
621 GetObjectW(info.hbmColor ? info.hbmColor : info.hbmMask, sizeof(bm), &bm);
624 height = info.hbmColor ? abs(bm.bmHeight) : abs(bm.bmHeight) / 2;
626 size = stride * height;
628 hr = BitmapImpl_Create(width, height, stride, size, NULL,
629 &GUID_WICPixelFormat32bppBGRA, WICBitmapCacheOnLoad, bitmap);
630 if (hr != S_OK) goto failed;
632 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
635 IWICBitmap_Release(*bitmap);
638 IWICBitmapLock_GetDataPointer(lock, &size, &buffer);
640 hdc = CreateCompatibleDC(0);
642 memset(&bi, 0, sizeof(bi));
643 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
644 bi.bmiHeader.biWidth = width;
645 bi.bmiHeader.biHeight = info.hbmColor ? -height: -height * 2;
646 bi.bmiHeader.biPlanes = 1;
647 bi.bmiHeader.biBitCount = 32;
648 bi.bmiHeader.biCompression = BI_RGB;
654 GetDIBits(hdc, info.hbmColor, 0, height, buffer, &bi, DIB_RGB_COLORS);
656 if (bm.bmBitsPixel == 32)
658 /* If any pixel has a non-zero alpha, ignore hbmMask */
659 bits = (DWORD *)buffer;
660 for (x = 0; x < width && !has_alpha; x++, bits++)
662 for (y = 0; y < height; y++)
664 if (*bits & 0xff000000)
674 GetDIBits(hdc, info.hbmMask, 0, height, buffer, &bi, DIB_RGB_COLORS);
684 mask = HeapAlloc(GetProcessHeap(), 0, size);
687 IWICBitmapLock_Release(lock);
688 IWICBitmap_Release(*bitmap);
694 /* read alpha data from the mask */
695 GetDIBits(hdc, info.hbmMask, info.hbmColor ? 0 : height, height, mask, &bi, DIB_RGB_COLORS);
697 for (y = 0; y < height; y++)
699 rgba = (DWORD *)(buffer + y * stride);
700 bits = (DWORD *)(mask + y * stride);
702 for (x = 0; x < width; x++, rgba++, bits++)
711 HeapFree(GetProcessHeap(), 0, mask);
715 /* set constant alpha of 255 */
716 for (y = 0; y < height; y++)
718 rgba = (DWORD *)(buffer + y * stride);
719 for (x = 0; x < width; x++, rgba++)
726 IWICBitmapLock_Release(lock);
730 DeleteObject(info.hbmColor);
731 DeleteObject(info.hbmMask);
736 static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface,
737 DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
739 TRACE("(%p,%u,%u,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
740 return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
743 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder(
744 IWICComponentFactory *iface, IWICBitmapDecoder *pIDecoder,
745 IWICFastMetadataEncoder **ppIFastEncoder)
747 FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
751 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(
752 IWICComponentFactory *iface, IWICBitmapFrameDecode *pIFrameDecoder,
753 IWICFastMetadataEncoder **ppIFastEncoder)
755 FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
759 static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory *iface,
760 REFGUID guidMetadataFormat, const GUID *pguidVendor,
761 IWICMetadataQueryWriter **ppIQueryWriter)
763 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidMetadataFormat),
764 debugstr_guid(pguidVendor), ppIQueryWriter);
768 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface,
769 IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor,
770 IWICMetadataQueryWriter **ppIQueryWriter)
772 FIXME("(%p,%p,%s,%p): stub\n", iface, pIQueryReader, debugstr_guid(pguidVendor),
777 static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory *iface,
778 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
780 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
781 options, stream, reader);
785 static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer(IWICComponentFactory *iface,
786 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
788 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
789 options, stream, reader);
793 static HRESULT WINAPI ComponentFactory_CreateMetadataWriter(IWICComponentFactory *iface,
794 REFGUID format, const GUID *vendor, DWORD options, IWICMetadataWriter **writer)
796 FIXME("%p,%s,%s,%x,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, writer);
800 static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader(IWICComponentFactory *iface,
801 IWICMetadataReader *reader, const GUID *vendor, IWICMetadataWriter **writer)
803 FIXME("%p,%p,%s,%p: stub\n", iface, reader, debugstr_guid(vendor), writer);
807 static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComponentFactory *iface,
808 IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
810 FIXME("%p,%p,%p: stub\n", iface, block_reader, query_reader);
814 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,
815 IWICMetadataBlockWriter *block_writer, IWICMetadataQueryWriter **query_writer)
817 FIXME("%p,%p,%p: stub\n", iface, block_writer, query_writer);
821 static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag(IWICComponentFactory *iface,
822 PROPBAG2 *options, UINT count, IPropertyBag2 **property)
824 TRACE("(%p,%p,%u,%p)\n", iface, options, count, property);
825 return CreatePropertyBag2(options, count, property);
828 static const IWICComponentFactoryVtbl ComponentFactory_Vtbl = {
829 ComponentFactory_QueryInterface,
830 ComponentFactory_AddRef,
831 ComponentFactory_Release,
832 ComponentFactory_CreateDecoderFromFilename,
833 ComponentFactory_CreateDecoderFromStream,
834 ComponentFactory_CreateDecoderFromFileHandle,
835 ComponentFactory_CreateComponentInfo,
836 ComponentFactory_CreateDecoder,
837 ComponentFactory_CreateEncoder,
838 ComponentFactory_CreatePalette,
839 ComponentFactory_CreateFormatConverter,
840 ComponentFactory_CreateBitmapScaler,
841 ComponentFactory_CreateBitmapClipper,
842 ComponentFactory_CreateBitmapFlipRotator,
843 ComponentFactory_CreateStream,
844 ComponentFactory_CreateColorContext,
845 ComponentFactory_CreateColorTransformer,
846 ComponentFactory_CreateBitmap,
847 ComponentFactory_CreateBitmapFromSource,
848 ComponentFactory_CreateBitmapFromSourceRect,
849 ComponentFactory_CreateBitmapFromMemory,
850 ComponentFactory_CreateBitmapFromHBITMAP,
851 ComponentFactory_CreateBitmapFromHICON,
852 ComponentFactory_CreateComponentEnumerator,
853 ComponentFactory_CreateFastMetadataEncoderFromDecoder,
854 ComponentFactory_CreateFastMetadataEncoderFromFrameDecode,
855 ComponentFactory_CreateQueryWriter,
856 ComponentFactory_CreateQueryWriterFromReader,
857 ComponentFactory_CreateMetadataReader,
858 ComponentFactory_CreateMetadataReaderFromContainer,
859 ComponentFactory_CreateMetadataWriter,
860 ComponentFactory_CreateMetadataWriterFromReader,
861 ComponentFactory_CreateQueryReaderFromBlockReader,
862 ComponentFactory_CreateQueryWriterFromBlockWriter,
863 ComponentFactory_CreateEncoderPropertyBag
866 HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
868 ComponentFactory *This;
871 TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
875 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
877 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory));
878 if (!This) return E_OUTOFMEMORY;
880 This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
883 ret = IWICComponentFactory_QueryInterface(&This->IWICComponentFactory_iface, iid, ppv);
884 IWICComponentFactory_Release(&This->IWICComponentFactory_iface);