*/
package jalview.gui;
-import jalview.datamodel.SequenceI;
-import jalview.viewmodel.ViewportListenerI;
-import jalview.viewmodel.ViewportRanges;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JPanel;
+import jalview.datamodel.SequenceI;
+import jalview.viewmodel.ViewportListenerI;
+import jalview.viewmodel.ViewportRanges;
+
/**
* DOCUMENT ME!
*
BufferedImage image;
- Graphics2D gg;
+// Graphics2D gg;
int imgHeight = 0;
g.drawString(s.getDisplayId(av.getShowJVSuffix()), xPos,
(((i - starty + 1) * charHeight) + ypos) - (charHeight / 5));
- if (hiddenRows)
+ if (hiddenRows && av.getShowHiddenMarkers())
{
drawMarker(g, av, i, starty, ypos);
}
*/
public void fastPaint(int vertical)
{
+
/*
* for now, not attempting fast paint of wrapped ids...
*/
- if (gg == null || av.getWrapAlignment())
+ if (image == null || av.getWrapAlignment())
{
repaint();
ViewportRanges ranges = av.getRanges();
+ Graphics2D gg = image.createGraphics();
gg.copyArea(0, 0, getWidth(), imgHeight, 0,
-vertical * av.getCharHeight());
gg.translate(0, -transY);
+ gg.dispose();
+
fastPaint = true;
// Call repaint on alignment panel so that repaints from other alignment
@Override
public void paintComponent(Graphics g)
{
- super.paintComponent(g);
-
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
BufferedImage.TYPE_INT_RGB);
}
- gg = (Graphics2D) image.getGraphics();
+ Graphics2D gg = image.createGraphics();
// Fill in the background
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
drawIds(gg, av, av.getRanges().getStartSeq(), av.getRanges().getEndSeq(), searchResults);
+
+ gg.dispose();
g.drawImage(image, 0, 0, this);
}
if (hasHiddenRows || alignViewport.isDisplayReferenceSeq())
{
g.setFont(getHiddenFont(sequence, alignViewport));
+ fm = g.getFontMetrics();
}
// Selected sequence colours
g.drawString(string, xPos, (((i - startSeq) * charHeight) + charHeight)
- (charHeight / 5));
- if (hasHiddenRows)
+ if (hasHiddenRows && av.getShowHiddenMarkers())
{
drawMarker(g, alignViewport, i, startSeq, 0);
}
int alignmentWidth = alignViewport.getAlignment().getWidth();
final int alheight = alignViewport.getAlignment().getHeight();
- int annotationHeight = 0;
+ /*
+ * assumption: SeqCanvas.calculateWrappedGeometry has been called
+ */
+ SeqCanvas seqCanvas = alignViewport.getAlignPanel()
+ .getSeqPanel().seqCanvas;
final int charHeight = alignViewport.getCharHeight();
- int hgap = charHeight;
- if (alignViewport.getScaleAboveWrapped())
- {
- hgap += charHeight;
- }
AnnotationLabels labels = null;
if (alignViewport.isShowAnnotation())
{
- if (ap == null)
- {
- ap = new AnnotationPanel(alignViewport);
- }
- annotationHeight = ap.adjustPanelHeight()
- + SeqCanvas.SEQS_ANNOTATION_GAP;
labels = new AnnotationLabels(alignViewport);
}
- /*
- * height of alignment + gap + annotations (if shown)
- */
- int cHeight = alheight * charHeight + hgap
- + annotationHeight;
-
ViewportRanges ranges = alignViewport.getRanges();
int rowSize = ranges.getViewportWidth();
* out of visible space, whichever comes first
*/
boolean hasHiddenRows = alignViewport.hasHiddenRows();
- int ypos = hgap;
+ int ypos = seqCanvas.wrappedSpaceAboveAlignment;
int rowStartRes = ranges.getStartRes();
while ((ypos <= pageHeight) && (rowStartRes < alignmentWidth))
{
g.translate(0, -ypos - (alheight * charHeight));
}
- ypos += cHeight;
+ ypos += seqCanvas.wrappedRepeatHeightPx;
rowStartRes += rowSize;
}
}