2 * Copyright 2013 Hans Leidekker 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
30 #include "wincodecs_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
36 typedef struct ColorTransform {
37 IWICColorTransform IWICColorTransform_iface;
41 static inline ColorTransform *impl_from_IWICColorTransform(IWICColorTransform *iface)
43 return CONTAINING_RECORD(iface, ColorTransform, IWICColorTransform_iface);
46 static HRESULT WINAPI ColorTransform_QueryInterface(IWICColorTransform *iface, REFIID iid,
49 ColorTransform *This = impl_from_IWICColorTransform(iface);
50 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
52 if (!ppv) return E_INVALIDARG;
54 if (IsEqualIID(&IID_IUnknown, iid) ||
55 IsEqualIID(&IID_IWICBitmapSource, iid) ||
56 IsEqualIID(&IID_IWICColorTransform, iid))
58 *ppv = &This->IWICColorTransform_iface;
66 IUnknown_AddRef((IUnknown*)*ppv);
70 static ULONG WINAPI ColorTransform_AddRef(IWICColorTransform *iface)
72 ColorTransform *This = impl_from_IWICColorTransform(iface);
73 ULONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) refcount=%u\n", iface, ref);
80 static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface)
82 ColorTransform *This = impl_from_IWICColorTransform(iface);
83 ULONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) refcount=%u\n", iface, ref);
89 HeapFree(GetProcessHeap(), 0, This);
95 static HRESULT WINAPI ColorTransform_GetSize(IWICColorTransform *iface,
96 UINT *puiWidth, UINT *puiHeight)
98 FIXME("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
102 static HRESULT WINAPI ColorTransform_GetPixelFormat(IWICColorTransform *iface,
103 WICPixelFormatGUID *pPixelFormat)
105 FIXME("(%p,%p)\n", iface, pPixelFormat);
109 static HRESULT WINAPI ColorTransform_GetResolution(IWICColorTransform *iface,
110 double *pDpiX, double *pDpiY)
112 FIXME("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
116 static HRESULT WINAPI ColorTransform_CopyPalette(IWICColorTransform *iface,
117 IWICPalette *pIPalette)
119 FIXME("(%p,%p)\n", iface, pIPalette);
123 static HRESULT WINAPI ColorTransform_CopyPixels(IWICColorTransform *iface,
124 const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
126 FIXME("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
130 static HRESULT WINAPI ColorTransform_Initialize(IWICColorTransform *iface,
131 IWICBitmapSource *pIBitmapSource, IWICColorContext *pIContextSource,
132 IWICColorContext *pIContextDest, REFWICPixelFormatGUID pixelFmtDest)
134 FIXME("(%p,%p,%p,%p,%s)\n", iface, pIBitmapSource, pIContextSource,
135 pIContextDest, debugstr_guid(pixelFmtDest));
139 static const IWICColorTransformVtbl ColorTransform_Vtbl = {
140 ColorTransform_QueryInterface,
141 ColorTransform_AddRef,
142 ColorTransform_Release,
143 ColorTransform_GetSize,
144 ColorTransform_GetPixelFormat,
145 ColorTransform_GetResolution,
146 ColorTransform_CopyPalette,
147 ColorTransform_CopyPixels,
148 ColorTransform_Initialize
151 HRESULT ColorTransform_Create(IWICColorTransform **colortransform)
153 ColorTransform *This;
155 if (!colortransform) return E_INVALIDARG;
157 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ColorTransform));
158 if (!This) return E_OUTOFMEMORY;
160 This->IWICColorTransform_iface.lpVtbl = &ColorTransform_Vtbl;
163 *colortransform = &This->IWICColorTransform_iface;