windowscodecs: Add stub implementation of IWICPalette.
[wine.git] / dlls / windowscodecs / palette.c
blob42aa7f0a87e2ea46ba50737a53fcb18fcc085a0c
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 IWICPaletteVtbl *lpIWICPaletteVtbl;
39 LONG ref;
40 } PaletteImpl;
42 static HRESULT WINAPI PaletteImpl_QueryInterface(IWICPalette *iface, REFIID iid,
43 void **ppv)
45 PaletteImpl *This = (PaletteImpl*)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_IWICPalette, 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 PaletteImpl_AddRef(IWICPalette *iface)
66 PaletteImpl *This = (PaletteImpl*)iface;
67 ULONG ref = InterlockedIncrement(&This->ref);
69 TRACE("(%p) refcount=%u\n", iface, ref);
71 return ref;
74 static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface)
76 PaletteImpl *This = (PaletteImpl*)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 PaletteImpl_InitializePredefined(IWICPalette *iface,
88 WICBitmapPaletteType ePaletteType, BOOL fAddTransparentColor)
90 FIXME("(%p,%u,%i): stub\n", iface, ePaletteType, fAddTransparentColor);
91 return E_NOTIMPL;
94 static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface,
95 WICColor *pColors, UINT colorCount)
97 FIXME("(%p,%p,%u): stub\n", iface, pColors, colorCount);
98 return E_NOTIMPL;
101 static HRESULT WINAPI PaletteImpl_InitializeFromBitmap(IWICPalette *iface,
102 IWICBitmapSource *pISurface, UINT colorCount, BOOL fAddTransparentColor)
104 FIXME("(%p,%p,%u,%i): stub\n", iface, pISurface, colorCount, fAddTransparentColor);
105 return E_NOTIMPL;
108 static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface,
109 IWICPalette *pIPalette)
111 FIXME("(%p,%p): stub\n", iface, pIPalette);
112 return E_NOTIMPL;
115 static HRESULT WINAPI PaletteImpl_GetType(IWICPalette *iface,
116 WICBitmapPaletteType *pePaletteType)
118 FIXME("(%p,%p): stub\n", iface, pePaletteType);
119 return E_NOTIMPL;
122 static HRESULT WINAPI PaletteImpl_GetColorCount(IWICPalette *iface, UINT *pcCount)
124 FIXME("(%p,%p): stub\n", iface, pcCount);
125 return E_NOTIMPL;
128 static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount,
129 WICColor *pColors, UINT *pcActualColors)
131 FIXME("(%p,%i,%p,%p): stub\n", iface, colorCount, pColors, pcActualColors);
132 return E_NOTIMPL;
135 static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBlackWhite)
137 FIXME("(%p,%p): stub\n", iface, pfIsBlackWhite);
138 return E_NOTIMPL;
141 static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGrayscale)
143 FIXME("(%p,%p): stub\n", iface, pfIsGrayscale);
144 return E_NOTIMPL;
147 static HRESULT WINAPI PaletteImpl_HasAlpha(IWICPalette *iface, BOOL *pfHasAlpha)
149 FIXME("(%p,%p): stub\n", iface, pfHasAlpha);
150 return E_NOTIMPL;
153 static const IWICPaletteVtbl PaletteImpl_Vtbl = {
154 PaletteImpl_QueryInterface,
155 PaletteImpl_AddRef,
156 PaletteImpl_Release,
157 PaletteImpl_InitializePredefined,
158 PaletteImpl_InitializeCustom,
159 PaletteImpl_InitializeFromBitmap,
160 PaletteImpl_InitializeFromPalette,
161 PaletteImpl_GetType,
162 PaletteImpl_GetColorCount,
163 PaletteImpl_GetColors,
164 PaletteImpl_IsBlackWhite,
165 PaletteImpl_IsGrayscale,
166 PaletteImpl_HasAlpha
169 HRESULT PaletteImpl_Create(IWICPalette **palette)
171 PaletteImpl *This;
173 This = HeapAlloc(GetProcessHeap(), 0, sizeof(PaletteImpl));
174 if (!This) return E_OUTOFMEMORY;
176 This->lpIWICPaletteVtbl = &PaletteImpl_Vtbl;
177 This->ref = 1;
179 *palette = (IWICPalette*)This;
181 return S_OK;