*\r
* @return DOCUMENT ME!\r
*/\r
- void applyConservation(int i)\r
- {\r
- if ((conservation[i] != '*') && (conservation[i] != '+'))\r
- {\r
- int tmp = 10;\r
- int t = 0;\r
-\r
- if (!jalview.util.Comparison.isGap(conservation[i]))\r
- {\r
- t = conservation[i]-'0';\r
- }\r
-\r
- while (tmp >= t)\r
- {\r
- lighter(inc);\r
- tmp--;\r
- }\r
- }\r
\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param c DOCUMENT ME!\r
- * @param inc DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- void lighter(int inc)\r
+ void applyConservation(int i)\r
{\r
- int red = currentColour.getRed();\r
- int blue = currentColour.getBlue();\r
- int green = currentColour.getGreen();\r
\r
- if (red < (255 - inc))\r
+ if ((conservation[i] != '*') && (conservation[i] != '+'))\r
+ {\r
+ if(jalview.util.Comparison.isGap(conservation[i]))\r
{\r
- red = red + inc;\r
+ currentColour = Color.white;\r
}\r
else\r
{\r
- red = 255;\r
- }\r
+ float t = 11 - (conservation[i] - '0');\r
\r
- if (blue < (255 - inc))\r
- {\r
- blue = blue + inc;\r
- }\r
- else\r
- {\r
- blue = 255;\r
- }\r
+ int red = currentColour.getRed();\r
+ int green = currentColour.getGreen();\r
+ int blue = currentColour.getBlue();\r
\r
- if (green < (255 - inc))\r
- {\r
- green = green + inc;\r
+ int dr = 255 - red;\r
+ int dg = 255 - green;\r
+ int db = 255 - blue;\r
+\r
+ dr *= t / 10f;\r
+ dg *= t / 10f;\r
+ db *= t / 10f;\r
+\r
+ red += (inc / 20f) * dr;\r
+ green += (inc / 20f) * dg;\r
+ blue += (inc / 20f) * db;\r
+\r
+ if (red > 255 || green > 255 || blue > 255)\r
+ currentColour = Color.white;\r
+ else\r
+ currentColour = new Color(red, green, blue);\r
}\r
- else\r
- {\r
- green = 255;\r
}\r
-\r
- currentColour = new Color(red, green, blue);\r
}\r
\r
\r