fix in RGB_to_HSV.

This commit is contained in:
Cracker64 2011-04-22 23:20:15 -04:00 committed by Simon Robertshaw
parent bd8de4c842
commit 085ea571b8

View File

@ -613,12 +613,14 @@ void RGB_to_HSV(int r,int g,int b,int *h,int *s,int *v)//convert 0-255 HSV value
*s = 0; *s = 0;
*v = a; *v = a;
} }
else
{
c = (rr==a) ? gg-bb : ((bb==a) ? rr-gg : bb-rr); c = (rr==a) ? gg-bb : ((bb==a) ? rr-gg : bb-rr);
d = (rr==a) ? 3 : ((bb==a) ? 1 : 5); d = (rr==a) ? 3 : ((bb==a) ? 1 : 5);
*h = (int)(42.667*(d - c/(x - a))); *h = (int)(42.667*(d - c/(x - a)));
*s = (int)(256.0*((x - a)/x)); *s = (int)(256.0*((x - a)/x));
*v = (int)(256.0*x); *v = (int)(256.0*x);
} }
}
vector2d v2d_zero = {0,0}; vector2d v2d_zero = {0,0};
matrix2d m2d_identity = {1,0,0,1}; matrix2d m2d_identity = {1,0,0,1};