summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-05-30 02:18:47 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-06-02 19:24:02 (GMT)
commite3ef7f05f00f67906ef75eaac518294ec7622b45 (patch)
tree9c68c8f28b56dd74d669c5f47642e37e09fbcc84 /src/misc.c
parent469de0cae01e709e527d20cdbd5fb23c09ca5db9 (diff)
downloadpowder-e3ef7f05f00f67906ef75eaac518294ec7622b45.zip
powder-e3ef7f05f00f67906ef75eaac518294ec7622b45.tar.gz
some more deco editor changes. Right click deletes decoration again.
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/misc.c b/src/misc.c
index dcf2f88..73d6070 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -552,15 +552,15 @@ int register_extension()
#endif
}
-void HSV_to_RGB(int h,int s,int v,int *r,int *g,int *b)//convert 0-255 HSV values to 0-255 RGB
+void HSV_to_RGB(int h,int s,int v,int *r,int *g,int *b)//convert 0-255(0-360 for H) HSV values to 0-255 RGB
{
float hh, ss, vv, c, x;
int m;
- hh = h/42.66667f;//normalize values
+ hh = h/60.0f;//normalize values
ss = s/255.0f;
vv = v/255.0f;
c = vv * ss;
- x = c * ( 1 - fabsf(fmod(hh,2.0) -1) );
+ x = c * ( 1 - fabs(fmod(hh,2.0) -1) );
if(hh<1){
*r = (int)(c*255.0);
*g = (int)(x*255.0);
@@ -597,7 +597,7 @@ void HSV_to_RGB(int h,int s,int v,int *r,int *g,int *b)//convert 0-255 HSV value
*b += m;
}
-void RGB_to_HSV(int r,int g,int b,int *h,int *s,int *v)//convert 0-255 RGB values to 0-255 HSV
+void RGB_to_HSV(int r,int g,int b,int *h,int *s,int *v)//convert 0-255 RGB values to 0-255(0-360 for H) HSV
{
float rr, gg, bb, a,x,c,d;
rr = r/255.0f;//normalize values
@@ -617,7 +617,7 @@ void RGB_to_HSV(int r,int g,int b,int *h,int *s,int *v)//convert 0-255 RGB value
{
c = (rr==a) ? gg-bb : ((bb==a) ? rr-gg : bb-rr);
d = (rr==a) ? 3 : ((bb==a) ? 1 : 5);
- *h = (int)(42.66667*(d - c/(x - a)));
+ *h = (int)(60.0*(d - c/(x - a)));
*s = (int)(255.0*((x - a)/x));
*v = (int)(255.0*x);
}