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 IWICPaletteVtbl
*lpIWICPaletteVtbl
;
42 static HRESULT WINAPI
PaletteImpl_QueryInterface(IWICPalette
*iface
, REFIID iid
,
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
))
60 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
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
);
82 HeapFree(GetProcessHeap(), 0, This
);
87 static HRESULT WINAPI
PaletteImpl_InitializePredefined(IWICPalette
*iface
,
88 WICBitmapPaletteType ePaletteType
, BOOL fAddTransparentColor
)
90 FIXME("(%p,%u,%i): stub\n", iface
, ePaletteType
, fAddTransparentColor
);
94 static HRESULT WINAPI
PaletteImpl_InitializeCustom(IWICPalette
*iface
,
95 WICColor
*pColors
, UINT colorCount
)
97 FIXME("(%p,%p,%u): stub\n", iface
, pColors
, colorCount
);
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
);
108 static HRESULT WINAPI
PaletteImpl_InitializeFromPalette(IWICPalette
*iface
,
109 IWICPalette
*pIPalette
)
111 FIXME("(%p,%p): stub\n", iface
, pIPalette
);
115 static HRESULT WINAPI
PaletteImpl_GetType(IWICPalette
*iface
,
116 WICBitmapPaletteType
*pePaletteType
)
118 FIXME("(%p,%p): stub\n", iface
, pePaletteType
);
122 static HRESULT WINAPI
PaletteImpl_GetColorCount(IWICPalette
*iface
, UINT
*pcCount
)
124 FIXME("(%p,%p): stub\n", iface
, pcCount
);
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
);
135 static HRESULT WINAPI
PaletteImpl_IsBlackWhite(IWICPalette
*iface
, BOOL
*pfIsBlackWhite
)
137 FIXME("(%p,%p): stub\n", iface
, pfIsBlackWhite
);
141 static HRESULT WINAPI
PaletteImpl_IsGrayscale(IWICPalette
*iface
, BOOL
*pfIsGrayscale
)
143 FIXME("(%p,%p): stub\n", iface
, pfIsGrayscale
);
147 static HRESULT WINAPI
PaletteImpl_HasAlpha(IWICPalette
*iface
, BOOL
*pfHasAlpha
)
149 FIXME("(%p,%p): stub\n", iface
, pfHasAlpha
);
153 static const IWICPaletteVtbl PaletteImpl_Vtbl
= {
154 PaletteImpl_QueryInterface
,
157 PaletteImpl_InitializePredefined
,
158 PaletteImpl_InitializeCustom
,
159 PaletteImpl_InitializeFromBitmap
,
160 PaletteImpl_InitializeFromPalette
,
162 PaletteImpl_GetColorCount
,
163 PaletteImpl_GetColors
,
164 PaletteImpl_IsBlackWhite
,
165 PaletteImpl_IsGrayscale
,
169 HRESULT
PaletteImpl_Create(IWICPalette
**palette
)
173 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(PaletteImpl
));
174 if (!This
) return E_OUTOFMEMORY
;
176 This
->lpIWICPaletteVtbl
= &PaletteImpl_Vtbl
;
179 *palette
= (IWICPalette
*)This
;