use of org.freehep.graphicsio.svg.SVGGraphics2D in project abstools by abstools.
the class ExporterImpl method getGraphics.
private VectorGraphics getGraphics() {
VectorGraphics vectorGraphics;
if (orientation == null) {
orientation = dim.getWidth() <= dim.getHeight() ? "Portrait" : "Landscape";
}
if (type.equals("gif")) {
vectorGraphics = new GIFGraphics2D(stream, dim);
} else if (type.equals("png")) {
vectorGraphics = new ImageGraphics2D(stream, dim, "png");
} else if (type.equals("bmp")) {
vectorGraphics = new ImageGraphics2D(stream, dim, "bmp");
} else if (type.equals("jpg")) {
vectorGraphics = new ImageGraphics2D(stream, dim, "jpg");
} else if (type.equals("pdf")) {
PDFGraphics2D pdf = new PDFGraphics2D(stream, dim);
Properties properties = new Properties();
properties.setProperty(PDFGraphics2D.ORIENTATION, orientation);
properties.setProperty(PDFGraphics2D.PAGE_SIZE, format);
pdf.setProperties(properties);
vectorGraphics = pdf;
} else if (type.equals("ps")) {
PSGraphics2D ps = new PSGraphics2D(stream, dim);
Properties properties = new Properties();
properties.setProperty(PSGraphics2D.ORIENTATION, orientation);
properties.setProperty(PSGraphics2D.PAGE_SIZE, format);
ps.setProperties(properties);
ps.setMultiPage(true);
vectorGraphics = ps;
} else if (type.equals("emf")) {
vectorGraphics = new EMFGraphics2D(stream, dim);
} else if (type.equals("svg")) {
vectorGraphics = new SVGGraphics2D(stream, dim);
} else if (type.equals("swf")) {
vectorGraphics = new SWFGraphics2D(stream, dim);
} else {
throw new IllegalArgumentException("Unknown type: " + type);
}
return vectorGraphics;
}
use of org.freehep.graphicsio.svg.SVGGraphics2D in project cytoscape-impl by cytoscape.
the class SVGWriter method run.
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
taskMonitor.setProgress(0.0);
taskMonitor.setStatusMessage("SVG Rendering Start...");
logger.debug("SVG Rendering Start.");
final SVGGraphics2D g = new SVGGraphics2D(stream, new Dimension(width.intValue(), height.intValue()));
// this sets text as shape
final Properties p = new Properties();
p.setProperty("org.freehep.graphicsio.AbstractVectorGraphicsIO.TEXT_AS_SHAPES", Boolean.toString(!exportTextAsFont));
g.setProperties(p);
taskMonitor.setProgress(0.2);
g.startExport();
engine.printCanvas(g);
g.endExport();
logger.debug("SVG Rendering DONE.");
taskMonitor.setStatusMessage("SVG Rendering DONE.");
taskMonitor.setProgress(1.0);
}
use of org.freehep.graphicsio.svg.SVGGraphics2D in project clusterMaker2 by RBVI.
the class GraphicsExportPanel method svgSave.
private void svgSave(String format) {
com.itextpdf.text.Rectangle pageSize = PageSize.LETTER;
Properties p = new Properties();
p.setProperty(PSGraphics2D.PAGE_SIZE, "Letter");
p.setProperty("org.freehep.graphicsio.AbstractVectorGraphicsIO.TEXT_AS_SHAPES", Boolean.toString(false));
try {
OutputStream output = new BufferedOutputStream(new FileOutputStream(getFile()));
SVGGraphics2D g = new SVGGraphics2D(output, view);
double imageScale = Math.min(pageSize.getWidth() / ((double) estimateWidth() + getBorderPixels()), pageSize.getHeight() / ((double) estimateHeight() + getBorderPixels()));
g.setProperties(p);
g.startExport();
g.scale(imageScale, imageScale);
drawAll(g, 1.0);
g.endExport();
output.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(this, new JTextArea("Dendrogram export had problem " + e));
// logger.error("Exception " + e);
// e.printStackTrace();
}
}
Aggregations