2 * Copyright 2012 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 ColorContext {
37 IWICColorContext IWICColorContext_iface;
39 WICColorContextType type;
42 static inline ColorContext *impl_from_IWICColorContext(IWICColorContext *iface)
44 return CONTAINING_RECORD(iface, ColorContext, IWICColorContext_iface);
47 static HRESULT WINAPI ColorContext_QueryInterface(IWICColorContext *iface, REFIID iid,
50 ColorContext *This = impl_from_IWICColorContext(iface);
51 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
53 if (!ppv) return E_INVALIDARG;
55 if (IsEqualIID(&IID_IUnknown, iid) ||
56 IsEqualIID(&IID_IWICColorContext, iid))
58 *ppv = &This->IWICColorContext_iface;
66 IUnknown_AddRef((IUnknown*)*ppv);
70 static ULONG WINAPI ColorContext_AddRef(IWICColorContext *iface)
72 ColorContext *This = impl_from_IWICColorContext(iface);
73 ULONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) refcount=%u\n", iface, ref);
80 static ULONG WINAPI ColorContext_Release(IWICColorContext *iface)
82 ColorContext *This = impl_from_IWICColorContext(iface);
83 ULONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) refcount=%u\n", iface, ref);
89 HeapFree(GetProcessHeap(), 0, This);
95 static HRESULT WINAPI ColorContext_InitializeFromFilename(IWICColorContext *iface,
98 FIXME("(%p,%s)\n", iface, debugstr_w(wzFilename));
102 static HRESULT WINAPI ColorContext_InitializeFromMemory(IWICColorContext *iface,
103 const BYTE *pbBuffer, UINT cbBufferSize)
105 FIXME("(%p,%p,%u)\n", iface, pbBuffer, cbBufferSize);
109 static HRESULT WINAPI ColorContext_InitializeFromExifColorSpace(IWICColorContext *iface,
112 FIXME("(%p,%u)\n", iface, value);
116 static HRESULT WINAPI ColorContext_GetType(IWICColorContext *iface,
117 WICColorContextType *pType)
119 ColorContext *This = impl_from_IWICColorContext(iface);
120 TRACE("(%p,%p)\n", iface, pType);
126 static HRESULT WINAPI ColorContext_GetProfileBytes(IWICColorContext *iface,
127 UINT cbBuffer, BYTE *pbBuffer, UINT *pcbActual)
129 FIXME("(%p,%u,%p,%p)\n", iface, cbBuffer, pbBuffer, pcbActual);
133 static HRESULT WINAPI ColorContext_GetExifColorSpace(IWICColorContext *iface,
136 FIXME("(%p,%p)\n", iface, pValue);
140 static const IWICColorContextVtbl ColorContext_Vtbl = {
141 ColorContext_QueryInterface,
143 ColorContext_Release,
144 ColorContext_InitializeFromFilename,
145 ColorContext_InitializeFromMemory,
146 ColorContext_InitializeFromExifColorSpace,
147 ColorContext_GetType,
148 ColorContext_GetProfileBytes,
149 ColorContext_GetExifColorSpace
152 HRESULT ColorContext_Create(IWICColorContext **colorcontext)
156 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ColorContext));
157 if (!This) return E_OUTOFMEMORY;
159 This->IWICColorContext_iface.lpVtbl = &ColorContext_Vtbl;
163 *colorcontext = &This->IWICColorContext_iface;