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;
41 static inline ColorContext *impl_from_IWICColorContext(IWICColorContext *iface)
43 return CONTAINING_RECORD(iface, ColorContext, IWICColorContext_iface);
46 static HRESULT WINAPI ColorContext_QueryInterface(IWICColorContext *iface, REFIID iid,
49 ColorContext *This = impl_from_IWICColorContext(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_IWICColorContext, iid))
57 *ppv = &This->IWICColorContext_iface;
65 IUnknown_AddRef((IUnknown*)*ppv);
69 static ULONG WINAPI ColorContext_AddRef(IWICColorContext *iface)
71 ColorContext *This = impl_from_IWICColorContext(iface);
72 ULONG ref = InterlockedIncrement(&This->ref);
74 TRACE("(%p) refcount=%u\n", iface, ref);
79 static ULONG WINAPI ColorContext_Release(IWICColorContext *iface)
81 ColorContext *This = impl_from_IWICColorContext(iface);
82 ULONG ref = InterlockedDecrement(&This->ref);
84 TRACE("(%p) refcount=%u\n", iface, ref);
88 HeapFree(GetProcessHeap(), 0, This);
94 static HRESULT WINAPI ColorContext_InitializeFromFilename(IWICColorContext *iface,
97 FIXME("(%p,%s)\n", iface, debugstr_w(wzFilename));
101 static HRESULT WINAPI ColorContext_InitializeFromMemory(IWICColorContext *iface,
102 const BYTE *pbBuffer, UINT cbBufferSize)
104 FIXME("(%p,%p,%u)\n", iface, pbBuffer, cbBufferSize);
108 static HRESULT WINAPI ColorContext_InitializeFromExifColorSpace(IWICColorContext *iface,
111 FIXME("(%p,%u)\n", iface, value);
115 static HRESULT WINAPI ColorContext_GetType(IWICColorContext *iface,
116 WICColorContextType *pType)
118 FIXME("(%p,%p)\n", iface, pType);
122 static HRESULT WINAPI ColorContext_GetProfileBytes(IWICColorContext *iface,
123 UINT cbBuffer, BYTE *pbBuffer, UINT *pcbActual)
125 FIXME("(%p,%u,%p,%p)\n", iface, cbBuffer, pbBuffer, pcbActual);
129 static HRESULT WINAPI ColorContext_GetExifColorSpace(IWICColorContext *iface,
132 FIXME("(%p,%p)\n", iface, pValue);
136 static const IWICColorContextVtbl ColorContext_Vtbl = {
137 ColorContext_QueryInterface,
139 ColorContext_Release,
140 ColorContext_InitializeFromFilename,
141 ColorContext_InitializeFromMemory,
142 ColorContext_InitializeFromExifColorSpace,
143 ColorContext_GetType,
144 ColorContext_GetProfileBytes,
145 ColorContext_GetExifColorSpace
148 HRESULT ColorContext_Create(IWICColorContext **colorcontext)
152 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ColorContext));
153 if (!This) return E_OUTOFMEMORY;
155 This->IWICColorContext_iface.lpVtbl = &ColorContext_Vtbl;
158 *colorcontext = &This->IWICColorContext_iface;