* single graphics context), then reset to (0, scale height)
*/
alignmentGraphics.translate(alignmentGraphicsOffset, scaleHeight);
- getSeqPanel().seqCanvas.drawPanelForPrint(alignmentGraphics, startRes,
+ getSeqPanel().seqCanvas.drawPanelForPrinting(alignmentGraphics, startRes,
endRes, startSeq, endSeq);
alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
pg.translate(idWidth, 0);
- getSeqPanel().seqCanvas.drawWrappedPanel(pg, pwidth - idWidth,
+ getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(pg, pwidth - idWidth,
totalHeight, 0);
if ((pi * pheight) < totalHeight)
* @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();
+ BufferedImage selectImage = new BufferedImage(canvasWidth, canvasHeight,
+ BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works
+
+ if (group != null)
+ {
+ Graphics2D g2 = selectImage.createGraphics();
+ setupSelectionGroup(g2, selectImage);
+ drawWrappedSelection(g2, group, canvasWidth, canvasHeight,
+ startRes);
+ drawWrappedPanel(g, 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();
// 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