From: gmungoc Date: Mon, 13 Mar 2017 17:00:19 +0000 (+0000) Subject: JAL-2438 corrected handling of default colour X-Git-Tag: Release_2_10_2~3^2~165 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a496dd6d71c9808c7a1c115ed5cf91ba4e246c21;p=jalview.git JAL-2438 corrected handling of default colour --- diff --git a/src/jalview/api/FeatureRenderer.java b/src/jalview/api/FeatureRenderer.java index b1813a6..3565488 100644 --- a/src/jalview/api/FeatureRenderer.java +++ b/src/jalview/api/FeatureRenderer.java @@ -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. diff --git a/src/jalview/renderer/seqfeatures/FeatureColourFinder.java b/src/jalview/renderer/seqfeatures/FeatureColourFinder.java index 5055ed5..6f4d4de 100644 --- a/src/jalview/renderer/seqfeatures/FeatureColourFinder.java +++ b/src/jalview/renderer/seqfeatures/FeatureColourFinder.java @@ -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)); diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index de3b201..7915fd0 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -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); }