Permalink
Browse files

round the hsv to rgb results a little more nicely for integer RGB

  • Loading branch information...
1 parent 28769ac commit 87039ee865896973d976822652c93e9461330039 Tony Cook committed Jan 22, 2002
Showing with 5 additions and 4 deletions.
  1. +5 −4 color.c
View
@@ -173,13 +173,14 @@ void i_hsv_to_rgb(i_color *color) {
}
else {
int i;
- double f, m, n, k;
+ double f;
+ int m, n, k;
h = h / 255.0 * 6;
i = h;
f = h - i;
- m = v * (255 - s) / 255;
- n = v * (255 - s * f) / 255;
- k = v * (255 - s * (1 - f)) / 255;
+ m = 0.5 + v * (255 - s) / 255;
+ n = 0.5 + v * (255 - s * f) / 255;
+ k = 0.5 + v * (255 - s * (1 - f)) / 255;
switch (i) {
case 0:
color->rgb.r = v; color->rgb.g = k; color->rgb.b = m;

0 comments on commit 87039ee

Please sign in to comment.