From b182113f70fcfa108acbeab928796d2274134b07 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 2 Jul 2009 17:44:31 -0500 Subject: [PATCH] windowscodecs: implement IsBlackWhite and IsGrayscale for palettes --- dlls/windowscodecs/palette.c | 35 +++++++++++++++++++++++++++++++---- 1 files changed, 31 insertions(+), 4 deletions(-) diff --git a/dlls/windowscodecs/palette.c b/dlls/windowscodecs/palette.c index 3cb9c13..90c98bf 100644 --- a/dlls/windowscodecs/palette.c +++ b/dlls/windowscodecs/palette.c @@ -186,14 +186,41 @@ static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount, static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBlackWhite) { - FIXME("(%p,%p): stub\n", iface, pfIsBlackWhite); - return E_NOTIMPL; + PaletteImpl *This = (PaletteImpl*)iface; + + 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) { - FIXME("(%p,%p): stub\n", iface, pfIsGrayscale); - return E_NOTIMPL; + PaletteImpl *This = (PaletteImpl*)iface; + + 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) -- 1.5.4.3