JAL-2438 unit test, fixes, Javadoc updates
[jalview.git] / src / jalview / renderer / seqfeatures / FeatureColourFinder.java
index 761f418..9a1ecf9 100644 (file)
@@ -67,10 +67,20 @@ public class FeatureColourFinder
       return defaultColour; // nothing to see here folks
     }
 
-    Graphics g = featureRenderer.getTransparency() == 1f ? null
-            : offscreenImage.getGraphics();
+    Graphics g = null;
+
+    /*
+     * if transparency applies, get colours drawn to a 1x1 pixel
+     * graphics context that has been primed with the default colour
+     */
+    if (featureRenderer.getTransparency() != 1f)
+    {
+      g = offscreenImage.getGraphics();
+      offscreenImage.setRGB(0, 0, defaultColour.getRGB());
+    }
 
     Color c = featureRenderer.findFeatureColour(seq, column, g);
+
     if (c != null && g != null)
     {
       c = new Color(offscreenImage.getRGB(0, 0));