gdiplus: Implement GdipSetImageAttributesColorMatrix.
This commit is contained in:
parent
70bdc43c20
commit
0c9991c583
@ -249,9 +249,17 @@ struct color_key{
|
|||||||
ARGB high;
|
ARGB high;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct color_matrix{
|
||||||
|
BOOL enabled;
|
||||||
|
ColorMatrixFlags flags;
|
||||||
|
ColorMatrix colormatrix;
|
||||||
|
ColorMatrix graymatrix;
|
||||||
|
};
|
||||||
|
|
||||||
struct GpImageAttributes{
|
struct GpImageAttributes{
|
||||||
WrapMode wrap;
|
WrapMode wrap;
|
||||||
struct color_key colorkeys[ColorAdjustTypeCount];
|
struct color_key colorkeys[ColorAdjustTypeCount];
|
||||||
|
struct color_matrix colormatrices[ColorAdjustTypeCount];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GpFont{
|
struct GpFont{
|
||||||
|
@ -89,15 +89,32 @@ GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix(GpImageAttributes *imageat
|
|||||||
ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix,
|
ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix,
|
||||||
GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags)
|
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;
|
return InvalidParameter;
|
||||||
|
|
||||||
if(!(calls++))
|
if (enableFlag)
|
||||||
FIXME("not implemented\n");
|
{
|
||||||
|
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,
|
GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes *imageAttr,
|
||||||
|
@ -1125,7 +1125,7 @@ static void test_colormatrix(void)
|
|||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
||||||
todo_wine expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, NULL, NULL, ColorMatrixFlagsDefault);
|
TRUE, NULL, NULL, ColorMatrixFlagsDefault);
|
||||||
@ -1133,11 +1133,11 @@ static void test_colormatrix(void)
|
|||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
||||||
todo_wine expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, &colormatrix, NULL, ColorMatrixFlagsSkipGrays);
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsSkipGrays);
|
||||||
todo_wine expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, &colormatrix, NULL, ColorMatrixFlagsAltGray);
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsAltGray);
|
||||||
@ -1145,29 +1145,29 @@ static void test_colormatrix(void)
|
|||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsAltGray);
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsAltGray);
|
||||||
todo_wine expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, &colormatrix, &graymatrix, 3);
|
TRUE, &colormatrix, &graymatrix, 3);
|
||||||
todo_wine expect(InvalidParameter, stat);
|
expect(InvalidParameter, stat);
|
||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeCount,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeCount,
|
||||||
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
||||||
todo_wine expect(InvalidParameter, stat);
|
expect(InvalidParameter, stat);
|
||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeAny,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeAny,
|
||||||
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
||||||
todo_wine expect(InvalidParameter, stat);
|
expect(InvalidParameter, stat);
|
||||||
|
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
FALSE, NULL, NULL, ColorMatrixFlagsDefault);
|
FALSE, NULL, NULL, ColorMatrixFlagsDefault);
|
||||||
todo_wine expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
|
|
||||||
/* Drawing a bitmap transforms the colors */
|
/* Drawing a bitmap transforms the colors */
|
||||||
colormatrix = double_red;
|
colormatrix = double_red;
|
||||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||||
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
||||||
todo_wine expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
|
|
||||||
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1);
|
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1);
|
||||||
expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user