From: amwaterhouse Date: Fri, 3 Feb 2006 17:48:22 +0000 (+0000) Subject: Conservation colouring does what it should always have done X-Git-Tag: Root_VamJalview_2_07b+~167 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=95ebd2cf76003f52476a7802c99831dfa98945f7;p=jalview.git Conservation colouring does what it should always have done --- diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index 3c8e690..78ebab0 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -216,69 +216,42 @@ public class ResidueColourScheme implements ColourSchemeI * * @return DOCUMENT ME! */ - void applyConservation(int i) - { - if ((conservation[i] != '*') && (conservation[i] != '+')) - { - int tmp = 10; - int t = 0; - - if (!jalview.util.Comparison.isGap(conservation[i])) - { - t = conservation[i]-'0'; - } - - while (tmp >= t) - { - lighter(inc); - tmp--; - } - } - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * @param inc DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - void lighter(int inc) + void applyConservation(int i) { - int red = currentColour.getRed(); - int blue = currentColour.getBlue(); - int green = currentColour.getGreen(); - if (red < (255 - inc)) + if ((conservation[i] != '*') && (conservation[i] != '+')) + { + if(jalview.util.Comparison.isGap(conservation[i])) { - red = red + inc; + currentColour = Color.white; } else { - red = 255; - } + float t = 11 - (conservation[i] - '0'); - if (blue < (255 - inc)) - { - blue = blue + inc; - } - else - { - blue = 255; - } + int red = currentColour.getRed(); + int green = currentColour.getGreen(); + int blue = currentColour.getBlue(); - if (green < (255 - inc)) - { - green = green + inc; + int dr = 255 - red; + int dg = 255 - green; + int db = 255 - blue; + + dr *= t / 10f; + dg *= t / 10f; + db *= t / 10f; + + red += (inc / 20f) * dr; + green += (inc / 20f) * dg; + blue += (inc / 20f) * db; + + if (red > 255 || green > 255 || blue > 255) + currentColour = Color.white; + else + currentColour = new Color(red, green, blue); } - else - { - green = 255; } - - currentColour = new Color(red, green, blue); }