import jalview.api.FeatureRenderer;
import jalview.api.FeaturesDisplayedI;
import jalview.datamodel.SequenceI;
+import jalview.util.Platform;
import jalview.viewmodel.seqfeatures.FeatureRendererModel;
import java.awt.Color;
if (featureRenderer.getTransparency() != 1f)
{
g = goff;
- if (defaultColour != 0)
+ int c = (defaultColour == 0 ? -1 : defaultColour);
+ if (Platform.isJS())
{
- offscreenImage.setRGB(0, 0, defaultColour);
+ // Clear the HTML5 canvas color.
+ // otherwise we get a smearing.
+ // For whatever reason, this is necessary BH 2019.10.01.
+ g.setColor(new Color(c));
+ g.fillRect(0, 0, 1, 1);
}
+ offscreenImage.setRGB(0, 0, c);
}
Color c = featureRenderer.findFeatureColour(seq, column + 1, g);
if (g != null)
{
+ if (Platform.isJS())
+ {
+ // for JavaScript the pixel itself
+ // is a resource that needs to be recreated in getRGB(0,0)
+ offscreenImage.flush();
+ }
return offscreenImage.getRGB(0, 0);
}
return c.getRGB();