{
g.drawString(mstring, mpos * charWidth, ypos - (charHeight / 2));
}
- g.drawLine((mpos * charWidth) + (charWidth / 2), (ypos + 2)
- - (charHeight / 2), (mpos * charWidth) + (charWidth / 2),
- ypos - 2);
+ g.drawLine((mpos * charWidth) + (charWidth / 2),
+ (ypos + 2) - (charHeight / 2),
+ (mpos * charWidth) + (charWidth / 2), ypos - 2);
}
}
}
{
int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))
- charWidth / 2;
- g.drawString(value + "", x, (ypos + (i * charHeight))
- - (charHeight / 5));
+ g.drawString(value + "", x,
+ (ypos + (i * charHeight)) - (charHeight / 5));
}
}
}
if (value != -1)
{
- g.drawString(String.valueOf(value), 0, (ypos + (i * charHeight))
- - (charHeight / 5));
+ g.drawString(String.valueOf(value), 0,
+ (ypos + (i * charHeight)) - (charHeight / 5));
}
}
}
* @param endSeq
* end sequence of print area
*/
- public void drawPanelForPrint(Graphics g1, int startRes, int endRes,
+ public void drawPanelForPrinting(Graphics g1, int startRes, int endRes,
int startSeq, int endSeq)
{
BufferedImage selectImage = drawSelectionGroup(startRes, endRes,
g1.drawImage(selectImage, 0, 0, this);
}
+ /**
+ * Draw a wrapped alignment panel for printing
+ *
+ * @param g
+ * Graphics object to draw with
+ * @param canvasWidth
+ * width of drawing area
+ * @param canvasHeight
+ * height of drawing area
+ * @param startRes
+ * start residue of print area
+ */
+ public void drawWrappedPanelForPrinting(Graphics g, int canvasWidth,
+ int canvasHeight, int startRes)
+ {
+ SequenceGroup group = av.getSelectionGroup();
+
+ drawWrappedPanel(g, canvasWidth, canvasHeight, startRes);
+
+ if (group != null)
+ {
+ BufferedImage selectImage = null;
+ try
+ {
+ selectImage = new BufferedImage(canvasWidth, canvasHeight,
+ BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works
+ } catch (OutOfMemoryError er)
+ {
+ System.gc();
+ System.err.println("Print image OutOfMemory Error.\n" + er);
+ new OOMWarning("Creating wrapped alignment image for printing", er);
+ }
+ if (selectImage != null)
+ {
+ Graphics2D g2 = selectImage.createGraphics();
+ setupSelectionGroup(g2, selectImage);
+ drawWrappedSelection(g2, group, canvasWidth, canvasHeight,
+ startRes);
+
+ g2.setComposite(
+ AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
+ g.drawImage(selectImage, 0, 0, this);
+ g2.dispose();
+ }
+ }
+ }
+
/*
* Make a local image by combining the cached image img
* with any selection
* @param startRes
* DOCUMENT ME!
*/
- public void drawWrappedPanel(Graphics g, int canvasWidth,
+ private void drawWrappedPanel(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
{
updateViewport();
}
gg.fillPolygon(
- new int[] { res * charWidth - charHeight / 4,
+ new int[]
+ { res * charWidth - charHeight / 4,
res * charWidth + charHeight / 4, res * charWidth },
- new int[] { ypos - (charHeight / 2),
- ypos - (charHeight / 2), ypos - (charHeight / 2) + 8 },
+ new int[]
+ { ypos - (charHeight / 2), ypos - (charHeight / 2),
+ ypos - (charHeight / 2) + 8 },
3);
}
annotations = new AnnotationPanel(av);
}
- annotations.renderer.drawComponent(annotations, av, g, -1,
- startRes, endx + 1);
+ annotations.renderer.drawComponent(annotations, av, g, -1, startRes,
+ endx + 1);
g.translate(0, -cHeight - ypos - 3);
}
g.setClip(clip);
if (av.isShowSequenceFeatures())
{
- fr.drawSequence(g, nextSeq, startRes, endRes, offset
- + ((i - startSeq) * charHeight), false);
+ fr.drawSequence(g, nextSeq, startRes, endRes,
+ offset + ((i - startSeq) * charHeight), false);
}
// / Highlight search Results once all sequences have been drawn
{
drawPartialGroupOutline(g, group, startRes, endRes, startSeq,
endSeq, offset);
-
+
groupIndex++;
g.setStroke(new BasicStroke());
// set up drawing colour
Graphics2D g = (Graphics2D) selectionImage.getGraphics();
- // set background to transparent
- g.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
- g.fillRect(0, 0, selectionImage.getWidth(), selectionImage.getHeight());
-
- // set up foreground to draw red dashed line
- g.setComposite(AlphaComposite.Src);
- g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT,
- BasicStroke.JOIN_ROUND, 3f, new float[]
- { 5f, 3f }, 0f));
- g.setColor(Color.RED);
+ setupSelectionGroup(g, selectionImage);
if (!av.getWrapAlignment())
{
}
/*
+ * Set up graphics for selection group
+ */
+ private void setupSelectionGroup(Graphics2D g,
+ BufferedImage selectionImage)
+ {
+ // set background to transparent
+ g.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
+ g.fillRect(0, 0, selectionImage.getWidth(), selectionImage.getHeight());
+
+ // set up foreground to draw red dashed line
+ g.setComposite(AlphaComposite.Src);
+ g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT,
+ BasicStroke.JOIN_ROUND, 3f, new float[]
+ { 5f, 3f }, 0f));
+ g.setColor(Color.RED);
+ }
+
+ /*
* Draw a selection group over an unwrapped alignment
* @param g graphics object to draw with
* @param group selection group