gdiplus: Implement GdipSetImageAttributesRemapTable with updated test.

This commit is contained in:
Justin Chevrier 2010-03-03 20:06:33 -05:00 committed by Alexandre Julliard
parent 74a3945b00
commit 78f9177d9d
3 changed files with 28 additions and 12 deletions

View File

@ -264,10 +264,17 @@ struct color_matrix{
ColorMatrix graymatrix;
};
struct color_remap_table{
BOOL enabled;
INT mapsize;
GDIPCONST ColorMap *colormap;
};
struct GpImageAttributes{
WrapMode wrap;
struct color_key colorkeys[ColorAdjustTypeCount];
struct color_matrix colormatrices[ColorAdjustTypeCount];
struct color_remap_table colorremaptables[ColorAdjustTypeCount];
BOOL gamma_enabled[ColorAdjustTypeCount];
REAL gamma[ColorAdjustTypeCount];
};

View File

@ -204,14 +204,23 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt
ColorAdjustType type, BOOL enableFlag, UINT mapSize,
GDIPCONST ColorMap *map)
{
static int calls;
TRACE("(%p,%u,%i,%u,%p)\n", imageAttr, type, enableFlag, mapSize, map);
if(!(calls++))
FIXME("not implemented\n");
if(!imageAttr || type >= ColorAdjustTypeCount)
return InvalidParameter;
return NotImplemented;
if (enableFlag)
{
if(!map || !mapSize)
return InvalidParameter;
imageAttr->colorremaptables[type].mapsize = mapSize;
imageAttr->colorremaptables[type].colormap = map;
}
imageAttr->colorremaptables[type].enabled = enableFlag;
return Ok;
}
GpStatus WINGDIPAPI GdipSetImageAttributesThreshold(GpImageAttributes *imageAttr,

View File

@ -1760,28 +1760,28 @@ static void test_remaptable(void)
map->newColor.Argb = 0xffff00ff;
stat = GdipSetImageAttributesRemapTable(NULL, ColorAdjustTypeDefault, TRUE, 1, map);
todo_wine expect(InvalidParameter, stat);
expect(InvalidParameter, stat);
stat = GdipCreateImageAttributes(&imageattr);
expect(Ok, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, NULL);
todo_wine expect(InvalidParameter, stat);
expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeCount, TRUE, 1, map);
todo_wine expect(InvalidParameter, stat);
expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeAny, TRUE, 1, map);
todo_wine expect(InvalidParameter, stat);
expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 0, map);
todo_wine expect(InvalidParameter, stat);
expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, FALSE, 0, NULL);
todo_wine expect(Ok, stat);
expect(Ok, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, map);
todo_wine expect(Ok, stat);
expect(Ok, stat);
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1);
expect(Ok, stat);