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
31 #include "wincodecs_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs
);
38 const IWICImagingFactoryVtbl
*lpIWICImagingFactoryVtbl
;
42 static HRESULT WINAPI
ImagingFactory_QueryInterface(IWICImagingFactory
*iface
, REFIID iid
,
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
))
60 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
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
);
82 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
154 static HRESULT WINAPI
ImagingFactory_CreateBitmapScaler(IWICImagingFactory
*iface
,
155 IWICBitmapScaler
**ppIBitmapScaler
)
157 FIXME("(%p,%p): stub\n", iface
, ppIBitmapScaler
);
161 static HRESULT WINAPI
ImagingFactory_CreateBitmapClipper(IWICImagingFactory
*iface
,
162 IWICBitmapClipper
**ppIBitmapClipper
)
164 FIXME("(%p,%p): stub\n", iface
, ppIBitmapClipper
);
168 static HRESULT WINAPI
ImagingFactory_CreateBitmapFlipRotator(IWICImagingFactory
*iface
,
169 IWICBitmapFlipRotator
**ppIBitmapFlipRotator
)
171 FIXME("(%p,%p): stub\n", iface
, ppIBitmapFlipRotator
);
175 static HRESULT WINAPI
ImagingFactory_CreateStream(IWICImagingFactory
*iface
,
176 IWICStream
**ppIWICStream
)
178 FIXME("(%p,%p): stub\n", iface
, ppIWICStream
);
182 static HRESULT WINAPI
ImagingFactory_CreateColorContext(IWICImagingFactory
*iface
,
183 IWICColorContext
**ppIColorContext
)
185 FIXME("(%p,%p): stub\n", iface
, ppIColorContext
);
189 static HRESULT WINAPI
ImagingFactory_CreateColorTransformer(IWICImagingFactory
*iface
,
190 IWICColorTransform
**ppIColorTransform
)
192 FIXME("(%p,%p): stub\n", iface
, ppIColorTransform
);
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
);
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
);
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
,
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
);
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
);
239 static HRESULT WINAPI
ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory
*iface
,
240 HICON hIcon
, IWICBitmap
**ppIBitmap
)
242 FIXME("(%p,%p,%p): stub\n", iface
, hIcon
, ppIBitmap
);
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
);
253 static HRESULT WINAPI
ImagingFactory_CreateFastMetadataEncoderFromDecoder(
254 IWICImagingFactory
*iface
, IWICBitmapDecoder
*pIDecoder
,
255 IWICFastMetadataEncoder
**ppIFastEncoder
)
257 FIXME("(%p,%p,%p): stub\n", iface
, pIDecoder
, ppIFastEncoder
);
261 static HRESULT WINAPI
ImagingFactory_CreateFastMetadataEncoderFromFrameDecode(
262 IWICImagingFactory
*iface
, IWICBitmapFrameDecode
*pIFrameDecoder
,
263 IWICFastMetadataEncoder
**ppIFastEncoder
)
265 FIXME("(%p,%p,%p): stub\n", iface
, pIFrameDecoder
, ppIFastEncoder
);
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
);
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
),
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
;
323 TRACE("(%p,%s,%p)\n", pUnkOuter
, debugstr_guid(iid
), ppv
);
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
;
335 ret
= IUnknown_QueryInterface((IUnknown
*)This
, iid
, ppv
);
336 IUnknown_Release((IUnknown
*)This
);