Module: wine Branch: master Commit: 0c9991c583a0694502121eefb2c91289a6719dc9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0c9991c583a0694502121eefb2...
Author: Vincent Povirk vincent@codeweavers.com Date: Fri Dec 18 17:42:18 2009 -0600
gdiplus: Implement GdipSetImageAttributesColorMatrix.
---
dlls/gdiplus/gdiplus_private.h | 8 ++++++++ dlls/gdiplus/imageattributes.c | 27 ++++++++++++++++++++++----- dlls/gdiplus/tests/image.c | 18 +++++++++--------- 3 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 0ceeb6e..9a357c8 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -249,9 +249,17 @@ struct color_key{ ARGB high; };
+struct color_matrix{ + BOOL enabled; + ColorMatrixFlags flags; + ColorMatrix colormatrix; + ColorMatrix graymatrix; +}; + struct GpImageAttributes{ WrapMode wrap; struct color_key colorkeys[ColorAdjustTypeCount]; + struct color_matrix colormatrices[ColorAdjustTypeCount]; };
struct GpFont{ diff --git a/dlls/gdiplus/imageattributes.c b/dlls/gdiplus/imageattributes.c index a52c297..6bfd23e 100644 --- a/dlls/gdiplus/imageattributes.c +++ b/dlls/gdiplus/imageattributes.c @@ -89,15 +89,32 @@ GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix(GpImageAttributes *imageat ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix, GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags) { - static int calls; + TRACE("(%p,%u,%i,%p,%p,%u)\n", imageattr, type, enableFlag, colorMatrix, + grayMatrix, flags);
- if(!imageattr || !colorMatrix || !grayMatrix) + if(!imageattr || type >= ColorAdjustTypeCount || flags > ColorMatrixFlagsAltGray) return InvalidParameter;
- if(!(calls++)) - FIXME("not implemented\n"); + if (enableFlag) + { + if (!colorMatrix) + return InvalidParameter;
- return NotImplemented; + if (flags == ColorMatrixFlagsAltGray) + { + if (!grayMatrix) + return InvalidParameter; + + imageattr->colormatrices[type].graymatrix = *grayMatrix; + } + + imageattr->colormatrices[type].colormatrix = *colorMatrix; + imageattr->colormatrices[type].flags = flags; + } + + imageattr->colormatrices[type].enabled = enableFlag; + + return Ok; }
GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes *imageAttr, diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 14a4b1b..e090de9 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -1125,7 +1125,7 @@ static void test_colormatrix(void)
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault); - todo_wine expect(Ok, stat); + expect(Ok, stat);
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, NULL, NULL, ColorMatrixFlagsDefault); @@ -1133,11 +1133,11 @@ static void test_colormatrix(void)
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault); - todo_wine expect(Ok, stat); + expect(Ok, stat);
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, &colormatrix, NULL, ColorMatrixFlagsSkipGrays); - todo_wine expect(Ok, stat); + expect(Ok, stat);
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, &colormatrix, NULL, ColorMatrixFlagsAltGray); @@ -1145,29 +1145,29 @@ static void test_colormatrix(void)
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsAltGray); - todo_wine expect(Ok, stat); + expect(Ok, stat);
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, &colormatrix, &graymatrix, 3); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeCount, TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeAny, TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, FALSE, NULL, NULL, ColorMatrixFlagsDefault); - todo_wine expect(Ok, stat); + expect(Ok, stat);
/* Drawing a bitmap transforms the colors */ colormatrix = double_red; stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault); - todo_wine expect(Ok, stat); + expect(Ok, stat);
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1); expect(Ok, stat);