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;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
/**
return c;
}
+ public int findFeatureColourInt(int defaultColour, SequenceI seq,
+ int column)
+ {
+ // if (noFeaturesDisplayed())
+ // {
+ // return defaultColour;
+ // }
+
+ Graphics2D g = null;
+
+ /*
+ * if transparency applies, provide a notional 1x1 graphics context
+ * that has been primed with the default colour
+ */
+ if (featureRenderer.getTransparency() != 1f)
+ {
+ g = (Graphics2D) goff;
+ if (Platform.isJS())
+ {
+ // Clear the HTML5 canvas color.
+ // otherwise we get a smearing.
+ // For whatever reason, this is necessary BH 2019.10.01.
+ g.setColor(Color.white);
+ g.fillRect(0, 0, 1, 1);
+ }
+ if (defaultColour != 0)
+ {
+ offscreenImage.setRGB(0, 0, defaultColour);
+ }
+ }
+ Color c = featureRenderer.findFeatureColour(seq, column + 1, g);
+ if (c == null)
+ {
+ return defaultColour;
+ }
+ if (g == null)
+ {
+ return c.getRGB();
+ }
+ if (Platform.isJS())
+ {
+ // BH 2019.10.01 because for JavaScript the pixel itself
+ // is a resource that needs to be recreated in getRGB(0,0)
+ offscreenImage.flush();
+ }
+ return offscreenImage.getRGB(0, 0);
+ }
/**
* Answers true if feature display is turned off, or there are no features
* configured to be visible