diff --git a/helpfile.h b/helpfile.h index b213b506..83882786 100644 --- a/helpfile.h +++ b/helpfile.h @@ -883,7 +883,7 @@ static const T_Help_table helptable_grad_rect[] = HELP_TEXT ("starting color, drag to a point where you") HELP_TEXT ("want the ending color, and release the") HELP_TEXT ("button. You can press SHIFT to enforce your") - HELP_TEXT ("line to be vertical, horizontal, or + HELP_TEXT ("line to be vertical, horizontal, or") HELP_TEXT ("diagonal.") }; static const T_Help_table helptable_grad_menu[] = diff --git a/windows.c b/windows.c index abe34d76..b95485a0 100644 --- a/windows.c +++ b/windows.c @@ -2200,6 +2200,7 @@ byte Best_color(byte r,byte g,byte b) int delta_r,delta_g,delta_b; int dist; int best_dist=0x7FFFFFFF; + int rmean; byte best_color=0; for (col=0; col<256; col++) @@ -2210,7 +2211,10 @@ byte Best_color(byte r,byte g,byte b) delta_g=(int)Main_palette[col].G-g; delta_b=(int)Main_palette[col].B-b; - if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11))) + rmean = ( Main_palette[col].R + r ) / 2; + + if (!(dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8))) + //if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11))) return col; if (dist>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8))) + //if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11))) return col; if (dist