From: Vijay Kiran Kamuju infyquest@gmail.com
--- dlls/gdiplus/gdiplus_private.h | 19 ++++++++++ dlls/gdiplus/image.c | 68 +++++++++++++++++++++++++++++++--- dlls/gdiplus/tests/image.c | 9 +++-- 3 files changed, 86 insertions(+), 10 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index d247b973b3b..a81220b130c 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -379,6 +379,25 @@ struct GpAdjustableArrowCap{ REAL width; };
+typedef enum EffectType { + NoneEffect, + BlurEffect, + SharpenEffect, + TintEffect, + RedEyeCorrectionEffect, + ColorMatrixEffect, + ColorLUTEffect, + BrightnessContrastEffect, + HueSaturationLightnessEffect, + ColorBalanceEffect, + LevelsEffect, + ColorCurveEffect, +} EffectType; + +typedef struct CGpEffect{ + EffectType type; +} CGpEffect; + struct GpImage{ IWICBitmapDecoder *decoder; IWICBitmapEncoder *encoder; diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 9362cdc344d..9002a0f7d86 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -5509,14 +5509,69 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi */ GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect) { - FIXME("(%s, %p): stub\n", debugstr_guid(&guid), effect); + CGpEffect *ef = NULL; + EffectType type; + + TRACE("(%s, %p)\n", debugstr_guid(&guid), effect);
if(!effect) return InvalidParameter;
- *effect = NULL; + if (IsEqualGUID(&guid, &BlurEffectGuid)) + { + type = BlurEffect; + } + else if (IsEqualGUID(&guid, &SharpenEffectGuid)) + { + type = SharpenEffect; + } + else if (IsEqualGUID(&guid, &TintEffectGuid)) + { + type = TintEffect; + } + else if (IsEqualGUID(&guid, &RedEyeCorrectionEffectGuid)) + { + type = RedEyeCorrectionEffect; + } + else if (IsEqualGUID(&guid, &ColorMatrixEffectGuid)) + { + type = ColorMatrixEffect; + } + else if (IsEqualGUID(&guid, &ColorLUTEffectGuid)) + { + type = ColorLUTEffect; + } + else if (IsEqualGUID(&guid, &BrightnessContrastEffectGuid)) + { + type = BrightnessContrastEffect; + } + else if (IsEqualGUID(&guid, &HueSaturationLightnessEffectGuid)) + { + type = HueSaturationLightnessEffect; + } + else if (IsEqualGUID(&guid, &ColorBalanceEffectGuid)) + { + type = ColorBalanceEffect; + } + else if (IsEqualGUID(&guid, &LevelsEffectGuid)) + { + type = LevelsEffect; + } + else if (IsEqualGUID(&guid, &ColorCurveEffectGuid)) + { + type = ColorCurveEffect; + } + else + { + *effect = NULL; + return Win32Error; + } + + ef = malloc(sizeof(CGpEffect)); + ef->type = type; + *effect = ef;
- return NotImplemented; + return Ok; }
/***************************************************************************** @@ -5524,13 +5579,14 @@ GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect) */ GpStatus WINGDIPAPI GdipDeleteEffect(CGpEffect *effect) { - FIXME("(%p): stub\n", effect); + TRACE("(%p)\n", effect);
if (!effect) return InvalidParameter; - /* note: According to Jose Roca's GDI+ Docs, this is not implemented + /* note: But, according to Jose Roca's GDI+ Docs, this is not implemented * in Windows's gdiplus */ - return NotImplemented; + free(effect); + return Ok; }
/***************************************************************************** diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index d3ac65148d2..bfcd149f4fa 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5410,7 +5410,7 @@ static void test_createeffect(void) GpStatus (WINAPI *pGdipGetEffectParameterSize)(CGpEffect *effect, UINT *size); GpStatus (WINAPI *pGdipGetEffectParameters)(CGpEffect *effect, const VOID *params, const UINT size); GpStatus stat; - CGpEffect *effect; + CGpEffect *effect = NULL; HMODULE mod = GetModuleHandleA("gdiplus.dll"); int i; UINT param_size; @@ -5449,7 +5449,8 @@ static void test_createeffect(void) expect(InvalidParameter, stat);
stat = pGdipCreateEffect(noneffect, &effect); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); + ok( !effect, "expected null effect\n");
param_size = 0; stat = pGdipGetEffectParameterSize(NULL, ¶m_size); @@ -5459,12 +5460,12 @@ static void test_createeffect(void) for (i = 0; i < ARRAY_SIZE(td); i++) { stat = pGdipCreateEffect(*(td[i].effect), &effect); - todo_wine_if(td[i].todo) expect(Ok, stat); + expect(Ok, stat); if (stat == Ok) { param_size = 0; stat = pGdipGetEffectParameterSize(effect, ¶m_size); - todo_wine_if(td[i].todo) expect(Ok, stat); + expect(Ok, stat); #ifdef _WIN64 /* Parameter Size for Red Eye Correction effect is different for 64 bits build */ if (td[i].effect == &RedEyeCorrectionEffectGuid)