/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
*/
package jalview.util;
+import jalview.bin.Jalview;
import jalview.gui.EPSOptions;
+import jalview.gui.SVGOptions;
import jalview.io.JalviewFileChooser;
import java.awt.Component;
import javax.imageio.ImageIO;
import org.jfree.graphics2d.svg.SVGGraphics2D;
+import org.jfree.graphics2d.svg.SVGHints;
import org.jibble.epsgraphics.EpsGraphics2D;
public class ImageMaker
Graphics2D ig2 = (Graphics2D) graphics;
ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+
}
void setupSVG(int width, int height, String title)
{
+
g2 = new SVGGraphics2D(width, height);
+ Graphics2D ig2 = g2;
+
+ String renderStyle = jalview.bin.Cache.getDefault("SVG_RENDERING",
+ "Prompt each time");
+
+ // If we need to prompt, and if the GUI is visible then
+ // Prompt for EPS rendering style
+ if (renderStyle.equalsIgnoreCase("Prompt each time")
+ && !(System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
+ {
+ SVGOptions svgOption = new SVGOptions();
+ renderStyle = svgOption.getValue();
+
+ if (renderStyle == null || svgOption.cancelled)
+ {
+ return;
+ }
+ }
+
+ if (renderStyle.equalsIgnoreCase("lineart"))
+ {
+ ig2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
+ }
+
graphics = g2;
}
static JalviewFileChooser getPNGChooser()
{
+ if (Jalview.isHeadlessMode())
+ {
+ return null;
+ }
return new jalview.io.JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "png" }, new String[]
static JalviewFileChooser getEPSChooser()
{
+ if (Jalview.isHeadlessMode())
+ {
+ return null;
+ }
return new jalview.io.JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "eps" }, new String[]
static JalviewFileChooser getSVGChooser()
{
+ if (Jalview.isHeadlessMode())
+ {
+ return null;
+ }
return new jalview.io.JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "svg" }, new String[]