push(f) 5db305932526e04c957eecf195d0c75656cfa181
[wine/hacks.git] / dlls / windowscodecs / imgfactory.c
blobb727d1616a4a3158131b5b4e45a4e4d9b0bc3a6d
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 "wincodec.h"
31 #include "wincodecs_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
37 typedef struct {
38 const IWICImagingFactoryVtbl *lpIWICImagingFactoryVtbl;
39 LONG ref;
40 } ImagingFactory;
42 static HRESULT WINAPI ImagingFactory_QueryInterface(IWICImagingFactory *iface, REFIID iid,
43 void **ppv)
45 ImagingFactory *This = (ImagingFactory*)iface;
46 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
48 if (!ppv) return E_INVALIDARG;
50 if (IsEqualIID(&IID_IUnknown, iid) || IsEqualIID(&IID_IWICImagingFactory, iid))
52 *ppv = This;
54 else
56 *ppv = NULL;
57 return E_NOINTERFACE;
60 IUnknown_AddRef((IUnknown*)*ppv);
61 return S_OK;
64 static ULONG WINAPI ImagingFactory_AddRef(IWICImagingFactory *iface)
66 ImagingFactory *This = (ImagingFactory*)iface;
67 ULONG ref = InterlockedIncrement(&This->ref);
69 TRACE("(%p) refcount=%u\n", iface, ref);
71 return ref;
74 static ULONG WINAPI ImagingFactory_Release(IWICImagingFactory *iface)
76 ImagingFactory *This = (ImagingFactory*)iface;
77 ULONG ref = InterlockedDecrement(&This->ref);
79 TRACE("(%p) refcount=%u\n", iface, ref);
81 if (ref == 0)
82 HeapFree(GetProcessHeap(), 0, This);
84 return ref;
87 static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename(
88 IWICImagingFactory *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
89 DWORD dwDesiredAccess, WICDecodeOptions metadataOptions,
90 IWICBitmapDecoder **ppIDecoder)
92 FIXME("(%p,%s,%s,%u,%u,%p): stub\n", iface, debugstr_w(wzFilename),
93 debugstr_guid(pguidVendor), dwDesiredAccess, metadataOptions, ppIDecoder);
94 return E_NOTIMPL;
97 static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream(
98 IWICImagingFactory *iface, IStream *pIStream, const GUID *pguidVendor,
99 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
101 FIXME("(%p,%p,%s,%u,%p): stub\n", iface, pIStream, debugstr_guid(pguidVendor),
102 metadataOptions, ppIDecoder);
103 return E_NOTIMPL;
106 static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle(
107 IWICImagingFactory *iface, ULONG_PTR hFile, const GUID *pguidVendor,
108 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
110 FIXME("(%p,%lx,%s,%u,%p): stub\n", iface, hFile, debugstr_guid(pguidVendor),
111 metadataOptions, ppIDecoder);
112 return E_NOTIMPL;
115 static HRESULT WINAPI ImagingFactory_CreateComponentInfo(IWICImagingFactory *iface,
116 REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
118 FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(clsidComponent), ppIInfo);
119 return E_NOTIMPL;
122 static HRESULT WINAPI ImagingFactory_CreateDecoder(IWICImagingFactory *iface,
123 REFGUID guidContainerFormat, const GUID *pguidVendor,
124 IWICBitmapDecoder **ppIDecoder)
126 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidContainerFormat),
127 debugstr_guid(pguidVendor), ppIDecoder);
128 return E_NOTIMPL;
131 static HRESULT WINAPI ImagingFactory_CreateEncoder(IWICImagingFactory *iface,
132 REFGUID guidContainerFormat, const GUID *pguidVendor,
133 IWICBitmapEncoder **ppIEncoder)
135 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidContainerFormat),
136 debugstr_guid(pguidVendor), ppIEncoder);
137 return E_NOTIMPL;
140 static HRESULT WINAPI ImagingFactory_CreatePalette(IWICImagingFactory *iface,
141 IWICPalette **ppIPalette)
143 TRACE("(%p,%p)\n", iface, ppIPalette);
144 return PaletteImpl_Create(ppIPalette);
147 static HRESULT WINAPI ImagingFactory_CreateFormatConverter(IWICImagingFactory *iface,
148 IWICFormatConverter **ppIFormatConverter)
150 FIXME("(%p,%p): stub\n", iface, ppIFormatConverter);
151 return E_NOTIMPL;
154 static HRESULT WINAPI ImagingFactory_CreateBitmapScaler(IWICImagingFactory *iface,
155 IWICBitmapScaler **ppIBitmapScaler)
157 FIXME("(%p,%p): stub\n", iface, ppIBitmapScaler);
158 return E_NOTIMPL;
161 static HRESULT WINAPI ImagingFactory_CreateBitmapClipper(IWICImagingFactory *iface,
162 IWICBitmapClipper **ppIBitmapClipper)
164 FIXME("(%p,%p): stub\n", iface, ppIBitmapClipper);
165 return E_NOTIMPL;
168 static HRESULT WINAPI ImagingFactory_CreateBitmapFlipRotator(IWICImagingFactory *iface,
169 IWICBitmapFlipRotator **ppIBitmapFlipRotator)
171 FIXME("(%p,%p): stub\n", iface, ppIBitmapFlipRotator);
172 return E_NOTIMPL;
175 static HRESULT WINAPI ImagingFactory_CreateStream(IWICImagingFactory *iface,
176 IWICStream **ppIWICStream)
178 FIXME("(%p,%p): stub\n", iface, ppIWICStream);
179 return E_NOTIMPL;
182 static HRESULT WINAPI ImagingFactory_CreateColorContext(IWICImagingFactory *iface,
183 IWICColorContext **ppIColorContext)
185 FIXME("(%p,%p): stub\n", iface, ppIColorContext);
186 return E_NOTIMPL;
189 static HRESULT WINAPI ImagingFactory_CreateColorTransformer(IWICImagingFactory *iface,
190 IWICColorTransform **ppIColorTransform)
192 FIXME("(%p,%p): stub\n", iface, ppIColorTransform);
193 return E_NOTIMPL;
196 static HRESULT WINAPI ImagingFactory_CreateBitmap(IWICImagingFactory *iface,
197 UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat,
198 WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
200 FIXME("(%p,%u,%u,%s,%u,%p): stub\n", iface, uiWidth, uiHeight,
201 debugstr_guid(pixelFormat), option, ppIBitmap);
202 return E_NOTIMPL;
205 static HRESULT WINAPI ImagingFactory_CreateBitmapFromSource(IWICImagingFactory *iface,
206 IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option,
207 IWICBitmap **ppIBitmap)
209 FIXME("(%p,%p,%u,%p): stub\n", iface, piBitmapSource, option, ppIBitmap);
210 return E_NOTIMPL;
213 static HRESULT WINAPI ImagingFactory_CreateBitmapFromSourceRect(IWICImagingFactory *iface,
214 IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height,
215 IWICBitmap **ppIBitmap)
217 FIXME("(%p,%p,%u,%u,%u,%u,%p): stub\n", iface, piBitmapSource, x, y, width,
218 height, ppIBitmap);
219 return E_NOTIMPL;
222 static HRESULT WINAPI ImagingFactory_CreateBitmapFromMemory(IWICImagingFactory *iface,
223 UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat, UINT cbStride,
224 UINT cbBufferSize, BYTE *pbBuffer, IWICBitmap **ppIBitmap)
226 FIXME("(%p,%u,%u,%s,%u,%u,%p,%p): stub\n", iface, uiWidth, uiHeight,
227 debugstr_guid(pixelFormat), cbStride, cbBufferSize, pbBuffer, ppIBitmap);
228 return E_NOTIMPL;
231 static HRESULT WINAPI ImagingFactory_CreateBitmapFromHBITMAP(IWICImagingFactory *iface,
232 HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options,
233 IWICBitmap **ppIBitmap)
235 FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap);
236 return E_NOTIMPL;
239 static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory *iface,
240 HICON hIcon, IWICBitmap **ppIBitmap)
242 FIXME("(%p,%p,%p): stub\n", iface, hIcon, ppIBitmap);
243 return E_NOTIMPL;
246 static HRESULT WINAPI ImagingFactory_CreateComponentEnumerator(IWICImagingFactory *iface,
247 DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
249 FIXME("(%p,%u,%u,%p): stub\n", iface, componentTypes, options, ppIEnumUnknown);
250 return E_NOTIMPL;
253 static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromDecoder(
254 IWICImagingFactory *iface, IWICBitmapDecoder *pIDecoder,
255 IWICFastMetadataEncoder **ppIFastEncoder)
257 FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
258 return E_NOTIMPL;
261 static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromFrameDecode(
262 IWICImagingFactory *iface, IWICBitmapFrameDecode *pIFrameDecoder,
263 IWICFastMetadataEncoder **ppIFastEncoder)
265 FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
266 return E_NOTIMPL;
269 static HRESULT WINAPI ImagingFactory_CreateQueryWriter(IWICImagingFactory *iface,
270 REFGUID guidMetadataFormat, const GUID *pguidVendor,
271 IWICMetadataQueryWriter **ppIQueryWriter)
273 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidMetadataFormat),
274 debugstr_guid(pguidVendor), ppIQueryWriter);
275 return E_NOTIMPL;
278 static HRESULT WINAPI ImagingFactory_CreateQueryWriterFromReader(IWICImagingFactory *iface,
279 IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor,
280 IWICMetadataQueryWriter **ppIQueryWriter)
282 FIXME("(%p,%p,%s,%p): stub\n", iface, pIQueryReader, debugstr_guid(pguidVendor),
283 ppIQueryWriter);
284 return E_NOTIMPL;
287 static const IWICImagingFactoryVtbl ImagingFactory_Vtbl = {
288 ImagingFactory_QueryInterface,
289 ImagingFactory_AddRef,
290 ImagingFactory_Release,
291 ImagingFactory_CreateDecoderFromFilename,
292 ImagingFactory_CreateDecoderFromStream,
293 ImagingFactory_CreateDecoderFromFileHandle,
294 ImagingFactory_CreateComponentInfo,
295 ImagingFactory_CreateDecoder,
296 ImagingFactory_CreateEncoder,
297 ImagingFactory_CreatePalette,
298 ImagingFactory_CreateFormatConverter,
299 ImagingFactory_CreateBitmapScaler,
300 ImagingFactory_CreateBitmapClipper,
301 ImagingFactory_CreateBitmapFlipRotator,
302 ImagingFactory_CreateStream,
303 ImagingFactory_CreateColorContext,
304 ImagingFactory_CreateColorTransformer,
305 ImagingFactory_CreateBitmap,
306 ImagingFactory_CreateBitmapFromSource,
307 ImagingFactory_CreateBitmapFromSourceRect,
308 ImagingFactory_CreateBitmapFromMemory,
309 ImagingFactory_CreateBitmapFromHBITMAP,
310 ImagingFactory_CreateBitmapFromHICON,
311 ImagingFactory_CreateComponentEnumerator,
312 ImagingFactory_CreateFastMetadataEncoderFromDecoder,
313 ImagingFactory_CreateFastMetadataEncoderFromFrameDecode,
314 ImagingFactory_CreateQueryWriter,
315 ImagingFactory_CreateQueryWriterFromReader
318 HRESULT ImagingFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
320 ImagingFactory *This;
321 HRESULT ret;
323 TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
325 *ppv = NULL;
327 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
329 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ImagingFactory));
330 if (!This) return E_OUTOFMEMORY;
332 This->lpIWICImagingFactoryVtbl = &ImagingFactory_Vtbl;
333 This->ref = 1;
335 ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv);
336 IUnknown_Release((IUnknown*)This);
338 return ret;