+ void renderScoreFeature(Graphics g, SequenceI seq, int fstart, int fend,
+ Color featureColour, int start, int end, int y1, byte[] bs)
+ {
+
+ if (((fstart <= end) && (fend >= start)))
+ {
+ if (fstart < start)
+ { // fix for if the feature we have starts before the sequence start,
+ fstart = start; // but the feature end is still valid!!
+ }
+
+ if (fend >= end)
+ {
+ fend = end;
+ }
+ int pady = (y1 + av.charHeight) - av.charHeight / 5;
+ int ystrt = 0, yend = av.charHeight;
+ if (bs[0] != 0)
+ {
+ // signed - zero is always middle of residue line.
+ if (bs[1] < 128)
+ {
+ yend = av.charHeight * (128 - bs[1]) / 512;
+ ystrt = av.charHeight - yend / 2;
+ }
+ else
+ {
+ ystrt = av.charHeight / 2;
+ yend = av.charHeight * (bs[1] - 128) / 512;
+ }
+ }
+ else
+ {
+ yend = av.charHeight * bs[1] / 255;
+ ystrt = av.charHeight - yend;
+
+ }
+ for (i = fstart; i <= fend; i++)
+ {
+ s = seq.getCharAt(i);
+
+ if (jalview.util.Comparison.isGap(s))
+ {
+ continue;
+ }
+
+ g.setColor(featureColour);
+ int x = (i - start) * av.charWidth;
+ g.drawRect(x, y1, av.charWidth, av.charHeight);
+ g.fillRect(x, y1 + ystrt, av.charWidth, yend);
+
+ if (offscreenRender || !av.validCharWidth)
+ {
+ continue;
+ }
+
+ g.setColor(Color.black);
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ g.drawString(String.valueOf(s), charOffset
+ + (av.charWidth * (i - start)), pady);
+
+ }
+ }
+ }
+