gdiplus: Implement GdipResetImageAttributes.

This commit is contained in:
Andrew Eikum 2013-05-22 11:12:18 -05:00 committed by Alexandre Julliard
parent 2c6b5d33d1
commit 2b8b64f9ab
4 changed files with 81 additions and 5 deletions

View File

@ -455,7 +455,7 @@
455 stdcall GdipReleaseDC(ptr ptr) 455 stdcall GdipReleaseDC(ptr ptr)
456 stdcall GdipRemovePropertyItem(ptr long) 456 stdcall GdipRemovePropertyItem(ptr long)
457 stdcall GdipResetClip(ptr) 457 stdcall GdipResetClip(ptr)
458 stub GdipResetImageAttributes 458 stdcall GdipResetImageAttributes(ptr long)
459 stdcall GdipResetLineTransform(ptr) 459 stdcall GdipResetLineTransform(ptr)
460 stdcall GdipResetPageTransform(ptr) 460 stdcall GdipResetPageTransform(ptr)
461 stdcall GdipResetPath(ptr) 461 stdcall GdipResetPath(ptr)

View File

@ -270,3 +270,20 @@ GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity(GpImageAttributes *imageAtt
return NotImplemented; return NotImplemented;
} }
GpStatus WINGDIPAPI GdipResetImageAttributes(GpImageAttributes *imageAttr,
ColorAdjustType type)
{
TRACE("(%p,%u)\n", imageAttr, type);
if(!imageAttr || type >= ColorAdjustTypeCount)
return InvalidParameter;
memset(&imageAttr->colorkeys[type], 0, sizeof(imageAttr->colorkeys[type]));
memset(&imageAttr->colormatrices[type], 0, sizeof(imageAttr->colormatrices[type]));
memset(&imageAttr->colorremaptables[type], 0, sizeof(imageAttr->colorremaptables[type]));
memset(&imageAttr->gamma_enabled[type], 0, sizeof(imageAttr->gamma_enabled[type]));
memset(&imageAttr->gamma[type], 0, sizeof(imageAttr->gamma[type]));
return Ok;
}

View File

@ -2211,6 +2211,17 @@ static void test_colormatrix(void)
expect(Ok, stat); expect(Ok, stat);
ok(color_match(0xeeff40cc, color, 3), "expected 0xeeff40cc, got 0x%08x\n", color); ok(color_match(0xeeff40cc, color, 3), "expected 0xeeff40cc, got 0x%08x\n", color);
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault);
expect(Ok, stat);
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
UnitPixel, imageattr, NULL, NULL);
expect(Ok, stat);
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
expect(Ok, stat);
ok(color_match(0xff40ccee, color, 1), "Expected ff40ccee, got %.8x\n", color);
GdipDeleteGraphics(graphics); GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap1); GdipDisposeImage((GpImage*)bitmap1);
GdipDisposeImage((GpImage*)bitmap2); GdipDisposeImage((GpImage*)bitmap2);
@ -2273,6 +2284,17 @@ static void test_gamma(void)
expect(Ok, stat); expect(Ok, stat);
ok(color_match(0xff20ffff, color, 1), "Expected ff20ffff, got %.8x\n", color); ok(color_match(0xff20ffff, color, 1), "Expected ff20ffff, got %.8x\n", color);
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault);
expect(Ok, stat);
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
UnitPixel, imageattr, NULL, NULL);
expect(Ok, stat);
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
expect(Ok, stat);
ok(color_match(0xff80ffff, color, 1), "Expected ff80ffff, got %.8x\n", color);
GdipDeleteGraphics(graphics); GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap1); GdipDisposeImage((GpImage*)bitmap1);
GdipDisposeImage((GpImage*)bitmap2); GdipDisposeImage((GpImage*)bitmap2);
@ -2604,6 +2626,17 @@ static void test_remaptable(void)
expect(Ok, stat); expect(Ok, stat);
ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color); ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color);
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault);
expect(Ok, stat);
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
UnitPixel, imageattr, NULL, NULL);
expect(Ok, stat);
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
expect(Ok, stat);
ok(color_match(0xff00ff00, color, 1), "Expected ff00ff00, got %.8x\n", color);
GdipDeleteGraphics(graphics); GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap1); GdipDisposeImage((GpImage*)bitmap1);
GdipDisposeImage((GpImage*)bitmap2); GdipDisposeImage((GpImage*)bitmap2);
@ -2661,19 +2694,43 @@ static void test_colorkey(void)
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
expect(Ok, stat); expect(Ok, stat);
ok(color_match(0x00000000, color, 1), "Expected ffff00ff, got %.8x\n", color); ok(color_match(0x00000000, color, 1), "Expected 00000000, got %.8x\n", color);
stat = GdipBitmapGetPixel(bitmap2, 0, 1, &color); stat = GdipBitmapGetPixel(bitmap2, 0, 1, &color);
expect(Ok, stat); expect(Ok, stat);
ok(color_match(0x00000000, color, 1), "Expected ffff00ff, got %.8x\n", color); ok(color_match(0x00000000, color, 1), "Expected 00000000, got %.8x\n", color);
stat = GdipBitmapGetPixel(bitmap2, 1, 0, &color); stat = GdipBitmapGetPixel(bitmap2, 1, 0, &color);
expect(Ok, stat); expect(Ok, stat);
ok(color_match(0x00000000, color, 1), "Expected ffff00ff, got %.8x\n", color); ok(color_match(0x00000000, color, 1), "Expected 00000000, got %.8x\n", color);
stat = GdipBitmapGetPixel(bitmap2, 1, 1, &color); stat = GdipBitmapGetPixel(bitmap2, 1, 1, &color);
expect(Ok, stat); expect(Ok, stat);
ok(color_match(0xffffffff, color, 1), "Expected ffff00ff, got %.8x\n", color); ok(color_match(0xffffffff, color, 1), "Expected ffffffff, got %.8x\n", color);
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault);
expect(Ok, stat);
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,2,2, 0,0,2,2,
UnitPixel, imageattr, NULL, NULL);
expect(Ok, stat);
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
expect(Ok, stat);
ok(color_match(0x20405060, color, 1), "Expected 20405060, got %.8x\n", color);
stat = GdipBitmapGetPixel(bitmap2, 0, 1, &color);
expect(Ok, stat);
ok(color_match(0x40506070, color, 1), "Expected 40506070, got %.8x\n", color);
stat = GdipBitmapGetPixel(bitmap2, 1, 0, &color);
expect(Ok, stat);
ok(color_match(0x60708090, color, 1), "Expected 60708090, got %.8x\n", color);
stat = GdipBitmapGetPixel(bitmap2, 1, 1, &color);
expect(Ok, stat);
ok(color_match(0xffffffff, color, 1), "Expected ffffffff, got %.8x\n", color);
GdipDeleteGraphics(graphics); GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap1); GdipDisposeImage((GpImage*)bitmap1);

View File

@ -458,6 +458,8 @@ GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity(GpImageAttributes*,
ColorAdjustType); ColorAdjustType);
GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes*,WrapMode, GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes*,WrapMode,
ARGB,BOOL); ARGB,BOOL);
GpStatus WINGDIPAPI GdipResetImageAttributes(GpImageAttributes*,
ColorAdjustType);
/* LinearGradientBrush */ /* LinearGradientBrush */
GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF*,GDIPCONST GpPointF*, GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF*,GDIPCONST GpPointF*,