windowscodecs: Implement IsBlackWhite and IsGrayscale for palettes.

This commit is contained in:
Vincent Povirk 2009-07-02 17:44:31 -05:00 committed by Alexandre Julliard
parent 9a6400bc32
commit cf8a26aff6
1 changed files with 31 additions and 4 deletions

View File

@ -186,14 +186,41 @@ static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount,
static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBlackWhite) static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBlackWhite)
{ {
FIXME("(%p,%p): stub\n", iface, pfIsBlackWhite); PaletteImpl *This = (PaletteImpl*)iface;
return E_NOTIMPL;
TRACE("(%p,%p)\n", iface, pfIsBlackWhite);
if (!pfIsBlackWhite) return E_INVALIDARG;
if (This->type == WICBitmapPaletteTypeFixedBW)
*pfIsBlackWhite = TRUE;
else
*pfIsBlackWhite = FALSE;
return S_OK;
} }
static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGrayscale) static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGrayscale)
{ {
FIXME("(%p,%p): stub\n", iface, pfIsGrayscale); PaletteImpl *This = (PaletteImpl*)iface;
return E_NOTIMPL;
TRACE("(%p,%p)\n", iface, pfIsGrayscale);
if (!pfIsGrayscale) return E_INVALIDARG;
switch(This->type)
{
case WICBitmapPaletteTypeFixedBW:
case WICBitmapPaletteTypeFixedGray4:
case WICBitmapPaletteTypeFixedGray16:
case WICBitmapPaletteTypeFixedGray256:
*pfIsGrayscale = TRUE;
break;
default:
*pfIsGrayscale = FALSE;
}
return S_OK;
} }
static HRESULT WINAPI PaletteImpl_HasAlpha(IWICPalette *iface, BOOL *pfHasAlpha) static HRESULT WINAPI PaletteImpl_HasAlpha(IWICPalette *iface, BOOL *pfHasAlpha)