if (av.isShowAnnotation())
{
- pagesHigh += getAnnotationPanel().adjustPanelHeight() + 3;
+ pagesHigh += getAnnotationPanel().adjustPanelHeight()
+ + SeqCanvas.SEQS_ANNOTATION_GAP;
}
pagesHigh /= pageHeight;
{
return Printable.NO_SUCH_PAGE;
}
- final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight + 3;
+ final int alignmentDrawnHeight = (endSeq - startSeq + 1) * charHeight;
/*
* draw the Scale at horizontal offset, then reset to top left (0, 0)
* then reset to (0, scale height)
*/
int offset = getAlabels().getScrollOffset();
+ int yShift = alignmentDrawnHeight + SeqCanvas.SEQS_ANNOTATION_GAP;
idGraphics.translate(0, -offset);
- idGraphics.translate(0, alignmentDrawnHeight);
+ idGraphics.translate(0, yShift);
getAlabels().drawComponent(idGraphics, idWidth);
- idGraphics.translate(0, -alignmentDrawnHeight);
+ idGraphics.translate(0, -yShift);
/*
* draw the annotations starting at
* (idOffset, alignmentHeight) from (0, scaleHeight)
*/
alignmentGraphics.translate(alignmentGraphicsOffset,
- alignmentDrawnHeight);
+ yShift);
getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
alignmentGraphics, -1, startRes, endRes + 1);
/*
- * reset to left margin
+ * reset to left margin below annotation
*/
- alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
+ int justDrawn = getAnnotationPanel().renderer.getLastDrawnHeight();
+ alignmentGraphics.translate(-alignmentGraphicsOffset, justDrawn);
+ }
+ else
+ {
+ /*
+ * shift graphics to position after drawn sequences
+ */
+ alignmentGraphics.translate(0, alignmentDrawnHeight);
}
return Printable.PAGE_EXISTS;
/*
* append coding complement image
*/
- /*
- * to debug location of next write to Graphics
- */
- // graphics.setColor(Color.red);
+ // to debug location of next write to Graphics:
// graphics.drawString("Hello world", 0, 0);
if (av.getCodingComplement().getWrapAlignment())
{
* <ul>
* <li>sequence ids</li>
* <li>scale above, left or right if shown</li>
- * <li>sequences</li>
+ * <li>sequence rows, plus one spacer line</li>
* <li>annotations, if shown</li>
* </ul>
* The alignment may be in wrapped or unwrapped mode.
}
/**
- * Draw a wrapped alignment panel for printing
+ * Draws a wrapped alignment panel for printing. After drawing, the graphics
+ * origin is shifted down by the height of the image drawn.
*
* @param g
- * Graphics object to draw with
+ * Graphics object to draw with
* @param canvasWidth
- * width of drawing area
+ * width of drawing area
* @param canvasHeight
- * height of drawing area
+ * height of drawing area
* @param startRes
- * start residue of print area
+ * start residue of print area
*/
public void drawWrappedPanelForPrinting(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
// the Printable page which we need to account for here
Shape clip = g.getClip();
- if (clip == null)
- {
- // g.setClip(0, 0, viewportWidth * charWidth, canvasHeight);
- }
- else
+ if (clip != null)
{
g.setClip(0, (int) clip.getBounds().getY(),
viewportWidth * charWidth, (int) clip.getBounds().getHeight());
boolean rna = false;
+ private int lastDrawnHeight;
+
/**
* Render the annotation rows associated with an alignment.
*
System.err.println("Annotation Rendering time:"
+ (System.currentTimeMillis() - stime));
}
- if (!av.getWrapAlignment())
- {
- g.translate(0, y);
- }
+ lastDrawnHeight = y;
return !usedFaded;
}
+ /**
+ * Answers the height in pixels of what was drawn on the graphics in the last
+ * call to {@code drawComponent}
+ *
+ * @return
+ */
+ public int getLastDrawnHeight()
+ {
+ return lastDrawnHeight;
+ }
+
public static final Color GLYPHLINE_COLOR = Color.gray;
public static final Color SHEET_COLOUR = Color.green;
*/
package jalview.util;
+import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.gui.EPSOptions;
import jalview.gui.IProgressIndicator;
EpsGraphics2D pg;
- SVGGraphics2D g2;
-
Graphics graphics;
FileOutputStream out;
void setupSVG(int width, int height, String title)
{
+ Graphics2D svgGraphics = new SVGGraphics2D(width, height);
- g2 = new SVGGraphics2D(width, height);
- Graphics2D ig2 = g2;
-
- String renderStyle = jalview.bin.Cache.getDefault("SVG_RENDERING",
+ String renderStyle = Cache.getDefault("SVG_RENDERING",
"Prompt each time");
// If we need to prompt, and if the GUI is visible then
- // Prompt for EPS rendering style
+ // Prompt for SVG rendering style
if (renderStyle.equalsIgnoreCase("Prompt each time")
&& !(System.getProperty("java.awt.headless") != null && System
.getProperty("java.awt.headless").equals("true")))
if (renderStyle.equalsIgnoreCase("Lineart"))
{
- ig2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ svgGraphics.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
}
setProgressMessage(MessageManager
.formatMessage("status.export_complete", type.getName()));
- graphics = g2;
+ graphics = svgGraphics;
}
static JalviewFileChooser getPNGChooser()