Commit 2b8b64f9 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

gdiplus: Implement GdipResetImageAttributes.

parent 2c6b5d33
......@@ -455,7 +455,7 @@
455 stdcall GdipReleaseDC(ptr ptr)
456 stdcall GdipRemovePropertyItem(ptr long)
457 stdcall GdipResetClip(ptr)
458 stub GdipResetImageAttributes
458 stdcall GdipResetImageAttributes(ptr long)
459 stdcall GdipResetLineTransform(ptr)
460 stdcall GdipResetPageTransform(ptr)
461 stdcall GdipResetPath(ptr)
......
......@@ -270,3 +270,20 @@ GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity(GpImageAttributes *imageAtt
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;
}
......@@ -2211,6 +2211,17 @@ static void test_colormatrix(void)
expect(Ok, stat);
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);
GdipDisposeImage((GpImage*)bitmap1);
GdipDisposeImage((GpImage*)bitmap2);
......@@ -2273,6 +2284,17 @@ static void test_gamma(void)
expect(Ok, stat);
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);
GdipDisposeImage((GpImage*)bitmap1);
GdipDisposeImage((GpImage*)bitmap2);
......@@ -2604,6 +2626,17 @@ static void test_remaptable(void)
expect(Ok, stat);
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);
GdipDisposeImage((GpImage*)bitmap1);
GdipDisposeImage((GpImage*)bitmap2);
......@@ -2661,19 +2694,43 @@ static void test_colorkey(void)
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
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);
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);
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);
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);
GdipDisposeImage((GpImage*)bitmap1);
......
......@@ -458,6 +458,8 @@ GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity(GpImageAttributes*,
ColorAdjustType);
GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes*,WrapMode,
ARGB,BOOL);
GpStatus WINGDIPAPI GdipResetImageAttributes(GpImageAttributes*,
ColorAdjustType);
/* LinearGradientBrush */
GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF*,GDIPCONST GpPointF*,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment