private static final AlphaComposite NO_TRANSPARENCY = AlphaComposite
.getInstance(AlphaComposite.SRC_OVER, 1.0f);
+ /*
+ * persistent list used by JalviewJS; not threadsafe for Java
+ */
+ private List<SequenceFeature> overlaps = (Platform.isJS()
+ ? new ArrayList<>()
+ : null);
+
/**
* Constructor given a viewport
*
@Override
public Color findFeatureColour(SequenceI seq, int column, Graphics g)
{
- // BH 2019.08.01
- // this is already checked in FeatureColorFinder
- // if (!av.isShowSequenceFeatures())
- // {
- // return null;
- // }
-
// column is 'base 1' but getCharAt is an array index (ie from 0)
if (Comparison.isGap(seq.getCharAt(column - 1)))
{
* applies), or null if no feature is drawn in the range given.
*
* @param g
- * the graphics context to draw on (may be null only if t == 1 from
- * colourOnly==true)
+ * the graphics context to draw on (null if no transparency applies)
* @param seq
* @param start
* start column
final SequenceI seq, int start, int end, int y1,
boolean colourOnly)
{
- // from SeqCanvas and OverviewRender
/*
* if columns are all gapped, or sequence has no features, nothing to do
*/
updateFeatures();
- if (transparency != 1f) // g cannot be null here if trans == 1f - BH // && g
- // != null)
+ if (transparency != 1f)
{
((Graphics2D) g).setComposite(
AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
findAllFeatures();
}
- private List<SequenceFeature> overlaps = (Platform.isJS()
- ? new ArrayList<>()
- : null);
-
/**
* Returns the sequence feature colour rendered at the given column position,
* or null if none found. The feature of highest render order (i.e. on top) is
* colour for features enclosing a gapped column. Check for gap before calling
* if different behaviour is wanted.
*
- * BH 2019.07.30
- *
- * Adds a result ArrayList to parameters in order to avoid an unnecessary
- * construction of that for every pixel checked.
- *
- *
* @param seq
* @param column
* (1..)
continue;
}
+ /*
+ * field overlaps is used by JalviewJS to avoid object creation;
+ * not thread-safe for Java (Javascript is single-threaded)
+ */
if (overlaps != null)
{
overlaps.clear();