gdiplus: Implement GdipSetImageAttributesColorMatrix.
This commit is contained in:
parent
70bdc43c20
commit
0c9991c583
|
@ -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{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue