JAL-2438 corrected handling of default colour
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 13 Mar 2017 17:00:19 +0000 (17:00 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 13 Mar 2017 17:00:19 +0000 (17:00 +0000)
src/jalview/api/FeatureRenderer.java
src/jalview/renderer/seqfeatures/FeatureColourFinder.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java

index b1813a6..3565488 100644 (file)
@@ -41,8 +41,6 @@ public interface FeatureRenderer
    * compute the perceived colour for a given column position in sequenceI,
    * taking transparency and feature visibility into account.
    * 
-   * @param col
-   *          - background colour (due to alignment/group shading schemes, etc).
    * @param sequenceI
    *          - sequence providing features
    * @param r
@@ -50,7 +48,7 @@ public interface FeatureRenderer
    * @param g
    * @return
    */
-  Color findFeatureColour(Color col, SequenceI sequenceI, int r, Graphics g);
+  Color findFeatureColour(SequenceI sequenceI, int r, Graphics g);
 
   /**
    * trigger the feature discovery process for a newly created feature renderer.
index 5055ed5..6f4d4de 100644 (file)
@@ -68,8 +68,7 @@ public class FeatureColourFinder
     Graphics g = featureRenderer.getTransparency() == 1f ? null
             : offscreenImage.getGraphics();
 
-    Color c = featureRenderer.findFeatureColour(defaultColour, seq, column,
-            g);
+    Color c = featureRenderer.findFeatureColour(seq, column, g);
     if (c != null && g != null)
     {
       c = new Color(offscreenImage.getRGB(0, 0));
index de3b201..7915fd0 100644 (file)
@@ -31,7 +31,6 @@ import java.awt.Color;
 import java.awt.FontMetrics;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
-import java.awt.image.BufferedImage;
 
 public class FeatureRenderer extends FeatureRendererModel
 {
@@ -40,8 +39,6 @@ public class FeatureRenderer extends FeatureRendererModel
 
   protected SequenceI lastSeq;
 
-  BufferedImage offscreenImage;
-
   private volatile SequenceFeature[] lastSequenceFeatures;
 
   int sfSize;
@@ -216,18 +213,16 @@ public class FeatureRenderer extends FeatureRendererModel
    * This is used by Structure Viewers and the Overview Window to get the
    * feature colour of the rendered sequence
    * 
-   * @param defaultColour
    * @param seq
    * @param column
    * @return
    */
   @Override
-  public Color findFeatureColour(Color defaultColour, SequenceI seq,
-          int column, Graphics g)
+  public Color findFeatureColour(SequenceI seq, int column, Graphics g)
   {
     if (!av.isShowSequenceFeatures())
     {
-      return defaultColour;
+      return null;
     }
 
     SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures();
@@ -254,7 +249,7 @@ public class FeatureRenderer extends FeatureRendererModel
 
     if (lastSequenceFeatures == null || sfSize == 0)
     {
-      return defaultColour;
+      return null;
     }
 
     if (Comparison.isGap(lastSeq.getCharAt(column)))
@@ -271,7 +266,7 @@ public class FeatureRenderer extends FeatureRendererModel
     {
       renderedColour = drawSequence(g, lastSeq, column, column, 0, true);
     }
-    return renderedColour == null ? defaultColour : renderedColour;
+    return renderedColour;
   }
 
   /**
@@ -415,13 +410,8 @@ public class FeatureRenderer extends FeatureRendererModel
     if (transparency != 1.0f && g != null)
     {
       /*
-       * get colour as rendered including transparency
-       * and reset transparency
+       * reset transparency
        */
-      if (offscreenImage != null && drawnColour != null)
-      {
-        drawnColour = new Color(offscreenImage.getRGB(0, 0));
-      }
       Graphics2D g2 = (Graphics2D) g;
       g2.setComposite(NO_TRANSPARENCY);
     }