/**
* Answers the feature colour to show for the given sequence and column
* position. This delegates to the FeatureRenderer to find the colour, which
- * will depend on feature location, visibility, ordering, and whether or not
- * transparency is applied. For feature rendering with transparency, this
- * class provides a dummy 'offscreen' graphics context where multiple feature
- * colours can be overlaid and the combined colour read back.
+ * will depend on feature location, visibility, ordering, colour scheme, and
+ * whether or not transparency is applied. For feature rendering with
+ * transparency, this class provides a dummy 'offscreen' graphics context
+ * where multiple feature colours can be overlaid and the combined colour read
+ * back.
*
* @param defaultColour
* @param seq
* @param column
+ * alignment column position (base zero)
* @return
*/
public Color findFeatureColour(Color defaultColour, SequenceI seq,
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);
- Color c = featureRenderer.findFeatureColour(defaultColour, seq, column,
- g);
if (c != null && g != null)
{
c = new Color(offscreenImage.getRGB(0, 0));