diff options
author | Ton Roosendaal <ton@blender.org> | 2004-08-05 03:19:57 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-08-05 03:19:57 +0400 |
commit | aae60395830c04b36fee5dfd89182d5e61554745 (patch) | |
tree | 1a87edab20df986cbf679c5f7d175737a95da46c /source/blender/src/interface.c | |
parent | 924cd728e21cd7aa283d1d05e05ca2c78b7949c2 (diff) |
Slightly improved clipping of rgb colors in HSV picker, to prevent the Hue
slider in bottom to block on colors 0,0,0 or 1,1,1
This is not scientific yet, but could be released :)
Diffstat (limited to 'source/blender/src/interface.c')
-rw-r--r-- | source/blender/src/interface.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 2ba8356047d..b56050b4d94 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -2302,24 +2302,26 @@ static int ui_do_but_HSVCUBE(uiBut *but) /* we're hacking values now to prevent rgb_to_hsv working wrong */ /* (ton) doesnt work yet... */ - CLAMP(x, 0.0005, 0.9995); - CLAMP(y, 0.0005, 0.9995); + CLAMP(x, 0.0002, 0.9998); + CLAMP(y, 0.0002, 0.9998); /* assign position to color */ ui_get_but_vectorf(but, col); + + /* another attempt to prevent hsv from hanging */ + CLAMP(col[0], 0.0002, 0.9998); + CLAMP(col[1], 0.0002, 0.9998); + CLAMP(col[2], 0.0002, 0.9998); + rgb_to_hsv(col[0], col[1], col[2], &h, &s, &v); - if(v==0.0) v= 0.0005; - if(s==0.0) s= 0.0005; + if(v==0.0) v= 0.0002; + if(s==0.0) s= 0.0002; if(but->a1==0) hsv_to_rgb(x, s, y, col, col+1, col+2); else if(but->a1==1) hsv_to_rgb(x, y, v, col, col+1, col+2); else if(but->a1==2) hsv_to_rgb(h, y, x, col, col+1, col+2); else hsv_to_rgb(x, s, v, col, col+1, col+2); - - if(col[0]<0.001) col[0]= 0.0; else if (col[0]>0.999) col[0]= 1.0; - if(col[1]<0.001) col[1]= 0.0; else if (col[1]>0.999) col[1]= 1.0; - if(col[2]<0.001) col[2]= 0.0; else if (col[2]>0.999) col[2]= 1.0; - + ui_set_but_vectorf(but, col); // update button values and strings |