d3dx8: Implement D3DXColorAdjustSaturation.

This commit is contained in:
David Adam 2007-11-19 15:26:22 +01:00 committed by Alexandre Julliard
parent 4a28945505
commit 8389eab6b7
4 changed files with 22 additions and 2 deletions

View File

@ -66,7 +66,7 @@
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneTransform(ptr ptr ptr)
@ stub D3DXColorAdjustSaturation
@ stdcall D3DXColorAdjustSaturation(ptr ptr long)
@ stub D3DXColorAdjustContrast
@ stub D3DXCreateMatrixStack
@ stdcall D3DXCreateFont(ptr ptr ptr)

View File

@ -32,6 +32,20 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3dx8);
/*_________________D3DXColor____________________*/
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s)
{
FLOAT grey;
grey = pc->r * 0.2125f + pc->g * 0.7154f + pc->b * 0.0721f;
pout->r = grey + s * (pc->r - grey);
pout->g = grey + s * (pc->g - grey);
pout->b = grey + s * (pc->b - grey);
pout->a = pc->a;
return pout;
}
/*_________________D3DXMatrix____________________*/
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, float scaling, D3DXVECTOR3 *rotationcenter, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation)

View File

@ -67,6 +67,7 @@ static void D3DXColorTest(void)
color.r = 0.2f; color.g = 0.75f; color.b = 0.41f; color.a = 0.93f;
color1.r = 0.6f; color1.g = 0.55f; color1.b = 0.23f; color1.a = 0.82f;
color2.r = 0.3f; color2.g = 0.5f; color2.b = 0.76f; color2.a = 0.11f;
scale = 0.3f;
/*_______________D3DXColorAdd________________*/
@ -81,6 +82,11 @@ static void D3DXColorTest(void)
funcpointer = D3DXColorAdd(NULL,NULL,NULL);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorAdjustSaturation______*/
expected.r = 0.486028f; expected.g = 0.651028f; expected.b = 0.549028f, expected.a = 0.93f;
D3DXColorAdjustSaturation(&got,&color,scale);
expect_color(expected,got);
/*_______________D3DXColorLerp________________*/
expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f;
D3DXColorLerp(&got,&color,&color1,scale);
@ -436,7 +442,6 @@ static void D3DXMatrixTest(void)
static void D3DXPlaneTest(void)
{
D3DXMATRIX mat;
D3DXPLANE expectedplane, gotplane, nulplane, plane;
D3DXVECTOR3 expectedvec, gotvec, vec1, vec2, vec3;

View File

@ -263,6 +263,7 @@ typedef struct D3DXCOLOR
extern "C" {
#endif
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s);
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, float scaling, D3DXVECTOR3 *rotationcenter, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation);
FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm);
D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONST D3DXMATRIX *pm);