From: Vijay Kiran Kamuju infyquest@gmail.com
--- dlls/gdiplus/gdiplus_private.h | 21 ++++++++++ dlls/gdiplus/image.c | 72 ++++++++++++++++++++++++++++++---- dlls/gdiplus/tests/image.c | 4 +- 3 files changed, 87 insertions(+), 10 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 6f7e72124c2..44d3e6d1000 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -368,6 +368,27 @@ struct GpAdjustableArrowCap{ REAL width; };
+typedef enum EffectType { + NoneEffect, + BlurEffect, + SharpenEffect, + TintEffect, + RedEyeCorrectionEffect, + ColorMatrixEffect, + ColorLUTEffect, + BrightnessContrastEffect, + HueSaturationLightnessEffect, + ColorBalanceEffect, + LevelsEffect, + ColorCurveEffect, +} EffectType; + +typedef struct CGpEffect{ + INT datasize; + void *data; + EffectType type; +} CGpEffect; + struct GpImage{ IWICBitmapDecoder *decoder; IWICBitmapEncoder *encoder; diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 806da0cb696..22bea5b555f 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -5576,14 +5576,70 @@ 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; + GpStatus status = Ok;
- if(!effect) + TRACE("(%s, %p)\n", debugstr_guid(&guid), effect); + + if (!effect) return InvalidParameter;
- *effect = NULL; + ef = malloc(sizeof(CGpEffect)); + ef->auxdatasize = 0; + ef->auxdata = NULL;
- return NotImplemented; + if (IsEqualGUID(&guid, &BlurEffectGuid)) + { + ef->type = BlurEffect; + } + else if (IsEqualGUID(&guid, &SharpenEffectGuid)) + { + ef->type = SharpenEffect; + } + else if (IsEqualGUID(&guid, &TintEffectGuid)) + { + ef->type = TintEffect; + } + else if (IsEqualGUID(&guid, &RedEyeCorrectionEffectGuid)) + { + ef->type = RedEyeCorrectionEffect; + } + else if (IsEqualGUID(&guid, &ColorMatrixEffectGuid)) + { + ef->type = ColorMatrixEffect; + } + else if (IsEqualGUID(&guid, &ColorLUTEffectGuid)) + { + ef->type = ColorLUTEffect; + } + else if (IsEqualGUID(&guid, &BrightnessContrastEffectGuid)) + { + ef->type = BrightnessContrastEffect; + } + else if (IsEqualGUID(&guid, &HueSaturationLightnessEffectGuid)) + { + ef->type = HueSaturationLightnessEffect; + } + else if (IsEqualGUID(&guid, &ColorBalanceEffectGuid)) + { + ef->type = ColorBalanceEffect; + } + else if (IsEqualGUID(&guid, &LevelsEffectGuid)) + { + ef->type = LevelsEffect; + } + else if (IsEqualGUID(&guid, &ColorCurveEffectGuid)) + { + ef->type = ColorCurveEffect; + } + else + { + ef->type = NoneEffect; + status = Win32Error; + } + + *effect = ef; + return status; }
/***************************************************************************** @@ -5591,10 +5647,10 @@ GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect) */ GpStatus WINGDIPAPI GdipDeleteEffect(CGpEffect *effect) { - FIXME("(%p): stub\n", effect); - /* note: According to Jose Roca's GDI+ Docs, this is not implemented - * in Windows's gdiplus */ - return NotImplemented; + TRACE("(%p)\n", effect); + + free(effect); + return Ok; }
/***************************************************************************** diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 8fc9aa78225..c4a194c14de 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5429,12 +5429,12 @@ static void test_createeffect(void) expect(InvalidParameter, stat);
stat = pGdipCreateEffect(noneffect, &effect); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat);
for(i=0; i < ARRAY_SIZE(effectlist); i++) { stat = pGdipCreateEffect(*effectlist[i], &effect); - todo_wine expect(Ok, stat); + expect(Ok, stat); if(stat == Ok) { stat = pGdipDeleteEffect(effect);